From c5eb2dccd58461770199310f0cb814cac3fe3d02 Mon Sep 17 00:00:00 2001 From: Amund Tenstad Date: Thu, 20 Feb 2025 17:32:52 +0100 Subject: [PATCH] unfeat: dont set connectiondetails in status yet --- apis/user/v1alpha1/user_types.go | 1 - internal/controller/user/user.go | 3 +-- internal/sdk/cloudian/sdk.go | 5 ++--- internal/sdk/cloudian/sdk_test.go | 4 ++-- package/crds/user.cloudian.crossplane.io_users.yaml | 3 --- 5 files changed, 5 insertions(+), 11 deletions(-) diff --git a/apis/user/v1alpha1/user_types.go b/apis/user/v1alpha1/user_types.go index 7e75c9f2..718c706e 100644 --- a/apis/user/v1alpha1/user_types.go +++ b/apis/user/v1alpha1/user_types.go @@ -44,7 +44,6 @@ type UserParameters struct { // UserObservation are the observable fields of a User. type UserObservation struct { - CanonicalID string `json:"canonicalId,omitempty"` } // A UserSpec defines the desired state of a User. diff --git a/internal/controller/user/user.go b/internal/controller/user/user.go index 038f42fc..6061a435 100644 --- a/internal/controller/user/user.go +++ b/internal/controller/user/user.go @@ -157,7 +157,7 @@ func (c *external) Observe(ctx context.Context, mg resource.Managed) (managed.Ex return managed.ExternalObservation{}, nil } - user, err := c.cloudianService.GetUser(ctx, cloudian.UserID{ + _, err := c.cloudianService.GetUser(ctx, cloudian.UserID{ GroupID: group, UserID: externalName}) if errors.Is(err, cloudian.ErrNotFound) { @@ -167,7 +167,6 @@ 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.SetConditions(xpv1.Available()) return managed.ExternalObservation{ diff --git a/internal/sdk/cloudian/sdk.go b/internal/sdk/cloudian/sdk.go index 29986b9d..3441ed25 100644 --- a/internal/sdk/cloudian/sdk.go +++ b/internal/sdk/cloudian/sdk.go @@ -101,9 +101,8 @@ type UserID struct { } type User struct { - UserID `json:",inline"` - UserType UserType `json:"userType"` - CanonicalUserID string `json:"canonicalUserId,omitempty"` + UserID `json:",inline"` + UserType UserType `json:"userType"` } // SecurityInfo is the Cloudian API's term for secure credentials diff --git a/internal/sdk/cloudian/sdk_test.go b/internal/sdk/cloudian/sdk_test.go index 1312872e..611c8842 100644 --- a/internal/sdk/cloudian/sdk_test.go +++ b/internal/sdk/cloudian/sdk_test.go @@ -163,8 +163,8 @@ func TestClient_GetUser(t *testing.T) { status int wantErr error }{ - {name: "Exists", user: User{UserID: UserID{UserID: strconv.Itoa(http.StatusOK)}, CanonicalUserID: "123"}}, - {name: "Not found", user: User{UserID: UserID{UserID: strconv.Itoa(http.StatusNoContent)}, CanonicalUserID: "456"}, wantErr: ErrNotFound}, + {name: "Exists", user: User{UserID: UserID{UserID: strconv.Itoa(http.StatusOK)}}}, + {name: "Not found", user: User{UserID: UserID{UserID: strconv.Itoa(http.StatusNoContent)}}, wantErr: ErrNotFound}, } client, testServer := mockBy(func(w http.ResponseWriter, r *http.Request) { diff --git a/package/crds/user.cloudian.crossplane.io_users.yaml b/package/crds/user.cloudian.crossplane.io_users.yaml index 6d0da325..da2ac316 100644 --- a/package/crds/user.cloudian.crossplane.io_users.yaml +++ b/package/crds/user.cloudian.crossplane.io_users.yaml @@ -325,9 +325,6 @@ spec: properties: atProvider: description: UserObservation are the observable fields of a User. - properties: - canonicalId: - type: string type: object conditions: description: Conditions of the resource.