Skip to content

Commit

Permalink
refactor: adhere golang convension of capitalized abbreviations
Browse files Browse the repository at this point in the history
  • Loading branch information
mariatsji committed Nov 22, 2024
1 parent e130ccb commit ea5cd14
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
26 changes: 13 additions & 13 deletions internal/sdk/cloudian/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ import (

type Group struct {
Active string `json:"active"`
GroupId string `json:"groupId"`
GroupID string `json:"groupId"`
GroupName string `json:"groupName"`
LdapEnabled bool `json:"ldapEnabled"`
LdapGroup string `json:"ldapGroup"`
LdapMatchAttribute string `json:"ldapMatchAttribute"`
LdapSearch string `json:"ldapSearch"`
LdapSearchUserBase string `json:"ldapSearchUserBase"`
LdapServerURL string `json:"ldapServerURL"`
LdapUserDNTemplate string `json:"ldapUserDNTemplate"`
LDAPEnabled bool `json:"ldapEnabled"`
LDAPGroup string `json:"ldapGroup"`
LDAPMatchAttribute string `json:"ldapMatchAttribute"`
LDAPSearch string `json:"ldapSearch"`
LDAPSearchUserBase string `json:"ldapSearchUserBase"`
LDAPServerURL string `json:"ldapServerURL"`
LDAPUserDNTemplate string `json:"ldapUserDNTemplate"`
S3endpointshttp []string `json:"s3endpointshttp"`
S3endpointshttps []string `json:"s3endpointshttps"`
S3websiteendpoints []string `json:"s3websiteendpoints"`
}

type User struct {
UserId string `json:"userId"`
GroupId string `json:"groupId"`
CanonicalUserId string `json:"canonicalUserId"`
UserID string `json:"userId"`
GroupID string `json:"groupId"`
CanonicalUserID string `json:"canonicalUserId"`
}

func marshalGroup(group Group) ([]byte, error) {
Expand Down Expand Up @@ -105,7 +105,7 @@ func ListUsers(groupId string, offsetUserId *string, tokenBase64 string) ([]User
// There is some ambiguity in the GET /user/list endpoint documentation, but it seems
// that UserId is the correct key for this parameter (and not CanonicalUserId)
// Fetch more results
moreUsers, err := ListUsers(groupId, &users[limit].UserId, tokenBase64)
moreUsers, err := ListUsers(groupId, &users[limit].UserID, tokenBase64)

if err == nil {
retVal = append(retVal, moreUsers...)
Expand All @@ -122,7 +122,7 @@ func ListUsers(groupId string, offsetUserId *string, tokenBase64 string) ([]User

// Delete a single user
func DeleteUser(user User, tokenBase64 string) (*User, error) {
url := baseUrl + "/user?userId=" + user.UserId + "&groupId=" + user.GroupId + "&canonicalUserId=" + user.CanonicalUserId
url := baseUrl + "/user?userId=" + user.UserID + "&groupId=" + user.GroupID + "&canonicalUserId=" + user.CanonicalUserID

// Create a context with a timeout
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
Expand Down
12 changes: 6 additions & 6 deletions internal/sdk/cloudian/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func TestRealisticGroupSerialization(t *testing.T) {
t.Errorf("Error deserializing from JSON: %v", err)
}

if group.GroupId != "QA" {
t.Errorf("Expected QA, got %v", group.GroupId)
if group.GroupID != "QA" {
t.Errorf("Expected QA, got %v", group.GroupID)
}
}

Expand Down Expand Up @@ -75,12 +75,12 @@ func TestUnmarshalUsers(t *testing.T) {
t.Errorf("Error deserializing users from JSON: %v", err)
}

if users[0].UserId != "Glory" {
t.Errorf("Expected Glory as the userId of first user, got %v", users[0].UserId)
if users[0].UserID != "Glory" {
t.Errorf("Expected Glory as the userId of first user, got %v", users[0].UserID)
}

if users[1].UserId != "John" {
t.Errorf("Expected John as the userId of second user, got %v", users[1].UserId)
if users[1].UserID != "John" {
t.Errorf("Expected John as the userId of second user, got %v", users[1].UserID)
}

}

0 comments on commit ea5cd14

Please sign in to comment.