From ef45a3b00bbee045a66b02163b7552409cf6932a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20T=C3=BCrken?= Date: Thu, 21 Sep 2023 15:10:51 +0300 Subject: [PATCH] Change externalname conf for EndpointAccess.redshiftserverless --- .../v1beta1/zz_endpointaccess_types.go | 11 ----------- .../v1beta1/zz_generated.deepcopy.go | 15 --------------- config/externalname.go | 5 ++++- .../redshiftserverless/endpointaccess.yaml | 1 - examples/redshiftserverless/endpointaccess.yaml | 3 +-- examples/redshiftserverless/resourcepolicy.yaml | 6 +++--- .../endpointaccess/zz_controller.go | 1 + ...erverless.aws.upbound.io_endpointaccesses.yaml | 13 ------------- 8 files changed, 9 insertions(+), 46 deletions(-) diff --git a/apis/redshiftserverless/v1beta1/zz_endpointaccess_types.go b/apis/redshiftserverless/v1beta1/zz_endpointaccess_types.go index c38805c5ab..856d20d1bf 100755 --- a/apis/redshiftserverless/v1beta1/zz_endpointaccess_types.go +++ b/apis/redshiftserverless/v1beta1/zz_endpointaccess_types.go @@ -15,9 +15,6 @@ import ( type EndpointAccessInitParameters struct { - // The name of the endpoint. - EndpointName *string `json:"endpointName,omitempty" tf:"endpoint_name,omitempty"` - // The name of the workgroup. WorkgroupName *string `json:"workgroupName,omitempty" tf:"workgroup_name,omitempty"` } @@ -30,9 +27,6 @@ type EndpointAccessObservation struct { // Amazon Resource Name (ARN) of the Redshift Serverless Endpoint Access. Arn *string `json:"arn,omitempty" tf:"arn,omitempty"` - // The name of the endpoint. - EndpointName *string `json:"endpointName,omitempty" tf:"endpoint_name,omitempty"` - // The Redshift Endpoint Access Name. ID *string `json:"id,omitempty" tf:"id,omitempty"` @@ -54,10 +48,6 @@ type EndpointAccessObservation struct { type EndpointAccessParameters struct { - // The name of the endpoint. - // +kubebuilder:validation:Optional - EndpointName *string `json:"endpointName,omitempty" tf:"endpoint_name,omitempty"` - // Region is the region you'd like your resource to be created in. // +upjet:crd:field:TFTag=- // +kubebuilder:validation:Required @@ -173,7 +163,6 @@ type EndpointAccessStatus struct { type EndpointAccess 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.endpointName) || has(self.initProvider.endpointName)",message="endpointName is a required parameter" // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.workgroupName) || has(self.initProvider.workgroupName)",message="workgroupName is a required parameter" Spec EndpointAccessSpec `json:"spec"` Status EndpointAccessStatus `json:"status,omitempty"` diff --git a/apis/redshiftserverless/v1beta1/zz_generated.deepcopy.go b/apis/redshiftserverless/v1beta1/zz_generated.deepcopy.go index 7e603ec2ed..301858c3f2 100644 --- a/apis/redshiftserverless/v1beta1/zz_generated.deepcopy.go +++ b/apis/redshiftserverless/v1beta1/zz_generated.deepcopy.go @@ -119,11 +119,6 @@ func (in *EndpointAccess) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EndpointAccessInitParameters) DeepCopyInto(out *EndpointAccessInitParameters) { *out = *in - if in.EndpointName != nil { - in, out := &in.EndpointName, &out.EndpointName - *out = new(string) - **out = **in - } if in.WorkgroupName != nil { in, out := &in.WorkgroupName, &out.WorkgroupName *out = new(string) @@ -186,11 +181,6 @@ func (in *EndpointAccessObservation) DeepCopyInto(out *EndpointAccessObservation *out = new(string) **out = **in } - if in.EndpointName != nil { - in, out := &in.EndpointName, &out.EndpointName - *out = new(string) - **out = **in - } if in.ID != nil { in, out := &in.ID, &out.ID *out = new(string) @@ -250,11 +240,6 @@ func (in *EndpointAccessObservation) DeepCopy() *EndpointAccessObservation { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EndpointAccessParameters) DeepCopyInto(out *EndpointAccessParameters) { *out = *in - if in.EndpointName != nil { - in, out := &in.EndpointName, &out.EndpointName - *out = new(string) - **out = **in - } if in.Region != nil { in, out := &in.Region, &out.Region *out = new(string) diff --git a/config/externalname.go b/config/externalname.go index 59fd10dcd7..6406c566c9 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -1162,10 +1162,13 @@ var ExternalNameConfigs = map[string]config.ExternalName{ "aws_redshift_hsm_configuration": config.ParameterAsIdentifier("hsm_configuration_identifier"), // Redshift usage limits can be imported using the id "aws_redshift_usage_limit": config.IdentifierFromProvider, + + // redshiftserverless + // // Redshift Serverless Namespaces can be imported using the namespace_name "aws_redshiftserverless_namespace": config.ParameterAsIdentifier("namespace_name"), // Redshift Serverless Endpoint Access can be imported using the endpoint_name - "aws_redshiftserverless_endpoint_access": config.IdentifierFromProvider, + "aws_redshiftserverless_endpoint_access": config.ParameterAsIdentifier("endpoint_name"), // Redshift Serverless Resource Policies can be imported using the resource_arn "aws_redshiftserverless_resource_policy": config.IdentifierFromProvider, // Redshift Serverless Snapshots can be imported using the snapshot_name diff --git a/examples-generated/redshiftserverless/endpointaccess.yaml b/examples-generated/redshiftserverless/endpointaccess.yaml index 6a5d61f1f8..440c72df05 100644 --- a/examples-generated/redshiftserverless/endpointaccess.yaml +++ b/examples-generated/redshiftserverless/endpointaccess.yaml @@ -8,6 +8,5 @@ metadata: name: example spec: forProvider: - endpointName: example region: us-west-1 workgroupName: example diff --git a/examples/redshiftserverless/endpointaccess.yaml b/examples/redshiftserverless/endpointaccess.yaml index ff7f3914df..a396034600 100644 --- a/examples/redshiftserverless/endpointaccess.yaml +++ b/examples/redshiftserverless/endpointaccess.yaml @@ -8,7 +8,6 @@ metadata: name: example spec: forProvider: - endpointName: example region: us-west-1 workgroupName: example subnetIdRefs: @@ -65,4 +64,4 @@ metadata: spec: forProvider: cidrBlock: 10.0.0.0/16 - region: us-west-1 \ No newline at end of file + region: us-west-1 diff --git a/examples/redshiftserverless/resourcepolicy.yaml b/examples/redshiftserverless/resourcepolicy.yaml index 6381f1d1f3..e29a6b430e 100644 --- a/examples/redshiftserverless/resourcepolicy.yaml +++ b/examples/redshiftserverless/resourcepolicy.yaml @@ -34,7 +34,7 @@ metadata: meta.upbound.io/example-id: redshiftserverless/v1beta1/resourcepolicy labels: testing.upbound.io/example-name: example - name: example-resourcepolicy + name: example spec: forProvider: namespaceName: example @@ -47,7 +47,7 @@ metadata: meta.upbound.io/example-id: redshiftserverless/v1beta1/resourcepolicy labels: testing.upbound.io/example-name: example - name: example-resourcepolicy + name: example spec: forProvider: region: us-west-1 @@ -59,7 +59,7 @@ metadata: meta.upbound.io/example-id: redshiftserverless/v1beta1/resourcepolicy labels: testing.upbound.io/example-name: example - name: example-resourcepolicy + name: example spec: forProvider: namespaceName: example diff --git a/internal/controller/redshiftserverless/endpointaccess/zz_controller.go b/internal/controller/redshiftserverless/endpointaccess/zz_controller.go index b517e31839..dafdae2e18 100755 --- a/internal/controller/redshiftserverless/endpointaccess/zz_controller.go +++ b/internal/controller/redshiftserverless/endpointaccess/zz_controller.go @@ -27,6 +27,7 @@ import ( func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { name := managed.ControllerName(v1beta1.EndpointAccess_GroupVersionKind.String()) var initializers managed.InitializerChain + initializers = append(initializers, managed.NewNameAsExternalName(mgr.GetClient())) 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))) diff --git a/package/crds/redshiftserverless.aws.upbound.io_endpointaccesses.yaml b/package/crds/redshiftserverless.aws.upbound.io_endpointaccesses.yaml index 9e4afe57a1..1fe35c26bf 100644 --- a/package/crds/redshiftserverless.aws.upbound.io_endpointaccesses.yaml +++ b/package/crds/redshiftserverless.aws.upbound.io_endpointaccesses.yaml @@ -67,9 +67,6 @@ spec: type: string forProvider: properties: - endpointName: - description: The name of the endpoint. - type: string region: description: Region is the region you'd like your resource to be created in. @@ -259,9 +256,6 @@ spec: creation, for example because of an external controller is managing them, like an autoscaler. properties: - endpointName: - description: The name of the endpoint. - type: string workgroupName: description: The name of the workgroup. type: string @@ -464,10 +458,6 @@ spec: - forProvider type: object x-kubernetes-validations: - - message: endpointName is a required parameter - rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies - || ''Update'' in self.managementPolicies) || has(self.forProvider.endpointName) - || has(self.initProvider.endpointName)' - message: workgroupName is a required parameter rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies || ''Update'' in self.managementPolicies) || has(self.forProvider.workgroupName) @@ -484,9 +474,6 @@ spec: description: Amazon Resource Name (ARN) of the Redshift Serverless Endpoint Access. type: string - endpointName: - description: The name of the endpoint. - type: string id: description: The Redshift Endpoint Access Name. type: string