diff --git a/apis/openidclient/v1alpha1/zz_clientoptionalscopes_terraformed.go b/apis/openidclient/v1alpha1/zz_clientoptionalscopes_terraformed.go new file mode 100755 index 0000000..342a78f --- /dev/null +++ b/apis/openidclient/v1alpha1/zz_clientoptionalscopes_terraformed.go @@ -0,0 +1,129 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this ClientOptionalScopes +func (mg *ClientOptionalScopes) GetTerraformResourceType() string { + return "keycloak_openid_client_optional_scopes" +} + +// GetConnectionDetailsMapping for this ClientOptionalScopes +func (tr *ClientOptionalScopes) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ClientOptionalScopes +func (tr *ClientOptionalScopes) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ClientOptionalScopes +func (tr *ClientOptionalScopes) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ClientOptionalScopes +func (tr *ClientOptionalScopes) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ClientOptionalScopes +func (tr *ClientOptionalScopes) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ClientOptionalScopes +func (tr *ClientOptionalScopes) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this ClientOptionalScopes +func (tr *ClientOptionalScopes) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this ClientOptionalScopes +func (tr *ClientOptionalScopes) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this ClientOptionalScopes using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ClientOptionalScopes) LateInitialize(attrs []byte) (bool, error) { + params := &ClientOptionalScopesParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ClientOptionalScopes) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/openidclient/v1alpha1/zz_clientoptionalscopes_types.go b/apis/openidclient/v1alpha1/zz_clientoptionalscopes_types.go new file mode 100755 index 0000000..549e33c --- /dev/null +++ b/apis/openidclient/v1alpha1/zz_clientoptionalscopes_types.go @@ -0,0 +1,158 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type ClientOptionalScopesInitParameters struct { + + // The ID of the client to attach optional scopes to. Note that this is the unique ID of the client generated by Keycloak. + // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() + ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` + + // Reference to a Client in openidclient to populate clientId. + // +kubebuilder:validation:Optional + ClientIDRef *v1.Reference `json:"clientIdRef,omitempty" tf:"-"` + + // Selector for a Client in openidclient to populate clientId. + // +kubebuilder:validation:Optional + ClientIDSelector *v1.Selector `json:"clientIdSelector,omitempty" tf:"-"` + + // An array of client scope names to attach to this client as optional scopes. + // +listType=set + OptionalScopes []*string `json:"optionalScopes,omitempty" tf:"optional_scopes,omitempty"` + + // The realm this client and scopes exists in. + // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1.Realm + RealmID *string `json:"realmId,omitempty" tf:"realm_id,omitempty"` + + // Reference to a Realm in realm to populate realmId. + // +kubebuilder:validation:Optional + RealmIDRef *v1.Reference `json:"realmIdRef,omitempty" tf:"-"` + + // Selector for a Realm in realm to populate realmId. + // +kubebuilder:validation:Optional + RealmIDSelector *v1.Selector `json:"realmIdSelector,omitempty" tf:"-"` +} + +type ClientOptionalScopesObservation struct { + + // The ID of the client to attach optional scopes to. Note that this is the unique ID of the client generated by Keycloak. + ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // An array of client scope names to attach to this client as optional scopes. + // +listType=set + OptionalScopes []*string `json:"optionalScopes,omitempty" tf:"optional_scopes,omitempty"` + + // The realm this client and scopes exists in. + RealmID *string `json:"realmId,omitempty" tf:"realm_id,omitempty"` +} + +type ClientOptionalScopesParameters struct { + + // The ID of the client to attach optional scopes to. Note that this is the unique ID of the client generated by Keycloak. + // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1.Client + // +crossplane:generate:reference:extractor=github.com/crossplane-contrib/provider-keycloak/config/common.UUIDExtractor() + // +kubebuilder:validation:Optional + ClientID *string `json:"clientId,omitempty" tf:"client_id,omitempty"` + + // Reference to a Client in openidclient to populate clientId. + // +kubebuilder:validation:Optional + ClientIDRef *v1.Reference `json:"clientIdRef,omitempty" tf:"-"` + + // Selector for a Client in openidclient to populate clientId. + // +kubebuilder:validation:Optional + ClientIDSelector *v1.Selector `json:"clientIdSelector,omitempty" tf:"-"` + + // An array of client scope names to attach to this client as optional scopes. + // +kubebuilder:validation:Optional + // +listType=set + OptionalScopes []*string `json:"optionalScopes,omitempty" tf:"optional_scopes,omitempty"` + + // The realm this client and scopes exists in. + // +crossplane:generate:reference:type=github.com/crossplane-contrib/provider-keycloak/apis/realm/v1alpha1.Realm + // +kubebuilder:validation:Optional + RealmID *string `json:"realmId,omitempty" tf:"realm_id,omitempty"` + + // Reference to a Realm in realm to populate realmId. + // +kubebuilder:validation:Optional + RealmIDRef *v1.Reference `json:"realmIdRef,omitempty" tf:"-"` + + // Selector for a Realm in realm to populate realmId. + // +kubebuilder:validation:Optional + RealmIDSelector *v1.Selector `json:"realmIdSelector,omitempty" tf:"-"` +} + +// ClientOptionalScopesSpec defines the desired state of ClientOptionalScopes +type ClientOptionalScopesSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider ClientOptionalScopesParameters `json:"forProvider"` + // THIS IS A BETA FIELD. It will be honored + // unless the Management Policies feature flag is disabled. + // InitProvider holds the same fields as ForProvider, with the exception + // of Identifier and other resource reference fields. The fields that are + // in InitProvider are merged into ForProvider when the resource is created. + // The same fields are also added to the terraform ignore_changes hook, to + // avoid updating them after creation. This is useful for fields that are + // required on creation, but we do not desire to update them after creation, + // for example because of an external controller is managing them, like an + // autoscaler. + InitProvider ClientOptionalScopesInitParameters `json:"initProvider,omitempty"` +} + +// ClientOptionalScopesStatus defines the observed state of ClientOptionalScopes. +type ClientOptionalScopesStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider ClientOptionalScopesObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// ClientOptionalScopes is the Schema for the ClientOptionalScopess API. +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,keycloak} +type ClientOptionalScopes struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.optionalScopes) || (has(self.initProvider) && has(self.initProvider.optionalScopes))",message="spec.forProvider.optionalScopes is a required parameter" + Spec ClientOptionalScopesSpec `json:"spec"` + Status ClientOptionalScopesStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ClientOptionalScopesList contains a list of ClientOptionalScopess +type ClientOptionalScopesList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ClientOptionalScopes `json:"items"` +} + +// Repository type metadata. +var ( + ClientOptionalScopes_Kind = "ClientOptionalScopes" + ClientOptionalScopes_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: ClientOptionalScopes_Kind}.String() + ClientOptionalScopes_KindAPIVersion = ClientOptionalScopes_Kind + "." + CRDGroupVersion.String() + ClientOptionalScopes_GroupVersionKind = CRDGroupVersion.WithKind(ClientOptionalScopes_Kind) +) + +func init() { + SchemeBuilder.Register(&ClientOptionalScopes{}, &ClientOptionalScopesList{}) +} diff --git a/apis/openidclient/v1alpha1/zz_generated.conversion_hubs.go b/apis/openidclient/v1alpha1/zz_generated.conversion_hubs.go index 68a3bc6..8b94903 100755 --- a/apis/openidclient/v1alpha1/zz_generated.conversion_hubs.go +++ b/apis/openidclient/v1alpha1/zz_generated.conversion_hubs.go @@ -18,6 +18,9 @@ func (tr *ClientDefaultScopes) Hub() {} // Hub marks this type as a conversion hub. func (tr *ClientGroupPolicy) Hub() {} +// Hub marks this type as a conversion hub. +func (tr *ClientOptionalScopes) Hub() {} + // Hub marks this type as a conversion hub. func (tr *ClientPermissions) Hub() {} diff --git a/apis/openidclient/v1alpha1/zz_generated.deepcopy.go b/apis/openidclient/v1alpha1/zz_generated.deepcopy.go index 769843e..92acfb9 100644 --- a/apis/openidclient/v1alpha1/zz_generated.deepcopy.go +++ b/apis/openidclient/v1alpha1/zz_generated.deepcopy.go @@ -1722,6 +1722,253 @@ func (in *ClientObservation) DeepCopy() *ClientObservation { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientOptionalScopes) DeepCopyInto(out *ClientOptionalScopes) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientOptionalScopes. +func (in *ClientOptionalScopes) DeepCopy() *ClientOptionalScopes { + if in == nil { + return nil + } + out := new(ClientOptionalScopes) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClientOptionalScopes) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientOptionalScopesInitParameters) DeepCopyInto(out *ClientOptionalScopesInitParameters) { + *out = *in + if in.ClientID != nil { + in, out := &in.ClientID, &out.ClientID + *out = new(string) + **out = **in + } + if in.ClientIDRef != nil { + in, out := &in.ClientIDRef, &out.ClientIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ClientIDSelector != nil { + in, out := &in.ClientIDSelector, &out.ClientIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.OptionalScopes != nil { + in, out := &in.OptionalScopes, &out.OptionalScopes + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.RealmID != nil { + in, out := &in.RealmID, &out.RealmID + *out = new(string) + **out = **in + } + if in.RealmIDRef != nil { + in, out := &in.RealmIDRef, &out.RealmIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.RealmIDSelector != nil { + in, out := &in.RealmIDSelector, &out.RealmIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientOptionalScopesInitParameters. +func (in *ClientOptionalScopesInitParameters) DeepCopy() *ClientOptionalScopesInitParameters { + if in == nil { + return nil + } + out := new(ClientOptionalScopesInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientOptionalScopesList) DeepCopyInto(out *ClientOptionalScopesList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClientOptionalScopes, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientOptionalScopesList. +func (in *ClientOptionalScopesList) DeepCopy() *ClientOptionalScopesList { + if in == nil { + return nil + } + out := new(ClientOptionalScopesList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClientOptionalScopesList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientOptionalScopesObservation) DeepCopyInto(out *ClientOptionalScopesObservation) { + *out = *in + if in.ClientID != nil { + in, out := &in.ClientID, &out.ClientID + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.OptionalScopes != nil { + in, out := &in.OptionalScopes, &out.OptionalScopes + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.RealmID != nil { + in, out := &in.RealmID, &out.RealmID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientOptionalScopesObservation. +func (in *ClientOptionalScopesObservation) DeepCopy() *ClientOptionalScopesObservation { + if in == nil { + return nil + } + out := new(ClientOptionalScopesObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientOptionalScopesParameters) DeepCopyInto(out *ClientOptionalScopesParameters) { + *out = *in + if in.ClientID != nil { + in, out := &in.ClientID, &out.ClientID + *out = new(string) + **out = **in + } + if in.ClientIDRef != nil { + in, out := &in.ClientIDRef, &out.ClientIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ClientIDSelector != nil { + in, out := &in.ClientIDSelector, &out.ClientIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.OptionalScopes != nil { + in, out := &in.OptionalScopes, &out.OptionalScopes + *out = make([]*string, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(string) + **out = **in + } + } + } + if in.RealmID != nil { + in, out := &in.RealmID, &out.RealmID + *out = new(string) + **out = **in + } + if in.RealmIDRef != nil { + in, out := &in.RealmIDRef, &out.RealmIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.RealmIDSelector != nil { + in, out := &in.RealmIDSelector, &out.RealmIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientOptionalScopesParameters. +func (in *ClientOptionalScopesParameters) DeepCopy() *ClientOptionalScopesParameters { + if in == nil { + return nil + } + out := new(ClientOptionalScopesParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientOptionalScopesSpec) DeepCopyInto(out *ClientOptionalScopesSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) + in.InitProvider.DeepCopyInto(&out.InitProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientOptionalScopesSpec. +func (in *ClientOptionalScopesSpec) DeepCopy() *ClientOptionalScopesSpec { + if in == nil { + return nil + } + out := new(ClientOptionalScopesSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientOptionalScopesStatus) DeepCopyInto(out *ClientOptionalScopesStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientOptionalScopesStatus. +func (in *ClientOptionalScopesStatus) DeepCopy() *ClientOptionalScopesStatus { + if in == nil { + return nil + } + out := new(ClientOptionalScopesStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ClientParameters) DeepCopyInto(out *ClientParameters) { *out = *in diff --git a/apis/openidclient/v1alpha1/zz_generated.managed.go b/apis/openidclient/v1alpha1/zz_generated.managed.go index 48bb246..0daa57e 100644 --- a/apis/openidclient/v1alpha1/zz_generated.managed.go +++ b/apis/openidclient/v1alpha1/zz_generated.managed.go @@ -247,6 +247,66 @@ func (mg *ClientGroupPolicy) SetWriteConnectionSecretToReference(r *xpv1.SecretR mg.Spec.WriteConnectionSecretToReference = r } +// GetCondition of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetPublishConnectionDetailsTo of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetPublishConnectionDetailsTo of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} + // GetCondition of this ClientPermissions. func (mg *ClientPermissions) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) diff --git a/apis/openidclient/v1alpha1/zz_generated.managedlist.go b/apis/openidclient/v1alpha1/zz_generated.managedlist.go index 0734989..3749ec5 100644 --- a/apis/openidclient/v1alpha1/zz_generated.managedlist.go +++ b/apis/openidclient/v1alpha1/zz_generated.managedlist.go @@ -43,6 +43,15 @@ func (l *ClientList) GetItems() []resource.Managed { return items } +// GetItems of this ClientOptionalScopesList. +func (l *ClientOptionalScopesList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + // GetItems of this ClientPermissionsList. func (l *ClientPermissionsList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) diff --git a/apis/openidclient/v1alpha1/zz_generated.resolvers.go b/apis/openidclient/v1alpha1/zz_generated.resolvers.go index cd4cddc..55c93d9 100644 --- a/apis/openidclient/v1alpha1/zz_generated.resolvers.go +++ b/apis/openidclient/v1alpha1/zz_generated.resolvers.go @@ -455,6 +455,94 @@ func (mg *ClientGroupPolicy) ResolveReferences(ctx context.Context, c client.Rea return nil } +// ResolveReferences of this ClientOptionalScopes. +func (mg *ClientOptionalScopes) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + { + m, l, err = apisresolver.GetManagedResource("openidclient.keycloak.crossplane.io", "v1alpha1", "Client", "ClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.ClientID), + Extract: common.UUIDExtractor(), + Reference: mg.Spec.ForProvider.ClientIDRef, + Selector: mg.Spec.ForProvider.ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.ClientID") + } + mg.Spec.ForProvider.ClientID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.ClientIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("realm.keycloak.crossplane.io", "v1alpha1", "Realm", "RealmList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.RealmID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.RealmIDRef, + Selector: mg.Spec.ForProvider.RealmIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.RealmID") + } + mg.Spec.ForProvider.RealmID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.RealmIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("openidclient.keycloak.crossplane.io", "v1alpha1", "Client", "ClientList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.ClientID), + Extract: common.UUIDExtractor(), + Reference: mg.Spec.InitProvider.ClientIDRef, + Selector: mg.Spec.InitProvider.ClientIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.ClientID") + } + mg.Spec.InitProvider.ClientID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.ClientIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("realm.keycloak.crossplane.io", "v1alpha1", "Realm", "RealmList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.RealmID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.RealmIDRef, + Selector: mg.Spec.InitProvider.RealmIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.RealmID") + } + mg.Spec.InitProvider.RealmID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.RealmIDRef = rsp.ResolvedReference + + return nil +} + // ResolveReferences of this ClientPermissions. func (mg *ClientPermissions) ResolveReferences(ctx context.Context, c client.Reader) error { var m xpresource.Managed diff --git a/config/external_name.go b/config/external_name.go index ca7be99..c0233cf 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -22,6 +22,7 @@ var ExternalNameConfigs = map[string]config.ExternalName{ "keycloak_openid_client_role_policy": config.IdentifierFromProvider, "keycloak_openid_client_user_policy": config.IdentifierFromProvider, "keycloak_openid_client_default_scopes": config.IdentifierFromProvider, + "keycloak_openid_client_optional_scopes": config.IdentifierFromProvider, "keycloak_openid_client_scope": config.IdentifierFromProvider, "keycloak_openid_client": config.IdentifierFromProvider, "keycloak_openid_group_membership_protocol_mapper": config.IdentifierFromProvider, diff --git a/config/openidclient/config.go b/config/openidclient/config.go index d416c60..48339d4 100644 --- a/config/openidclient/config.go +++ b/config/openidclient/config.go @@ -30,6 +30,11 @@ func Configure(p *config.Provider) { r.ShortGroup = Group }) + p.AddResourceConfigurator("keycloak_openid_client_optional_scopes", func(r *config.Resource) { + // We need to override the default group that upjet generated for + r.ShortGroup = Group + }) + p.AddResourceConfigurator("keycloak_openid_client_scope", func(r *config.Resource) { // We need to override the default group that upjet generated for r.ShortGroup = Group diff --git a/examples-generated/openidclient/v1alpha1/clientoptionalscopes.yaml b/examples-generated/openidclient/v1alpha1/clientoptionalscopes.yaml new file mode 100644 index 0000000..473a44a --- /dev/null +++ b/examples-generated/openidclient/v1alpha1/clientoptionalscopes.yaml @@ -0,0 +1,74 @@ +apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 +kind: ClientOptionalScopes +metadata: + annotations: + meta.upbound.io/example-id: openidclient/v1alpha1/clientoptionalscopes + labels: + testing.upbound.io/example-name: client_optional_scopes + name: client-optional-scopes +spec: + forProvider: + clientIdSelector: + matchLabels: + testing.upbound.io/example-name: client + optionalScopes: + - address + - phone + - offline_access + - microprofile-jwt + - ${keycloak_openid_client_scope.client_scope.name} + realmIdSelector: + matchLabels: + testing.upbound.io/example-name: realm + +--- + +apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 +kind: Client +metadata: + annotations: + meta.upbound.io/example-id: openidclient/v1alpha1/clientoptionalscopes + labels: + testing.upbound.io/example-name: client + name: client +spec: + forProvider: + accessType: CONFIDENTIAL + clientIdSelector: + matchLabels: + testing.upbound.io/example-name: example + realmIdSelector: + matchLabels: + testing.upbound.io/example-name: realm + +--- + +apiVersion: openidclient.keycloak.crossplane.io/v1alpha1 +kind: ClientScope +metadata: + annotations: + meta.upbound.io/example-id: openidclient/v1alpha1/clientoptionalscopes + labels: + testing.upbound.io/example-name: client_scope + name: client-scope +spec: + forProvider: + name: test-client-scope + realmIdSelector: + matchLabels: + testing.upbound.io/example-name: realm + +--- + +apiVersion: realm.keycloak.crossplane.io/v1alpha1 +kind: Realm +metadata: + annotations: + meta.upbound.io/example-id: openidclient/v1alpha1/clientoptionalscopes + labels: + testing.upbound.io/example-name: realm + name: realm +spec: + forProvider: + enabled: true + realm: my-realm diff --git a/internal/controller/openidclient/clientoptionalscopes/zz_controller.go b/internal/controller/openidclient/clientoptionalscopes/zz_controller.go new file mode 100755 index 0000000..73e3865 --- /dev/null +++ b/internal/controller/openidclient/clientoptionalscopes/zz_controller.go @@ -0,0 +1,91 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package clientoptionalscopes + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/handler" + "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" + ctrl "sigs.k8s.io/controller-runtime" + + v1alpha1 "github.com/crossplane-contrib/provider-keycloak/apis/openidclient/v1alpha1" + features "github.com/crossplane-contrib/provider-keycloak/internal/features" +) + +// Setup adds a controller that reconciles ClientOptionalScopes managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1alpha1.ClientOptionalScopes_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) + } + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1alpha1.ClientOptionalScopes_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1alpha1.ClientOptionalScopes_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter( + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["keycloak_openid_client_optional_scopes"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1alpha1.ClientOptionalScopes_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } + if o.Features.Enabled(features.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + // register webhooks for the kind v1alpha1.ClientOptionalScopes + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1alpha1.ClientOptionalScopes{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1alpha1.ClientOptionalScopes") + } + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1alpha1.ClientOptionalScopesList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1alpha1.ClientOptionalScopesList") + } + } + + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1alpha1.ClientOptionalScopes_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + WithEventFilter(xpresource.DesiredStateChanged()). + Watches(&v1alpha1.ClientOptionalScopes{}, eventHandler). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index 990ebbe..256e470 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -39,6 +39,7 @@ import ( clientclientpolicy "github.com/crossplane-contrib/provider-keycloak/internal/controller/openidclient/clientclientpolicy" clientdefaultscopes "github.com/crossplane-contrib/provider-keycloak/internal/controller/openidclient/clientdefaultscopes" clientgrouppolicy "github.com/crossplane-contrib/provider-keycloak/internal/controller/openidclient/clientgrouppolicy" + clientoptionalscopes "github.com/crossplane-contrib/provider-keycloak/internal/controller/openidclient/clientoptionalscopes" clientpermissions "github.com/crossplane-contrib/provider-keycloak/internal/controller/openidclient/clientpermissions" clientrolepolicy "github.com/crossplane-contrib/provider-keycloak/internal/controller/openidclient/clientrolepolicy" clientscope "github.com/crossplane-contrib/provider-keycloak/internal/controller/openidclient/clientscope" @@ -97,6 +98,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { clientclientpolicy.Setup, clientdefaultscopes.Setup, clientgrouppolicy.Setup, + clientoptionalscopes.Setup, clientpermissions.Setup, clientrolepolicy.Setup, clientscope.Setup, diff --git a/package/crds/openidclient.keycloak.crossplane.io_clientoptionalscopes.yaml b/package/crds/openidclient.keycloak.crossplane.io_clientoptionalscopes.yaml new file mode 100644 index 0000000..bfcb953 --- /dev/null +++ b/package/crds/openidclient.keycloak.crossplane.io_clientoptionalscopes.yaml @@ -0,0 +1,674 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: clientoptionalscopes.openidclient.keycloak.crossplane.io +spec: + group: openidclient.keycloak.crossplane.io + names: + categories: + - crossplane + - managed + - keycloak + kind: ClientOptionalScopes + listKind: ClientOptionalScopesList + plural: clientoptionalscopes + singular: clientoptionalscopes + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: ClientOptionalScopes is the Schema for the ClientOptionalScopess + API. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: ClientOptionalScopesSpec defines the desired state of ClientOptionalScopes + properties: + deletionPolicy: + default: Delete + description: |- + DeletionPolicy specifies what will happen to the underlying external + when this managed resource is deleted - either "Delete" or "Orphan" the + external resource. + This field is planned to be deprecated in favor of the ManagementPolicies + field in a future release. Currently, both could be set independently and + non-default values would be honored if the feature flag is enabled. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + clientId: + description: The ID of the client to attach optional scopes to. + Note that this is the unique ID of the client generated by Keycloak. + type: string + clientIdRef: + description: Reference to a Client in openidclient to populate + clientId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + clientIdSelector: + description: Selector for a Client in openidclient to populate + clientId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + optionalScopes: + description: An array of client scope names to attach to this + client as optional scopes. + items: + type: string + type: array + x-kubernetes-list-type: set + realmId: + description: The realm this client and scopes exists in. + type: string + realmIdRef: + description: Reference to a Realm in realm to populate realmId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + realmIdSelector: + description: Selector for a Realm in realm to populate realmId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + type: object + initProvider: + description: |- + THIS IS A BETA FIELD. It will be honored + unless the Management Policies feature flag is disabled. + InitProvider holds the same fields as ForProvider, with the exception + of Identifier and other resource reference fields. The fields that are + in InitProvider are merged into ForProvider when the resource is created. + The same fields are also added to the terraform ignore_changes hook, to + avoid updating them after creation. This is useful for fields that are + required on creation, but we do not desire to update them after creation, + for example because of an external controller is managing them, like an + autoscaler. + properties: + clientId: + description: The ID of the client to attach optional scopes to. + Note that this is the unique ID of the client generated by Keycloak. + type: string + clientIdRef: + description: Reference to a Client in openidclient to populate + clientId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + clientIdSelector: + description: Selector for a Client in openidclient to populate + clientId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + optionalScopes: + description: An array of client scope names to attach to this + client as optional scopes. + items: + type: string + type: array + x-kubernetes-list-type: set + realmId: + description: The realm this client and scopes exists in. + type: string + realmIdRef: + description: Reference to a Realm in realm to populate realmId. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + realmIdSelector: + description: Selector for a Realm in realm to populate realmId. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + type: object + managementPolicies: + default: + - '*' + description: |- + THIS IS A BETA FIELD. It is on by default but can be opted out + through a Crossplane feature flag. + ManagementPolicies specify the array of actions Crossplane is allowed to + take on the managed and external resources. + This field is planned to replace the DeletionPolicy field in a future + release. Currently, both could be set independently and non-default + values would be honored if the feature flag is enabled. If both are + custom, the DeletionPolicy field will be ignored. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md + items: + description: |- + A ManagementAction represents an action that the Crossplane controllers + can take on an external resource. + enum: + - Observe + - Create + - Update + - Delete + - LateInitialize + - '*' + type: string + type: array + providerConfigRef: + default: + name: default + description: |- + ProviderConfigReference specifies how the provider that will be used to + create, observe, update, and delete this managed resource should be + configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: |- + PublishConnectionDetailsTo specifies the connection secret config which + contains a name, metadata and a reference to secret store config to + which any connection details for this managed resource should be written. + Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: |- + SecretStoreConfigRef specifies which secret store config should be used + for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations are the annotations to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.annotations". + - It is up to Secret Store implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: |- + Labels are the labels/tags to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store types. + type: object + type: + description: |- + Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: |- + WriteConnectionSecretToReference specifies the namespace and name of a + Secret to which any connection details for this managed resource should + be written. Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + This field is planned to be replaced in a future release in favor of + PublishConnectionDetailsTo. Currently, both could be set independently + and connection details would be published to both without affecting + each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + x-kubernetes-validations: + - message: spec.forProvider.optionalScopes is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.optionalScopes) + || (has(self.initProvider) && has(self.initProvider.optionalScopes))' + status: + description: ClientOptionalScopesStatus defines the observed state of + ClientOptionalScopes. + properties: + atProvider: + properties: + clientId: + description: The ID of the client to attach optional scopes to. + Note that this is the unique ID of the client generated by Keycloak. + type: string + id: + type: string + optionalScopes: + description: An array of client scope names to attach to this + client as optional scopes. + items: + type: string + type: array + x-kubernetes-list-type: set + realmId: + description: The realm this client and scopes exists in. + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time this condition transitioned from one + status to another. + format: date-time + type: string + message: + description: |- + A Message containing details about this condition's last transition from + one status to another, if any. + type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: |- + Type of this condition. At most one of each condition type may apply to + a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedGeneration: + description: |- + ObservedGeneration is the latest metadata.generation + which resulted in either a ready state, or stalled due to error + it can not recover from without human intervention. + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {}