diff --git a/apis/dms/v1beta1/zz_generated.deepcopy.go b/apis/dms/v1beta1/zz_generated.deepcopy.go index 736478e16f..7ceeb936fc 100644 --- a/apis/dms/v1beta1/zz_generated.deepcopy.go +++ b/apis/dms/v1beta1/zz_generated.deepcopy.go @@ -790,6 +790,207 @@ func (in *MongodbSettingsParameters) DeepCopy() *MongodbSettingsParameters { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReplicationSubnetGroup) DeepCopyInto(out *ReplicationSubnetGroup) { + *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 ReplicationSubnetGroup. +func (in *ReplicationSubnetGroup) DeepCopy() *ReplicationSubnetGroup { + if in == nil { + return nil + } + out := new(ReplicationSubnetGroup) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReplicationSubnetGroup) 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 *ReplicationSubnetGroupList) DeepCopyInto(out *ReplicationSubnetGroupList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ReplicationSubnetGroup, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicationSubnetGroupList. +func (in *ReplicationSubnetGroupList) DeepCopy() *ReplicationSubnetGroupList { + if in == nil { + return nil + } + out := new(ReplicationSubnetGroupList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ReplicationSubnetGroupList) 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 *ReplicationSubnetGroupObservation) DeepCopyInto(out *ReplicationSubnetGroupObservation) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.ReplicationSubnetGroupArn != nil { + in, out := &in.ReplicationSubnetGroupArn, &out.ReplicationSubnetGroupArn + *out = new(string) + **out = **in + } + if in.TagsAll != nil { + in, out := &in.TagsAll, &out.TagsAll + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.VPCID != nil { + in, out := &in.VPCID, &out.VPCID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicationSubnetGroupObservation. +func (in *ReplicationSubnetGroupObservation) DeepCopy() *ReplicationSubnetGroupObservation { + if in == nil { + return nil + } + out := new(ReplicationSubnetGroupObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReplicationSubnetGroupParameters) DeepCopyInto(out *ReplicationSubnetGroupParameters) { + *out = *in + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.ReplicationSubnetGroupDescription != nil { + in, out := &in.ReplicationSubnetGroupDescription, &out.ReplicationSubnetGroupDescription + *out = new(string) + **out = **in + } + if in.SubnetIDRefs != nil { + in, out := &in.SubnetIDRefs, &out.SubnetIDRefs + *out = make([]v1.Reference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SubnetIDSelector != nil { + in, out := &in.SubnetIDSelector, &out.SubnetIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.SubnetIds != nil { + in, out := &in.SubnetIds, &out.SubnetIds + *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.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + in, out := &val, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicationSubnetGroupParameters. +func (in *ReplicationSubnetGroupParameters) DeepCopy() *ReplicationSubnetGroupParameters { + if in == nil { + return nil + } + out := new(ReplicationSubnetGroupParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReplicationSubnetGroupSpec) DeepCopyInto(out *ReplicationSubnetGroupSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicationSubnetGroupSpec. +func (in *ReplicationSubnetGroupSpec) DeepCopy() *ReplicationSubnetGroupSpec { + if in == nil { + return nil + } + out := new(ReplicationSubnetGroupSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReplicationSubnetGroupStatus) DeepCopyInto(out *ReplicationSubnetGroupStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReplicationSubnetGroupStatus. +func (in *ReplicationSubnetGroupStatus) DeepCopy() *ReplicationSubnetGroupStatus { + if in == nil { + return nil + } + out := new(ReplicationSubnetGroupStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *S3SettingsObservation) DeepCopyInto(out *S3SettingsObservation) { *out = *in diff --git a/apis/dms/v1beta1/zz_generated.managed.go b/apis/dms/v1beta1/zz_generated.managed.go index 88f49b74e8..a551d4d900 100644 --- a/apis/dms/v1beta1/zz_generated.managed.go +++ b/apis/dms/v1beta1/zz_generated.managed.go @@ -138,3 +138,69 @@ func (mg *Endpoint) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetai func (mg *Endpoint) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { mg.Spec.WriteConnectionSecretToReference = r } + +// GetCondition of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetProviderConfigReference of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this ReplicationSubnetGroup. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *ReplicationSubnetGroup) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetPublishConnectionDetailsTo of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetProviderConfigReference of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this ReplicationSubnetGroup. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *ReplicationSubnetGroup) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetPublishConnectionDetailsTo of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/dms/v1beta1/zz_generated.managedlist.go b/apis/dms/v1beta1/zz_generated.managedlist.go index 96edb45f0f..ea89a9def9 100644 --- a/apis/dms/v1beta1/zz_generated.managedlist.go +++ b/apis/dms/v1beta1/zz_generated.managedlist.go @@ -24,3 +24,12 @@ func (l *EndpointList) GetItems() []resource.Managed { } return items } + +// GetItems of this ReplicationSubnetGroupList. +func (l *ReplicationSubnetGroupList) 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/dms/v1beta1/zz_generated.resolvers.go b/apis/dms/v1beta1/zz_generated.resolvers.go index 8426b56303..9f1758b9fb 100644 --- a/apis/dms/v1beta1/zz_generated.resolvers.go +++ b/apis/dms/v1beta1/zz_generated.resolvers.go @@ -9,6 +9,7 @@ import ( "context" reference "github.com/crossplane/crossplane-runtime/pkg/reference" errors "github.com/pkg/errors" + v1beta12 "github.com/upbound/provider-aws/apis/ec2/v1beta1" v1beta11 "github.com/upbound/provider-aws/apis/iam/v1beta1" v1beta1 "github.com/upbound/provider-aws/apis/kms/v1beta1" common "github.com/upbound/provider-aws/config/common" @@ -56,3 +57,29 @@ func (mg *Endpoint) ResolveReferences(ctx context.Context, c client.Reader) erro return nil } + +// ResolveReferences of this ReplicationSubnetGroup. +func (mg *ReplicationSubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { + r := reference.NewAPIResolver(c, mg) + + var mrsp reference.MultiResolutionResponse + var err error + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SubnetIDRefs, + Selector: mg.Spec.ForProvider.SubnetIDSelector, + To: reference.To{ + List: &v1beta12.SubnetList{}, + Managed: &v1beta12.Subnet{}, + }, + }) + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.SubnetIds") + } + mg.Spec.ForProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) + mg.Spec.ForProvider.SubnetIDRefs = mrsp.ResolvedReferences + + return nil +} diff --git a/apis/dms/v1beta1/zz_generated_terraformed.go b/apis/dms/v1beta1/zz_generated_terraformed.go index 48c0cc0fec..9471aaf80c 100755 --- a/apis/dms/v1beta1/zz_generated_terraformed.go +++ b/apis/dms/v1beta1/zz_generated_terraformed.go @@ -160,3 +160,77 @@ func (tr *Endpoint) LateInitialize(attrs []byte) (bool, error) { func (tr *Endpoint) GetTerraformSchemaVersion() int { return 0 } + +// GetTerraformResourceType returns Terraform resource type for this ReplicationSubnetGroup +func (mg *ReplicationSubnetGroup) GetTerraformResourceType() string { + return "aws_dms_replication_subnet_group" +} + +// GetConnectionDetailsMapping for this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) 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 ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) 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 ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) 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 ReplicationSubnetGroup +func (tr *ReplicationSubnetGroup) 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) +} + +// LateInitialize this ReplicationSubnetGroup using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ReplicationSubnetGroup) LateInitialize(attrs []byte) (bool, error) { + params := &ReplicationSubnetGroupParameters{} + 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 *ReplicationSubnetGroup) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/dms/v1beta1/zz_replicationsubnetgroup_types.go b/apis/dms/v1beta1/zz_replicationsubnetgroup_types.go new file mode 100755 index 0000000000..112d0b6cb8 --- /dev/null +++ b/apis/dms/v1beta1/zz_replicationsubnetgroup_types.go @@ -0,0 +1,106 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +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 ReplicationSubnetGroupObservation struct { + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + ReplicationSubnetGroupArn *string `json:"replicationSubnetGroupArn,omitempty" tf:"replication_subnet_group_arn,omitempty"` + + // A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block. + TagsAll map[string]*string `json:"tagsAll,omitempty" tf:"tags_all,omitempty"` + + // The ID of the VPC the subnet group is in. + VPCID *string `json:"vpcId,omitempty" tf:"vpc_id,omitempty"` +} + +type ReplicationSubnetGroupParameters struct { + + // 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:"-"` + + // The description for the subnet group. + // +kubebuilder:validation:Required + ReplicationSubnetGroupDescription *string `json:"replicationSubnetGroupDescription" tf:"replication_subnet_group_description,omitempty"` + + // References to Subnet in ec2 to populate subnetIds. + // +kubebuilder:validation:Optional + SubnetIDRefs []v1.Reference `json:"subnetIdRefs,omitempty" tf:"-"` + + // Selector for a list of Subnet in ec2 to populate subnetIds. + // +kubebuilder:validation:Optional + SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"` + + // A list of the EC2 subnet IDs for the subnet group. + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.Subnet + // +crossplane:generate:reference:refFieldName=SubnetIDRefs + // +crossplane:generate:reference:selectorFieldName=SubnetIDSelector + // +kubebuilder:validation:Optional + SubnetIds []*string `json:"subnetIds,omitempty" tf:"subnet_ids,omitempty"` + + // Key-value map of resource tags. + // +kubebuilder:validation:Optional + Tags map[string]*string `json:"tags,omitempty" tf:"tags,omitempty"` +} + +// ReplicationSubnetGroupSpec defines the desired state of ReplicationSubnetGroup +type ReplicationSubnetGroupSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider ReplicationSubnetGroupParameters `json:"forProvider"` +} + +// ReplicationSubnetGroupStatus defines the observed state of ReplicationSubnetGroup. +type ReplicationSubnetGroupStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider ReplicationSubnetGroupObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// ReplicationSubnetGroup is the Schema for the ReplicationSubnetGroups API. Provides a DMS (Data Migration Service) subnet group resource. +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].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:subresource:status +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} +type ReplicationSubnetGroup struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ReplicationSubnetGroupSpec `json:"spec"` + Status ReplicationSubnetGroupStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ReplicationSubnetGroupList contains a list of ReplicationSubnetGroups +type ReplicationSubnetGroupList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ReplicationSubnetGroup `json:"items"` +} + +// Repository type metadata. +var ( + ReplicationSubnetGroup_Kind = "ReplicationSubnetGroup" + ReplicationSubnetGroup_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: ReplicationSubnetGroup_Kind}.String() + ReplicationSubnetGroup_KindAPIVersion = ReplicationSubnetGroup_Kind + "." + CRDGroupVersion.String() + ReplicationSubnetGroup_GroupVersionKind = CRDGroupVersion.WithKind(ReplicationSubnetGroup_Kind) +) + +func init() { + SchemeBuilder.Register(&ReplicationSubnetGroup{}, &ReplicationSubnetGroupList{}) +} diff --git a/config/externalname.go b/config/externalname.go index 23115e9ef0..cb66ae98e6 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -1669,6 +1669,8 @@ var ExternalNameConfigs = map[string]config.ExternalName{ "aws_dms_certificate": config.ParameterAsIdentifier("certificate_id"), // Endpoints can be imported using the endpoint_id "aws_dms_endpoint": config.ParameterAsIdentifier("endpoint_id"), + // Replication subnet groups can be imported using the replication_subnet_group_id + "aws_dms_replication_subnet_group": config.ParameterAsIdentifier("replication_subnet_group_id"), // ds // diff --git a/config/externalnamenottested.go b/config/externalnamenottested.go index 9c46c49e07..9521fd7708 100644 --- a/config/externalnamenottested.go +++ b/config/externalnamenottested.go @@ -146,8 +146,6 @@ var ExternalNameNotTestedConfigs = map[string]config.ExternalName{ "aws_dms_event_subscription": config.NameAsIdentifier, // Replication instances can be imported using the replication_instance_id "aws_dms_replication_instance": config.ParameterAsIdentifier("replication_instance_id"), - // Replication subnet groups can be imported using the replication_subnet_group_id - "aws_dms_replication_subnet_group": config.ParameterAsIdentifier("replication_subnet_group_id"), // Replication tasks can be imported using the replication_task_id "aws_dms_replication_task": config.ParameterAsIdentifier("replication_task_id"), diff --git a/examples-generated/dms/replicationsubnetgroup.yaml b/examples-generated/dms/replicationsubnetgroup.yaml new file mode 100644 index 0000000000..f71fe5514d --- /dev/null +++ b/examples-generated/dms/replicationsubnetgroup.yaml @@ -0,0 +1,19 @@ +apiVersion: dms.aws.upbound.io/v1beta1 +kind: ReplicationSubnetGroup +metadata: + annotations: + meta.upbound.io/example-id: dms/v1beta1/replicationsubnetgroup + labels: + testing.upbound.io/example-name: test + name: test +spec: + forProvider: + region: us-west-1 + replicationSubnetGroupDescription: Test replication subnet group + subnetIdRefs: + - name: example + tags: + Name: test + +--- + diff --git a/examples/dms/replicationsubnetgroup.yaml b/examples/dms/replicationsubnetgroup.yaml new file mode 100644 index 0000000000..6e930ec032 --- /dev/null +++ b/examples/dms/replicationsubnetgroup.yaml @@ -0,0 +1,147 @@ +apiVersion: dms.aws.upbound.io/v1beta1 +kind: ReplicationSubnetGroup +metadata: + annotations: + meta.upbound.io/example-id: dms/v1beta1/replicationsubnetgroup + labels: + testing.upbound.io/example-name: test + name: test +spec: + forProvider: + region: us-west-1 + replicationSubnetGroupDescription: Test replication subnet group + subnetIdRefs: + - name: bar + - name: foo + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: Subnet +metadata: + annotations: + meta.upbound.io/example-id: dms/v1beta1/replicationsubnetgroup + labels: + testing.upbound.io/example-name: bar + name: bar +spec: + forProvider: + availabilityZone: us-west-1b + cidrBlock: 10.0.2.0/24 + region: us-west-1 + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: test + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: Subnet +metadata: + annotations: + meta.upbound.io/example-id: dms/v1beta1/replicationsubnetgroup + labels: + testing.upbound.io/example-name: foo + name: foo +spec: + forProvider: + availabilityZone: us-west-1a + cidrBlock: 10.0.1.0/24 + region: us-west-1 + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: test + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPC +metadata: + annotations: + meta.upbound.io/example-id: dms/v1beta1/replicationsubnetgroup + labels: + testing.upbound.io/example-name: test + name: test-vpc +spec: + forProvider: + region: us-west-1 + cidrBlock: 10.0.0.0/16 + +--- + +apiVersion: iam.aws.upbound.io/v1beta1 +kind: RolePolicyAttachment +metadata: + annotations: + meta.upbound.io/example-id: dms/v1beta1/replicationsubnetgroup + labels: + testing.upbound.io/example-name: test-attach + name: test-attach +spec: + forProvider: + policyArnSelector: + matchLabels: + testing.upbound.io/example-name: policy + roleSelector: + matchLabels: + testing.upbound.io/example-name: role + +--- + +apiVersion: iam.aws.upbound.io/v1beta1 +kind: Policy +metadata: + annotations: + meta.upbound.io/example-id: dms/v1beta1/replicationsubnetgroup + labels: + testing.upbound.io/example-name: policy + name: amazondmsvpcanagementrole +spec: + forProvider: + description: Provides access to manage VPC settings for AWS managed customer configurations + policy: | + { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ec2:CreateNetworkInterface", + "ec2:DescribeAvailabilityZones", + "ec2:DescribeInternetGateways", + "ec2:DescribeSecurityGroups", + "ec2:DescribeSubnets", + "ec2:DescribeVpcs", + "ec2:DeleteNetworkInterface", + "ec2:ModifyNetworkInterfaceAttribute" + ], + "Resource": "*" + } + ] + } + +--- + +apiVersion: iam.aws.upbound.io/v1beta1 +kind: Role +metadata: + annotations: + meta.upbound.io/example-id: dms/v1beta1/replicationsubnetgroup + labels: + testing.upbound.io/example-name: role + name: dms-vpc-role +spec: + forProvider: + assumeRolePolicy: | + { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Principal": { + "Service": "dms.amazonaws.com" + }, + "Effect": "Allow" + } + ] + } \ No newline at end of file diff --git a/internal/controller/dms/replicationsubnetgroup/zz_controller.go b/internal/controller/dms/replicationsubnetgroup/zz_controller.go new file mode 100755 index 0000000000..64e8f076a5 --- /dev/null +++ b/internal/controller/dms/replicationsubnetgroup/zz_controller.go @@ -0,0 +1,55 @@ +/* +Copyright 2022 Upbound Inc. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package replicationsubnetgroup + +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" + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + ctrl "sigs.k8s.io/controller-runtime" + + v1beta1 "github.com/upbound/provider-aws/apis/dms/v1beta1" +) + +// Setup adds a controller that reconciles ReplicationSubnetGroup managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1beta1.ReplicationSubnetGroup_GroupVersionKind.String()) + var initializers managed.InitializerChain + for _, i := range o.Provider.Resources["aws_dms_replication_subnet_group"].InitializerFns { + initializers = append(initializers, i(mgr.GetClient())) + } + 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)) + } + r := managed.NewReconciler(mgr, + xpresource.ManagedKind(v1beta1.ReplicationSubnetGroup_GroupVersionKind), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["aws_dms_replication_subnet_group"], + tjcontroller.WithCallbackProvider(tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ReplicationSubnetGroup_GroupVersionKind))), + )), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3*time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + ) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + For(&v1beta1.ReplicationSubnetGroup{}). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index bac028809e..56dc7f8fd5 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -245,6 +245,7 @@ import ( lifecyclepolicy "github.com/upbound/provider-aws/internal/controller/dlm/lifecyclepolicy" certificatedms "github.com/upbound/provider-aws/internal/controller/dms/certificate" endpoint "github.com/upbound/provider-aws/internal/controller/dms/endpoint" + replicationsubnetgroup "github.com/upbound/provider-aws/internal/controller/dms/replicationsubnetgroup" clusterdocdb "github.com/upbound/provider-aws/internal/controller/docdb/cluster" clusterinstance "github.com/upbound/provider-aws/internal/controller/docdb/clusterinstance" clusterparametergroup "github.com/upbound/provider-aws/internal/controller/docdb/clusterparametergroup" @@ -849,6 +850,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { lifecyclepolicy.Setup, certificatedms.Setup, endpoint.Setup, + replicationsubnetgroup.Setup, clusterdocdb.Setup, clusterinstance.Setup, clusterparametergroup.Setup, diff --git a/package/crds/dms.aws.upbound.io_replicationsubnetgroups.yaml b/package/crds/dms.aws.upbound.io_replicationsubnetgroups.yaml new file mode 100644 index 0000000000..0fd7ff5197 --- /dev/null +++ b/package/crds/dms.aws.upbound.io_replicationsubnetgroups.yaml @@ -0,0 +1,403 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.8.0 + creationTimestamp: null + name: replicationsubnetgroups.dms.aws.upbound.io +spec: + group: dms.aws.upbound.io + names: + categories: + - crossplane + - managed + - aws + kind: ReplicationSubnetGroup + listKind: ReplicationSubnetGroupList + plural: replicationsubnetgroups + singular: replicationsubnetgroup + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: ReplicationSubnetGroup is the Schema for the ReplicationSubnetGroups + API. Provides a DMS (Data Migration Service) subnet group resource. + 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: ReplicationSubnetGroupSpec defines the desired state of ReplicationSubnetGroup + 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. + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + region: + description: Region is the region you'd like your resource to + be created in. + type: string + replicationSubnetGroupDescription: + description: The description for the subnet group. + type: string + subnetIdRefs: + description: References to Subnet in ec2 to populate subnetIds. + items: + description: A Reference to a named object. + 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 + type: array + subnetIdSelector: + description: Selector for a list of Subnet in ec2 to populate + subnetIds. + 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 + subnetIds: + description: A list of the EC2 subnet IDs for the subnet group. + items: + type: string + type: array + tags: + additionalProperties: + type: string + description: Key-value map of resource tags. + type: object + required: + - region + - replicationSubnetGroupDescription + type: object + 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 + providerRef: + description: 'ProviderReference specifies the provider that will be + used to create, observe, update, and delete this managed resource. + Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`' + 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 + status: + description: ReplicationSubnetGroupStatus defines the observed state of + ReplicationSubnetGroup. + properties: + atProvider: + properties: + id: + type: string + replicationSubnetGroupArn: + type: string + tagsAll: + additionalProperties: + type: string + description: A map of tags assigned to the resource, including + those inherited from the provider default_tags configuration + block. + type: object + vpcId: + description: The ID of the VPC the subnet group is 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 + 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 + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: []