Skip to content

Commit

Permalink
refactor: CanonicalID
Browse files Browse the repository at this point in the history
  • Loading branch information
tenstad committed Feb 20, 2025
1 parent 88cbef5 commit b303d6f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/controller/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (c *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex
return managed.ExternalObservation{}, errors.Wrap(err, errGetUser)
}

cr.Status.AtProvider.CanonicalID = user.CanonicalUserID
cr.Status.AtProvider.CanonicalID = user.CanonicalID
cr.SetConditions(xpv1.Available())

return managed.ExternalObservation{
Expand Down
6 changes: 3 additions & 3 deletions internal/sdk/cloudian/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ type GroupUserID struct {
}

type User struct {
GroupUserID `json:",inline"`
UserType UserType `json:"userType"`
CanonicalUserID string `json:"canonicalUserId,omitempty"`
GroupUserID `json:",inline"`
UserType UserType `json:"userType"`
CanonicalID string `json:"canonicalUserId,omitempty"`
}

// SecurityInfo is the Cloudian API's term for secure credentials
Expand Down
4 changes: 2 additions & 2 deletions internal/sdk/cloudian/sdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ func TestClient_GetUser(t *testing.T) {
status int
wantErr error
}{
{name: "Exists", user: User{GroupUserID: GroupUserID{UserID: strconv.Itoa(http.StatusOK)}, CanonicalUserID: "123"}},
{name: "Not found", user: User{GroupUserID: GroupUserID{UserID: strconv.Itoa(http.StatusNoContent)}, CanonicalUserID: "123"}, wantErr: ErrNotFound},
{name: "Exists", user: User{GroupUserID: GroupUserID{UserID: strconv.Itoa(http.StatusOK)}, CanonicalID: "123"}},
{name: "Not found", user: User{GroupUserID: GroupUserID{UserID: strconv.Itoa(http.StatusNoContent)}, CanonicalID: "123"}, wantErr: ErrNotFound},
}

client, testServer := mockBy(func(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit b303d6f

Please sign in to comment.