From 12854c0b989ca34a892cadea7195aa72a09fea77 Mon Sep 17 00:00:00 2001 From: Alper Rifat Ulucinar Date: Wed, 29 May 2024 22:53:25 +0300 Subject: [PATCH] Remove SecurityConfig.opensearchserverless resource's singleton list conversion for the samlOptions field as its schema is already a single nested block. - saml_options is thus already generated as an embedded object and not a singleton list. Signed-off-by: Alper Rifat Ulucinar --- .../v1beta1/zz_generated.conversion_hubs.go | 3 + .../v1beta2/zz_generated.conversion_hubs.go | 10 - .../v1beta2/zz_generated.deepcopy.go | 312 -------------- .../v1beta2/zz_generated.managed.go | 68 --- .../v1beta2/zz_generated.managedlist.go | 17 - .../v1beta2/zz_groupversion_info.go | 32 -- .../v1beta2/zz_securityconfig_terraformed.go | 129 ------ .../v1beta2/zz_securityconfig_types.go | 170 -------- apis/zz_register.go | 2 - config/opensearchserverless/config.go | 7 + go.mod | 2 + go.sum | 4 +- ...erless.aws.upbound.io_securityconfigs.yaml | 389 ------------------ 13 files changed, 14 insertions(+), 1131 deletions(-) delete mode 100755 apis/opensearchserverless/v1beta2/zz_generated.conversion_hubs.go delete mode 100644 apis/opensearchserverless/v1beta2/zz_generated.deepcopy.go delete mode 100644 apis/opensearchserverless/v1beta2/zz_generated.managed.go delete mode 100644 apis/opensearchserverless/v1beta2/zz_generated.managedlist.go delete mode 100755 apis/opensearchserverless/v1beta2/zz_groupversion_info.go delete mode 100755 apis/opensearchserverless/v1beta2/zz_securityconfig_terraformed.go delete mode 100755 apis/opensearchserverless/v1beta2/zz_securityconfig_types.go diff --git a/apis/opensearchserverless/v1beta1/zz_generated.conversion_hubs.go b/apis/opensearchserverless/v1beta1/zz_generated.conversion_hubs.go index c32f5352fd..89e575faa8 100755 --- a/apis/opensearchserverless/v1beta1/zz_generated.conversion_hubs.go +++ b/apis/opensearchserverless/v1beta1/zz_generated.conversion_hubs.go @@ -15,6 +15,9 @@ func (tr *Collection) Hub() {} // Hub marks this type as a conversion hub. func (tr *LifecyclePolicy) Hub() {} +// Hub marks this type as a conversion hub. +func (tr *SecurityConfig) Hub() {} + // Hub marks this type as a conversion hub. func (tr *SecurityPolicy) Hub() {} diff --git a/apis/opensearchserverless/v1beta2/zz_generated.conversion_hubs.go b/apis/opensearchserverless/v1beta2/zz_generated.conversion_hubs.go deleted file mode 100755 index 607288f4ed..0000000000 --- a/apis/opensearchserverless/v1beta2/zz_generated.conversion_hubs.go +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by upjet. DO NOT EDIT. - -package v1beta2 - -// Hub marks this type as a conversion hub. -func (tr *SecurityConfig) Hub() {} diff --git a/apis/opensearchserverless/v1beta2/zz_generated.deepcopy.go b/apis/opensearchserverless/v1beta2/zz_generated.deepcopy.go deleted file mode 100644 index 89a77e6677..0000000000 --- a/apis/opensearchserverless/v1beta2/zz_generated.deepcopy.go +++ /dev/null @@ -1,312 +0,0 @@ -//go:build !ignore_autogenerated - -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by controller-gen. DO NOT EDIT. - -package v1beta2 - -import ( - runtime "k8s.io/apimachinery/pkg/runtime" -) - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SAMLOptionsInitParameters) DeepCopyInto(out *SAMLOptionsInitParameters) { - *out = *in - if in.GroupAttribute != nil { - in, out := &in.GroupAttribute, &out.GroupAttribute - *out = new(string) - **out = **in - } - if in.Metadata != nil { - in, out := &in.Metadata, &out.Metadata - *out = new(string) - **out = **in - } - if in.SessionTimeout != nil { - in, out := &in.SessionTimeout, &out.SessionTimeout - *out = new(float64) - **out = **in - } - if in.UserAttribute != nil { - in, out := &in.UserAttribute, &out.UserAttribute - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SAMLOptionsInitParameters. -func (in *SAMLOptionsInitParameters) DeepCopy() *SAMLOptionsInitParameters { - if in == nil { - return nil - } - out := new(SAMLOptionsInitParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SAMLOptionsObservation) DeepCopyInto(out *SAMLOptionsObservation) { - *out = *in - if in.GroupAttribute != nil { - in, out := &in.GroupAttribute, &out.GroupAttribute - *out = new(string) - **out = **in - } - if in.Metadata != nil { - in, out := &in.Metadata, &out.Metadata - *out = new(string) - **out = **in - } - if in.SessionTimeout != nil { - in, out := &in.SessionTimeout, &out.SessionTimeout - *out = new(float64) - **out = **in - } - if in.UserAttribute != nil { - in, out := &in.UserAttribute, &out.UserAttribute - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SAMLOptionsObservation. -func (in *SAMLOptionsObservation) DeepCopy() *SAMLOptionsObservation { - if in == nil { - return nil - } - out := new(SAMLOptionsObservation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SAMLOptionsParameters) DeepCopyInto(out *SAMLOptionsParameters) { - *out = *in - if in.GroupAttribute != nil { - in, out := &in.GroupAttribute, &out.GroupAttribute - *out = new(string) - **out = **in - } - if in.Metadata != nil { - in, out := &in.Metadata, &out.Metadata - *out = new(string) - **out = **in - } - if in.SessionTimeout != nil { - in, out := &in.SessionTimeout, &out.SessionTimeout - *out = new(float64) - **out = **in - } - if in.UserAttribute != nil { - in, out := &in.UserAttribute, &out.UserAttribute - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SAMLOptionsParameters. -func (in *SAMLOptionsParameters) DeepCopy() *SAMLOptionsParameters { - if in == nil { - return nil - } - out := new(SAMLOptionsParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityConfig) DeepCopyInto(out *SecurityConfig) { - *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 SecurityConfig. -func (in *SecurityConfig) DeepCopy() *SecurityConfig { - if in == nil { - return nil - } - out := new(SecurityConfig) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SecurityConfig) 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 *SecurityConfigInitParameters) DeepCopyInto(out *SecurityConfigInitParameters) { - *out = *in - if in.Description != nil { - in, out := &in.Description, &out.Description - *out = new(string) - **out = **in - } - if in.SAMLOptions != nil { - in, out := &in.SAMLOptions, &out.SAMLOptions - *out = new(SAMLOptionsInitParameters) - (*in).DeepCopyInto(*out) - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityConfigInitParameters. -func (in *SecurityConfigInitParameters) DeepCopy() *SecurityConfigInitParameters { - if in == nil { - return nil - } - out := new(SecurityConfigInitParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityConfigList) DeepCopyInto(out *SecurityConfigList) { - *out = *in - out.TypeMeta = in.TypeMeta - in.ListMeta.DeepCopyInto(&out.ListMeta) - if in.Items != nil { - in, out := &in.Items, &out.Items - *out = make([]SecurityConfig, len(*in)) - for i := range *in { - (*in)[i].DeepCopyInto(&(*out)[i]) - } - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityConfigList. -func (in *SecurityConfigList) DeepCopy() *SecurityConfigList { - if in == nil { - return nil - } - out := new(SecurityConfigList) - in.DeepCopyInto(out) - return out -} - -// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *SecurityConfigList) 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 *SecurityConfigObservation) DeepCopyInto(out *SecurityConfigObservation) { - *out = *in - if in.ConfigVersion != nil { - in, out := &in.ConfigVersion, &out.ConfigVersion - *out = new(string) - **out = **in - } - if in.Description != nil { - in, out := &in.Description, &out.Description - *out = new(string) - **out = **in - } - if in.ID != nil { - in, out := &in.ID, &out.ID - *out = new(string) - **out = **in - } - if in.SAMLOptions != nil { - in, out := &in.SAMLOptions, &out.SAMLOptions - *out = new(SAMLOptionsObservation) - (*in).DeepCopyInto(*out) - } - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityConfigObservation. -func (in *SecurityConfigObservation) DeepCopy() *SecurityConfigObservation { - if in == nil { - return nil - } - out := new(SecurityConfigObservation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityConfigParameters) DeepCopyInto(out *SecurityConfigParameters) { - *out = *in - if in.Description != nil { - in, out := &in.Description, &out.Description - *out = new(string) - **out = **in - } - if in.Region != nil { - in, out := &in.Region, &out.Region - *out = new(string) - **out = **in - } - if in.SAMLOptions != nil { - in, out := &in.SAMLOptions, &out.SAMLOptions - *out = new(SAMLOptionsParameters) - (*in).DeepCopyInto(*out) - } - if in.Type != nil { - in, out := &in.Type, &out.Type - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityConfigParameters. -func (in *SecurityConfigParameters) DeepCopy() *SecurityConfigParameters { - if in == nil { - return nil - } - out := new(SecurityConfigParameters) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityConfigSpec) DeepCopyInto(out *SecurityConfigSpec) { - *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 SecurityConfigSpec. -func (in *SecurityConfigSpec) DeepCopy() *SecurityConfigSpec { - if in == nil { - return nil - } - out := new(SecurityConfigSpec) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecurityConfigStatus) DeepCopyInto(out *SecurityConfigStatus) { - *out = *in - in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) - in.AtProvider.DeepCopyInto(&out.AtProvider) -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecurityConfigStatus. -func (in *SecurityConfigStatus) DeepCopy() *SecurityConfigStatus { - if in == nil { - return nil - } - out := new(SecurityConfigStatus) - in.DeepCopyInto(out) - return out -} diff --git a/apis/opensearchserverless/v1beta2/zz_generated.managed.go b/apis/opensearchserverless/v1beta2/zz_generated.managed.go deleted file mode 100644 index 8fb23e1f30..0000000000 --- a/apis/opensearchserverless/v1beta2/zz_generated.managed.go +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 -// Code generated by angryjet. DO NOT EDIT. - -package v1beta2 - -import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" - -// GetCondition of this SecurityConfig. -func (mg *SecurityConfig) GetCondition(ct xpv1.ConditionType) xpv1.Condition { - return mg.Status.GetCondition(ct) -} - -// GetDeletionPolicy of this SecurityConfig. -func (mg *SecurityConfig) GetDeletionPolicy() xpv1.DeletionPolicy { - return mg.Spec.DeletionPolicy -} - -// GetManagementPolicies of this SecurityConfig. -func (mg *SecurityConfig) GetManagementPolicies() xpv1.ManagementPolicies { - return mg.Spec.ManagementPolicies -} - -// GetProviderConfigReference of this SecurityConfig. -func (mg *SecurityConfig) GetProviderConfigReference() *xpv1.Reference { - return mg.Spec.ProviderConfigReference -} - -// GetPublishConnectionDetailsTo of this SecurityConfig. -func (mg *SecurityConfig) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { - return mg.Spec.PublishConnectionDetailsTo -} - -// GetWriteConnectionSecretToReference of this SecurityConfig. -func (mg *SecurityConfig) GetWriteConnectionSecretToReference() *xpv1.SecretReference { - return mg.Spec.WriteConnectionSecretToReference -} - -// SetConditions of this SecurityConfig. -func (mg *SecurityConfig) SetConditions(c ...xpv1.Condition) { - mg.Status.SetConditions(c...) -} - -// SetDeletionPolicy of this SecurityConfig. -func (mg *SecurityConfig) SetDeletionPolicy(r xpv1.DeletionPolicy) { - mg.Spec.DeletionPolicy = r -} - -// SetManagementPolicies of this SecurityConfig. -func (mg *SecurityConfig) SetManagementPolicies(r xpv1.ManagementPolicies) { - mg.Spec.ManagementPolicies = r -} - -// SetProviderConfigReference of this SecurityConfig. -func (mg *SecurityConfig) SetProviderConfigReference(r *xpv1.Reference) { - mg.Spec.ProviderConfigReference = r -} - -// SetPublishConnectionDetailsTo of this SecurityConfig. -func (mg *SecurityConfig) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { - mg.Spec.PublishConnectionDetailsTo = r -} - -// SetWriteConnectionSecretToReference of this SecurityConfig. -func (mg *SecurityConfig) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { - mg.Spec.WriteConnectionSecretToReference = r -} diff --git a/apis/opensearchserverless/v1beta2/zz_generated.managedlist.go b/apis/opensearchserverless/v1beta2/zz_generated.managedlist.go deleted file mode 100644 index 086a8fdeab..0000000000 --- a/apis/opensearchserverless/v1beta2/zz_generated.managedlist.go +++ /dev/null @@ -1,17 +0,0 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 -// Code generated by angryjet. DO NOT EDIT. - -package v1beta2 - -import resource "github.com/crossplane/crossplane-runtime/pkg/resource" - -// GetItems of this SecurityConfigList. -func (l *SecurityConfigList) GetItems() []resource.Managed { - items := make([]resource.Managed, len(l.Items)) - for i := range l.Items { - items[i] = &l.Items[i] - } - return items -} diff --git a/apis/opensearchserverless/v1beta2/zz_groupversion_info.go b/apis/opensearchserverless/v1beta2/zz_groupversion_info.go deleted file mode 100755 index 240888af55..0000000000 --- a/apis/opensearchserverless/v1beta2/zz_groupversion_info.go +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by upjet. DO NOT EDIT. - -// +kubebuilder:object:generate=true -// +groupName=opensearchserverless.aws.upbound.io -// +versionName=v1beta2 -package v1beta2 - -import ( - "k8s.io/apimachinery/pkg/runtime/schema" - "sigs.k8s.io/controller-runtime/pkg/scheme" -) - -// Package type metadata. -const ( - CRDGroup = "opensearchserverless.aws.upbound.io" - CRDVersion = "v1beta2" -) - -var ( - // CRDGroupVersion is the API Group Version used to register the objects - CRDGroupVersion = schema.GroupVersion{Group: CRDGroup, Version: CRDVersion} - - // SchemeBuilder is used to add go types to the GroupVersionKind scheme - SchemeBuilder = &scheme.Builder{GroupVersion: CRDGroupVersion} - - // AddToScheme adds the types in this group-version to the given scheme. - AddToScheme = SchemeBuilder.AddToScheme -) diff --git a/apis/opensearchserverless/v1beta2/zz_securityconfig_terraformed.go b/apis/opensearchserverless/v1beta2/zz_securityconfig_terraformed.go deleted file mode 100755 index 2f8bd64d95..0000000000 --- a/apis/opensearchserverless/v1beta2/zz_securityconfig_terraformed.go +++ /dev/null @@ -1,129 +0,0 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by upjet. DO NOT EDIT. - -package v1beta2 - -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 SecurityConfig -func (mg *SecurityConfig) GetTerraformResourceType() string { - return "aws_opensearchserverless_security_config" -} - -// GetConnectionDetailsMapping for this SecurityConfig -func (tr *SecurityConfig) GetConnectionDetailsMapping() map[string]string { - return nil -} - -// GetObservation of this SecurityConfig -func (tr *SecurityConfig) 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 SecurityConfig -func (tr *SecurityConfig) 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 SecurityConfig -func (tr *SecurityConfig) GetID() string { - if tr.Status.AtProvider.ID == nil { - return "" - } - return *tr.Status.AtProvider.ID -} - -// GetParameters of this SecurityConfig -func (tr *SecurityConfig) 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 SecurityConfig -func (tr *SecurityConfig) 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 SecurityConfig -func (tr *SecurityConfig) 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 SecurityConfig -func (tr *SecurityConfig) 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 SecurityConfig using its observed tfState. -// returns True if there are any spec changes for the resource. -func (tr *SecurityConfig) LateInitialize(attrs []byte) (bool, error) { - params := &SecurityConfigParameters{} - 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 *SecurityConfig) GetTerraformSchemaVersion() int { - return 0 -} diff --git a/apis/opensearchserverless/v1beta2/zz_securityconfig_types.go b/apis/opensearchserverless/v1beta2/zz_securityconfig_types.go deleted file mode 100755 index 30b4d306b9..0000000000 --- a/apis/opensearchserverless/v1beta2/zz_securityconfig_types.go +++ /dev/null @@ -1,170 +0,0 @@ -// SPDX-FileCopyrightText: 2024 The Crossplane Authors -// -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by upjet. DO NOT EDIT. - -package v1beta2 - -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 SAMLOptionsInitParameters struct { - - // Group attribute for this SAML integration. - GroupAttribute *string `json:"groupAttribute,omitempty" tf:"group_attribute,omitempty"` - - // The XML IdP metadata file generated from your identity provider. - Metadata *string `json:"metadata,omitempty" tf:"metadata,omitempty"` - - // Session timeout, in minutes. Minimum is 5 minutes and maximum is 720 minutes (12 hours). Default is 60 minutes. - SessionTimeout *float64 `json:"sessionTimeout,omitempty" tf:"session_timeout,omitempty"` - - // User attribute for this SAML integration. - UserAttribute *string `json:"userAttribute,omitempty" tf:"user_attribute,omitempty"` -} - -type SAMLOptionsObservation struct { - - // Group attribute for this SAML integration. - GroupAttribute *string `json:"groupAttribute,omitempty" tf:"group_attribute,omitempty"` - - // The XML IdP metadata file generated from your identity provider. - Metadata *string `json:"metadata,omitempty" tf:"metadata,omitempty"` - - // Session timeout, in minutes. Minimum is 5 minutes and maximum is 720 minutes (12 hours). Default is 60 minutes. - SessionTimeout *float64 `json:"sessionTimeout,omitempty" tf:"session_timeout,omitempty"` - - // User attribute for this SAML integration. - UserAttribute *string `json:"userAttribute,omitempty" tf:"user_attribute,omitempty"` -} - -type SAMLOptionsParameters struct { - - // Group attribute for this SAML integration. - // +kubebuilder:validation:Optional - GroupAttribute *string `json:"groupAttribute,omitempty" tf:"group_attribute,omitempty"` - - // The XML IdP metadata file generated from your identity provider. - // +kubebuilder:validation:Optional - Metadata *string `json:"metadata" tf:"metadata,omitempty"` - - // Session timeout, in minutes. Minimum is 5 minutes and maximum is 720 minutes (12 hours). Default is 60 minutes. - // +kubebuilder:validation:Optional - SessionTimeout *float64 `json:"sessionTimeout,omitempty" tf:"session_timeout,omitempty"` - - // User attribute for this SAML integration. - // +kubebuilder:validation:Optional - UserAttribute *string `json:"userAttribute,omitempty" tf:"user_attribute,omitempty"` -} - -type SecurityConfigInitParameters struct { - - // Description of the security configuration. - Description *string `json:"description,omitempty" tf:"description,omitempty"` - - // Configuration block for SAML options. - SAMLOptions *SAMLOptionsInitParameters `json:"samlOptions,omitempty" tf:"saml_options,omitempty"` -} - -type SecurityConfigObservation struct { - - // Version of the configuration. - ConfigVersion *string `json:"configVersion,omitempty" tf:"config_version,omitempty"` - - // Description of the security configuration. - Description *string `json:"description,omitempty" tf:"description,omitempty"` - - ID *string `json:"id,omitempty" tf:"id,omitempty"` - - // Configuration block for SAML options. - SAMLOptions *SAMLOptionsObservation `json:"samlOptions,omitempty" tf:"saml_options,omitempty"` - - // Type of configuration. Must be saml. - Type *string `json:"type,omitempty" tf:"type,omitempty"` -} - -type SecurityConfigParameters struct { - - // Description of the security configuration. - // +kubebuilder:validation:Optional - Description *string `json:"description,omitempty" tf:"description,omitempty"` - - // Region is the region you'd like your resource to be created in. - // +upjet:crd:field:TFTag=- - // +kubebuilder:validation:Required - Region *string `json:"region" tf:"-"` - - // Configuration block for SAML options. - // +kubebuilder:validation:Optional - SAMLOptions *SAMLOptionsParameters `json:"samlOptions,omitempty" tf:"saml_options,omitempty"` - - // Type of configuration. Must be saml. - // +kubebuilder:validation:Required - Type *string `json:"type" tf:"type,omitempty"` -} - -// SecurityConfigSpec defines the desired state of SecurityConfig -type SecurityConfigSpec struct { - v1.ResourceSpec `json:",inline"` - ForProvider SecurityConfigParameters `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 SecurityConfigInitParameters `json:"initProvider,omitempty"` -} - -// SecurityConfigStatus defines the observed state of SecurityConfig. -type SecurityConfigStatus struct { - v1.ResourceStatus `json:",inline"` - AtProvider SecurityConfigObservation `json:"atProvider,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status - -// SecurityConfig is the Schema for the SecurityConfigs 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,aws} -type SecurityConfig 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.samlOptions) || (has(self.initProvider) && has(self.initProvider.samlOptions))",message="spec.forProvider.samlOptions is a required parameter" - Spec SecurityConfigSpec `json:"spec"` - Status SecurityConfigStatus `json:"status,omitempty"` -} - -// +kubebuilder:object:root=true - -// SecurityConfigList contains a list of SecurityConfigs -type SecurityConfigList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []SecurityConfig `json:"items"` -} - -// Repository type metadata. -var ( - SecurityConfig_Kind = "SecurityConfig" - SecurityConfig_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: SecurityConfig_Kind}.String() - SecurityConfig_KindAPIVersion = SecurityConfig_Kind + "." + CRDGroupVersion.String() - SecurityConfig_GroupVersionKind = CRDGroupVersion.WithKind(SecurityConfig_Kind) -) - -func init() { - SchemeBuilder.Register(&SecurityConfig{}, &SecurityConfigList{}) -} diff --git a/apis/zz_register.go b/apis/zz_register.go index a6367ed5ff..53af69f74d 100755 --- a/apis/zz_register.go +++ b/apis/zz_register.go @@ -216,7 +216,6 @@ import ( v1beta1opensearch "github.com/upbound/provider-aws/apis/opensearch/v1beta1" v1beta2opensearch "github.com/upbound/provider-aws/apis/opensearch/v1beta2" v1beta1opensearchserverless "github.com/upbound/provider-aws/apis/opensearchserverless/v1beta1" - v1beta2opensearchserverless "github.com/upbound/provider-aws/apis/opensearchserverless/v1beta2" v1beta1opsworks "github.com/upbound/provider-aws/apis/opsworks/v1beta1" v1beta2opsworks "github.com/upbound/provider-aws/apis/opsworks/v1beta2" v1beta1organizations "github.com/upbound/provider-aws/apis/organizations/v1beta1" @@ -508,7 +507,6 @@ func init() { v1beta1opensearch.SchemeBuilder.AddToScheme, v1beta2opensearch.SchemeBuilder.AddToScheme, v1beta1opensearchserverless.SchemeBuilder.AddToScheme, - v1beta2opensearchserverless.SchemeBuilder.AddToScheme, v1beta1opsworks.SchemeBuilder.AddToScheme, v1beta2opsworks.SchemeBuilder.AddToScheme, v1beta1organizations.SchemeBuilder.AddToScheme, diff --git a/config/opensearchserverless/config.go b/config/opensearchserverless/config.go index b13386db66..4b9f8674e0 100644 --- a/config/opensearchserverless/config.go +++ b/config/opensearchserverless/config.go @@ -11,6 +11,13 @@ import ( // Configure adds configurations for the opensearchserverless group. func Configure(p *config.Provider) { p.AddResourceConfigurator("aws_opensearchserverless_security_config", func(r *config.Resource) { + r.RemoveSingletonListConversion("saml_options") + // set the path saml_options as an embedded object to honor + // its single nested block schema. We need to have it converted + // into an embedded object but there's no need for + // the Terraform conversion (it already needs to be treated + // as an object at the Terraform layer and in the current MR API, + // it's already an embedded object). r.SchemaElementOptions.SetEmbeddedObject("saml_options") }) p.AddResourceConfigurator("aws_opensearchserverless_security_policy", func(r *config.Resource) { diff --git a/go.mod b/go.mod index e73519a9b9..2c97599fea 100644 --- a/go.mod +++ b/go.mod @@ -363,3 +363,5 @@ require ( replace github.com/hashicorp/terraform-plugin-log => github.com/gdavison/terraform-plugin-log v0.0.0-20230928191232-6c653d8ef8fb replace github.com/hashicorp/terraform-provider-aws => github.com/upbound/terraform-provider-aws v0.0.0-20240523140457-101595b8576e + +replace github.com/crossplane/upjet => github.com/ulucinar/upbound-upjet v0.0.0-20240529194811-fc6948e3c67c diff --git a/go.sum b/go.sum index 4a020c00ec..2d54b03327 100644 --- a/go.sum +++ b/go.sum @@ -422,8 +422,6 @@ github.com/crossplane/crossplane-runtime v1.16.0-rc.2.0.20240510094504-3f697876f github.com/crossplane/crossplane-runtime v1.16.0-rc.2.0.20240510094504-3f697876fa57/go.mod h1:Pz2tdGVMF6KDGzHZOkvKro0nKc8EzK0sb/nSA7pH4Dc= github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79 h1:HigXs5tEQxWz0fcj8hzbU2UAZgEM7wPe0XRFOsrtF8Y= github.com/crossplane/crossplane-tools v0.0.0-20230925130601-628280f8bf79/go.mod h1:+e4OaFlOcmr0JvINHl/yvEYBrZawzTgj6pQumOH1SS0= -github.com/crossplane/upjet v1.4.0 h1:twKCU8omU7VAA7E5fpbQkqDHjVnoTb8EXqmB805Q37o= -github.com/crossplane/upjet v1.4.0/go.mod h1:3pDVtCgyBc5f2Zx4K5HEPxxhjndmOc5CHCJNpIivK/g= github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/dave/jennifer v1.4.1 h1:XyqG6cn5RQsTj3qlWQTKlRGAyrTcsk1kUmWdZBzRjDw= @@ -712,6 +710,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tmccombs/hcl2json v0.3.3 h1:+DLNYqpWE0CsOQiEZu+OZm5ZBImake3wtITYxQ8uLFQ= github.com/tmccombs/hcl2json v0.3.3/go.mod h1:Y2chtz2x9bAeRTvSibVRVgbLJhLJXKlUeIvjeVdnm4w= +github.com/ulucinar/upbound-upjet v0.0.0-20240529194811-fc6948e3c67c h1:IVb1OMy4jR4WrxZ+mrGtqiKAPpgQvqfykL6VsTXrMl8= +github.com/ulucinar/upbound-upjet v0.0.0-20240529194811-fc6948e3c67c/go.mod h1:3pDVtCgyBc5f2Zx4K5HEPxxhjndmOc5CHCJNpIivK/g= github.com/upbound/terraform-provider-aws v0.0.0-20240523140457-101595b8576e h1:Oq2PA7E9F52eMoc8vAqKMffek7gqymBSiXd5kiitHbE= github.com/upbound/terraform-provider-aws v0.0.0-20240523140457-101595b8576e/go.mod h1:yWeBcsPCtmEKOurig3GUxpnbQnw8AbEsHFVnakEsHUU= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= diff --git a/package/crds/opensearchserverless.aws.upbound.io_securityconfigs.yaml b/package/crds/opensearchserverless.aws.upbound.io_securityconfigs.yaml index eea308057d..f9b8e404a6 100644 --- a/package/crds/opensearchserverless.aws.upbound.io_securityconfigs.yaml +++ b/package/crds/opensearchserverless.aws.upbound.io_securityconfigs.yaml @@ -407,392 +407,3 @@ spec: storage: true subresources: status: {} - - 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: v1beta2 - schema: - openAPIV3Schema: - description: SecurityConfig is the Schema for the SecurityConfigs 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: SecurityConfigSpec defines the desired state of SecurityConfig - 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: - description: - description: Description of the security configuration. - type: string - region: - description: Region is the region you'd like your resource to - be created in. - type: string - samlOptions: - description: Configuration block for SAML options. - properties: - groupAttribute: - description: Group attribute for this SAML integration. - type: string - metadata: - description: The XML IdP metadata file generated from your - identity provider. - type: string - sessionTimeout: - description: Session timeout, in minutes. Minimum is 5 minutes - and maximum is 720 minutes (12 hours). Default is 60 minutes. - type: number - userAttribute: - description: User attribute for this SAML integration. - type: string - type: object - type: - description: Type of configuration. Must be saml. - type: string - required: - - region - - type - 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: - description: - description: Description of the security configuration. - type: string - samlOptions: - description: Configuration block for SAML options. - properties: - groupAttribute: - description: Group attribute for this SAML integration. - type: string - metadata: - description: The XML IdP metadata file generated from your - identity provider. - type: string - sessionTimeout: - description: Session timeout, in minutes. Minimum is 5 minutes - and maximum is 720 minutes (12 hours). Default is 60 minutes. - type: number - userAttribute: - description: User attribute for this SAML integration. - type: string - 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.samlOptions is a required parameter - rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies - || ''Update'' in self.managementPolicies) || has(self.forProvider.samlOptions) - || (has(self.initProvider) && has(self.initProvider.samlOptions))' - status: - description: SecurityConfigStatus defines the observed state of SecurityConfig. - properties: - atProvider: - properties: - configVersion: - description: Version of the configuration. - type: string - description: - description: Description of the security configuration. - type: string - id: - type: string - samlOptions: - description: Configuration block for SAML options. - properties: - groupAttribute: - description: Group attribute for this SAML integration. - type: string - metadata: - description: The XML IdP metadata file generated from your - identity provider. - type: string - sessionTimeout: - description: Session timeout, in minutes. Minimum is 5 minutes - and maximum is 720 minutes (12 hours). Default is 60 minutes. - type: number - userAttribute: - description: User attribute for this SAML integration. - type: string - type: object - type: - description: Type of configuration. Must be saml. - 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: false - subresources: - status: {}