Skip to content

Commit

Permalink
fix: update ref and selector as well
Browse files Browse the repository at this point in the history
  • Loading branch information
tenstad committed Jan 15, 2025
1 parent d5aedfd commit 0228b86
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
8 changes: 4 additions & 4 deletions apis/user/v1alpha1/accesskey_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ type AccessKeyParameters struct {
// +immutable
UserID string `json:"userId,omitempty"`

// UserRef is a reference to a user to retrieve its userId.
// UserIDRef is a reference to a user to retrieve its userId.
// +optional
// +immutable
UserRef *xpv1.Reference `json:"userRef,omitempty"`
UserIDRef *xpv1.Reference `json:"userIdRef,omitempty"`

// UserSelector selects reference to a user to retrieve its userId.
// UserIDSelector selects reference to a user to retrieve its userId.
// +optional
UserSelector *xpv1.Selector `json:"userSelector,omitempty"`
UserIDSelector *xpv1.Selector `json:"userIdSelector,omitempty"`
}

// AccessKeyObservation are the observable fields of a AccessKey.
Expand Down
16 changes: 8 additions & 8 deletions apis/user/v1alpha1/referencers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ func (mg *User) ResolveReferences(ctx context.Context, c client.Reader) error {
// resolve spec.forProvider.group
rsp, err := r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: mg.Spec.ForProvider.GroupID,
Reference: mg.Spec.ForProvider.GroupRef,
Selector: mg.Spec.ForProvider.GroupSelector,
Reference: mg.Spec.ForProvider.GroupIDRef,
Selector: mg.Spec.ForProvider.GroupIDSelector,
To: reference.To{Managed: &Group{}, List: &GroupList{}},
Extract: reference.ExternalName(),
})
Expand All @@ -42,7 +42,7 @@ func (mg *User) ResolveReferences(ctx context.Context, c client.Reader) error {
}

mg.Spec.ForProvider.GroupID = rsp.ResolvedValue
mg.Spec.ForProvider.GroupRef = rsp.ResolvedReference
mg.Spec.ForProvider.GroupIDRef = rsp.ResolvedReference

return nil
}
Expand All @@ -54,8 +54,8 @@ func (mg *AccessKey) ResolveReferences(ctx context.Context, c client.Reader) err
// resolve spec.forProvider.user
rsp, err := r.Resolve(ctx, reference.ResolutionRequest{
CurrentValue: mg.Spec.ForProvider.UserID,
Reference: mg.Spec.ForProvider.UserRef,
Selector: mg.Spec.ForProvider.UserSelector,
Reference: mg.Spec.ForProvider.UserIDRef,
Selector: mg.Spec.ForProvider.UserIDSelector,
To: reference.To{Managed: &User{}, List: &UserList{}},
Extract: reference.ExternalName(),
})
Expand All @@ -64,12 +64,12 @@ func (mg *AccessKey) ResolveReferences(ctx context.Context, c client.Reader) err
}

mg.Spec.ForProvider.UserID = rsp.ResolvedValue
mg.Spec.ForProvider.UserRef = rsp.ResolvedReference
mg.Spec.ForProvider.UserIDRef = rsp.ResolvedReference

// resolve spec.forProvider.group
rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
Reference: mg.Spec.ForProvider.UserRef,
Selector: mg.Spec.ForProvider.UserSelector,
Reference: mg.Spec.ForProvider.UserIDRef,
Selector: mg.Spec.ForProvider.UserIDSelector,
To: reference.To{Managed: &User{}, List: &UserList{}},
Extract: func(mg resource.Managed) string {
user, ok := mg.(*User)
Expand Down
8 changes: 4 additions & 4 deletions apis/user/v1alpha1/user_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ type UserParameters struct {
// +immutable
GroupID string `json:"groupId,omitempty"`

// GroupRef is a reference to a group to retrieve its groupId.
// GroupIDRef is a reference to a group to retrieve its groupId.
// +optional
// +immutable
GroupRef *xpv1.Reference `json:"groupRef,omitempty"`
GroupIDRef *xpv1.Reference `json:"groupIdRef,omitempty"`

// GroupSelector selects reference to a group to retrieve its groupId.
// GroupIDSelector selects reference to a group to retrieve its groupId.
// +optional
GroupSelector *xpv1.Selector `json:"groupSelector,omitempty"`
GroupIDSelector *xpv1.Selector `json:"groupIdSelector,omitempty"`
}

// UserObservation are the observable fields of a User.
Expand Down
16 changes: 8 additions & 8 deletions apis/user/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package/crds/user.cloudian.crossplane.io_accesskeys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ spec:
userId:
description: User for the new access key.
type: string
userRef:
description: UserRef is a reference to a user to retrieve its
userIdRef:
description: UserIDRef is a reference to a user to retrieve its
userId.
properties:
name:
Expand Down Expand Up @@ -115,8 +115,8 @@ spec:
required:
- name
type: object
userSelector:
description: UserSelector selects reference to a user to retrieve
userIdSelector:
description: UserIDSelector selects reference to a user to retrieve
its userId.
properties:
matchControllerRef:
Expand Down
10 changes: 5 additions & 5 deletions package/crds/user.cloudian.crossplane.io_users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ spec:
groupId:
description: Group for the new user.
type: string
groupRef:
description: GroupRef is a reference to a group to retrieve its
groupId.
groupIdRef:
description: GroupIDRef is a reference to a group to retrieve
its groupId.
properties:
name:
description: Name of the referenced object.
Expand Down Expand Up @@ -111,8 +111,8 @@ spec:
required:
- name
type: object
groupSelector:
description: GroupSelector selects reference to a group to retrieve
groupIdSelector:
description: GroupIDSelector selects reference to a group to retrieve
its groupId.
properties:
matchControllerRef:
Expand Down

0 comments on commit 0228b86

Please sign in to comment.