From a6ae507f7bd431ca3a857df032a38d8c87b5dc85 Mon Sep 17 00:00:00 2001 From: Blake R <85771645+blakeromano@users.noreply.github.com> Date: Sun, 28 Jul 2024 20:04:28 -0700 Subject: [PATCH 1/5] Add Serverless Cache Resource Signed-off-by: Blake R <85771645+blakeromano@users.noreply.github.com> --- .../v1beta1/zz_generated.conversion_hubs.go | 3 + .../v1beta1/zz_generated.deepcopy.go | 902 +++++++++++++ .../v1beta1/zz_generated.managed.go | 60 + .../v1beta1/zz_generated.managedlist.go | 9 + .../v1beta1/zz_generated.resolvers.go | 127 ++ .../v1beta1/zz_serverlesscache_terraformed.go | 129 ++ .../v1beta1/zz_serverlesscache_types.go | 434 ++++++ config/elasticache/config.go | 13 + config/externalname.go | 5 + config/generated.lst | 1 + .../elasticache/v1beta1/serverlesscache.yaml | 28 + .../elasticache/v1beta1/serverlesscache.yaml | 94 ++ .../serverlesscache/zz_controller.go | 95 ++ internal/controller/zz_elasticache_setup.go | 2 + internal/controller/zz_monolith_setup.go | 2 + ...cache.aws.upbound.io_serverlesscaches.yaml | 1167 +++++++++++++++++ 16 files changed, 3071 insertions(+) create mode 100755 apis/elasticache/v1beta1/zz_serverlesscache_terraformed.go create mode 100755 apis/elasticache/v1beta1/zz_serverlesscache_types.go create mode 100644 examples-generated/elasticache/v1beta1/serverlesscache.yaml create mode 100644 examples/elasticache/v1beta1/serverlesscache.yaml create mode 100755 internal/controller/elasticache/serverlesscache/zz_controller.go create mode 100644 package/crds/elasticache.aws.upbound.io_serverlesscaches.yaml diff --git a/apis/elasticache/v1beta1/zz_generated.conversion_hubs.go b/apis/elasticache/v1beta1/zz_generated.conversion_hubs.go index f43b7f4367..1ea208100c 100755 --- a/apis/elasticache/v1beta1/zz_generated.conversion_hubs.go +++ b/apis/elasticache/v1beta1/zz_generated.conversion_hubs.go @@ -12,6 +12,9 @@ func (tr *Cluster) Hub() {} // Hub marks this type as a conversion hub. func (tr *ParameterGroup) Hub() {} +// Hub marks this type as a conversion hub. +func (tr *ServerlessCache) Hub() {} + // Hub marks this type as a conversion hub. func (tr *SubnetGroup) Hub() {} diff --git a/apis/elasticache/v1beta1/zz_generated.deepcopy.go b/apis/elasticache/v1beta1/zz_generated.deepcopy.go index 118ce1a9a2..b907ff3642 100644 --- a/apis/elasticache/v1beta1/zz_generated.deepcopy.go +++ b/apis/elasticache/v1beta1/zz_generated.deepcopy.go @@ -168,6 +168,93 @@ func (in *CacheNodesParameters) DeepCopy() *CacheNodesParameters { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CacheUsageLimitsInitParameters) DeepCopyInto(out *CacheUsageLimitsInitParameters) { + *out = *in + if in.DataStorage != nil { + in, out := &in.DataStorage, &out.DataStorage + *out = make([]DataStorageInitParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.EcpuPerSecond != nil { + in, out := &in.EcpuPerSecond, &out.EcpuPerSecond + *out = make([]EcpuPerSecondInitParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CacheUsageLimitsInitParameters. +func (in *CacheUsageLimitsInitParameters) DeepCopy() *CacheUsageLimitsInitParameters { + if in == nil { + return nil + } + out := new(CacheUsageLimitsInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CacheUsageLimitsObservation) DeepCopyInto(out *CacheUsageLimitsObservation) { + *out = *in + if in.DataStorage != nil { + in, out := &in.DataStorage, &out.DataStorage + *out = make([]DataStorageObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.EcpuPerSecond != nil { + in, out := &in.EcpuPerSecond, &out.EcpuPerSecond + *out = make([]EcpuPerSecondObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CacheUsageLimitsObservation. +func (in *CacheUsageLimitsObservation) DeepCopy() *CacheUsageLimitsObservation { + if in == nil { + return nil + } + out := new(CacheUsageLimitsObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CacheUsageLimitsParameters) DeepCopyInto(out *CacheUsageLimitsParameters) { + *out = *in + if in.DataStorage != nil { + in, out := &in.DataStorage, &out.DataStorage + *out = make([]DataStorageParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.EcpuPerSecond != nil { + in, out := &in.EcpuPerSecond, &out.EcpuPerSecond + *out = make([]EcpuPerSecondParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CacheUsageLimitsParameters. +func (in *CacheUsageLimitsParameters) DeepCopy() *CacheUsageLimitsParameters { + if in == nil { + return nil + } + out := new(CacheUsageLimitsParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Cluster) DeepCopyInto(out *Cluster) { *out = *in @@ -1032,6 +1119,226 @@ func (in *ClusterStatus) DeepCopy() *ClusterStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataStorageInitParameters) DeepCopyInto(out *DataStorageInitParameters) { + *out = *in + if in.Maximum != nil { + in, out := &in.Maximum, &out.Maximum + *out = new(float64) + **out = **in + } + if in.Minimum != nil { + in, out := &in.Minimum, &out.Minimum + *out = new(float64) + **out = **in + } + if in.Unit != nil { + in, out := &in.Unit, &out.Unit + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataStorageInitParameters. +func (in *DataStorageInitParameters) DeepCopy() *DataStorageInitParameters { + if in == nil { + return nil + } + out := new(DataStorageInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataStorageObservation) DeepCopyInto(out *DataStorageObservation) { + *out = *in + if in.Maximum != nil { + in, out := &in.Maximum, &out.Maximum + *out = new(float64) + **out = **in + } + if in.Minimum != nil { + in, out := &in.Minimum, &out.Minimum + *out = new(float64) + **out = **in + } + if in.Unit != nil { + in, out := &in.Unit, &out.Unit + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataStorageObservation. +func (in *DataStorageObservation) DeepCopy() *DataStorageObservation { + if in == nil { + return nil + } + out := new(DataStorageObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataStorageParameters) DeepCopyInto(out *DataStorageParameters) { + *out = *in + if in.Maximum != nil { + in, out := &in.Maximum, &out.Maximum + *out = new(float64) + **out = **in + } + if in.Minimum != nil { + in, out := &in.Minimum, &out.Minimum + *out = new(float64) + **out = **in + } + if in.Unit != nil { + in, out := &in.Unit, &out.Unit + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataStorageParameters. +func (in *DataStorageParameters) DeepCopy() *DataStorageParameters { + if in == nil { + return nil + } + out := new(DataStorageParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EcpuPerSecondInitParameters) DeepCopyInto(out *EcpuPerSecondInitParameters) { + *out = *in + if in.Maximum != nil { + in, out := &in.Maximum, &out.Maximum + *out = new(float64) + **out = **in + } + if in.Minimum != nil { + in, out := &in.Minimum, &out.Minimum + *out = new(float64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EcpuPerSecondInitParameters. +func (in *EcpuPerSecondInitParameters) DeepCopy() *EcpuPerSecondInitParameters { + if in == nil { + return nil + } + out := new(EcpuPerSecondInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EcpuPerSecondObservation) DeepCopyInto(out *EcpuPerSecondObservation) { + *out = *in + if in.Maximum != nil { + in, out := &in.Maximum, &out.Maximum + *out = new(float64) + **out = **in + } + if in.Minimum != nil { + in, out := &in.Minimum, &out.Minimum + *out = new(float64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EcpuPerSecondObservation. +func (in *EcpuPerSecondObservation) DeepCopy() *EcpuPerSecondObservation { + if in == nil { + return nil + } + out := new(EcpuPerSecondObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EcpuPerSecondParameters) DeepCopyInto(out *EcpuPerSecondParameters) { + *out = *in + if in.Maximum != nil { + in, out := &in.Maximum, &out.Maximum + *out = new(float64) + **out = **in + } + if in.Minimum != nil { + in, out := &in.Minimum, &out.Minimum + *out = new(float64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EcpuPerSecondParameters. +func (in *EcpuPerSecondParameters) DeepCopy() *EcpuPerSecondParameters { + if in == nil { + return nil + } + out := new(EcpuPerSecondParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointInitParameters) DeepCopyInto(out *EndpointInitParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointInitParameters. +func (in *EndpointInitParameters) DeepCopy() *EndpointInitParameters { + if in == nil { + return nil + } + out := new(EndpointInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointObservation) DeepCopyInto(out *EndpointObservation) { + *out = *in + if in.Address != nil { + in, out := &in.Address, &out.Address + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(float64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointObservation. +func (in *EndpointObservation) DeepCopy() *EndpointObservation { + if in == nil { + return nil + } + out := new(EndpointObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EndpointParameters) DeepCopyInto(out *EndpointParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointParameters. +func (in *EndpointParameters) DeepCopy() *EndpointParameters { + if in == nil { + return nil + } + out := new(EndpointParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LogDeliveryConfigurationInitParameters) DeepCopyInto(out *LogDeliveryConfigurationInitParameters) { *out = *in @@ -1496,6 +1803,61 @@ func (in *ParameterParameters) DeepCopy() *ParameterParameters { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReaderEndpointInitParameters) DeepCopyInto(out *ReaderEndpointInitParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReaderEndpointInitParameters. +func (in *ReaderEndpointInitParameters) DeepCopy() *ReaderEndpointInitParameters { + if in == nil { + return nil + } + out := new(ReaderEndpointInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReaderEndpointObservation) DeepCopyInto(out *ReaderEndpointObservation) { + *out = *in + if in.Address != nil { + in, out := &in.Address, &out.Address + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(float64) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReaderEndpointObservation. +func (in *ReaderEndpointObservation) DeepCopy() *ReaderEndpointObservation { + if in == nil { + return nil + } + out := new(ReaderEndpointObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReaderEndpointParameters) DeepCopyInto(out *ReaderEndpointParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReaderEndpointParameters. +func (in *ReaderEndpointParameters) DeepCopy() *ReaderEndpointParameters { + if in == nil { + return nil + } + out := new(ReaderEndpointParameters) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ReplicationGroup) DeepCopyInto(out *ReplicationGroup) { *out = *in @@ -2569,6 +2931,546 @@ func (in *ReplicationGroupStatus) DeepCopy() *ReplicationGroupStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerlessCache) DeepCopyInto(out *ServerlessCache) { + *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 ServerlessCache. +func (in *ServerlessCache) DeepCopy() *ServerlessCache { + if in == nil { + return nil + } + out := new(ServerlessCache) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServerlessCache) 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 *ServerlessCacheInitParameters) DeepCopyInto(out *ServerlessCacheInitParameters) { + *out = *in + if in.CacheUsageLimits != nil { + in, out := &in.CacheUsageLimits, &out.CacheUsageLimits + *out = make([]CacheUsageLimitsInitParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DailySnapshotTime != nil { + in, out := &in.DailySnapshotTime, &out.DailySnapshotTime + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Engine != nil { + in, out := &in.Engine, &out.Engine + *out = new(string) + **out = **in + } + if in.KMSKeyID != nil { + in, out := &in.KMSKeyID, &out.KMSKeyID + *out = new(string) + **out = **in + } + if in.KMSKeyIDRef != nil { + in, out := &in.KMSKeyIDRef, &out.KMSKeyIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.KMSKeyIDSelector != nil { + in, out := &in.KMSKeyIDSelector, &out.KMSKeyIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.MajorEngineVersion != nil { + in, out := &in.MajorEngineVersion, &out.MajorEngineVersion + *out = new(string) + **out = **in + } + if in.SecurityGroupIDRefs != nil { + in, out := &in.SecurityGroupIDRefs, &out.SecurityGroupIDRefs + *out = make([]v1.Reference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SecurityGroupIDSelector != nil { + in, out := &in.SecurityGroupIDSelector, &out.SecurityGroupIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.SecurityGroupIds != nil { + in, out := &in.SecurityGroupIds, &out.SecurityGroupIds + *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.SnapshotArnsToRestore != nil { + in, out := &in.SnapshotArnsToRestore, &out.SnapshotArnsToRestore + *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.SnapshotRetentionLimit != nil { + in, out := &in.SnapshotRetentionLimit, &out.SnapshotRetentionLimit + *out = new(float64) + **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 { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.UserGroupID != nil { + in, out := &in.UserGroupID, &out.UserGroupID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerlessCacheInitParameters. +func (in *ServerlessCacheInitParameters) DeepCopy() *ServerlessCacheInitParameters { + if in == nil { + return nil + } + out := new(ServerlessCacheInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerlessCacheList) DeepCopyInto(out *ServerlessCacheList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ServerlessCache, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerlessCacheList. +func (in *ServerlessCacheList) DeepCopy() *ServerlessCacheList { + if in == nil { + return nil + } + out := new(ServerlessCacheList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ServerlessCacheList) 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 *ServerlessCacheObservation) DeepCopyInto(out *ServerlessCacheObservation) { + *out = *in + if in.Arn != nil { + in, out := &in.Arn, &out.Arn + *out = new(string) + **out = **in + } + if in.CacheUsageLimits != nil { + in, out := &in.CacheUsageLimits, &out.CacheUsageLimits + *out = make([]CacheUsageLimitsObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = new(string) + **out = **in + } + if in.DailySnapshotTime != nil { + in, out := &in.DailySnapshotTime, &out.DailySnapshotTime + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + *out = make([]EndpointObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Engine != nil { + in, out := &in.Engine, &out.Engine + *out = new(string) + **out = **in + } + if in.FullEngineVersion != nil { + in, out := &in.FullEngineVersion, &out.FullEngineVersion + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.KMSKeyID != nil { + in, out := &in.KMSKeyID, &out.KMSKeyID + *out = new(string) + **out = **in + } + if in.MajorEngineVersion != nil { + in, out := &in.MajorEngineVersion, &out.MajorEngineVersion + *out = new(string) + **out = **in + } + if in.ReaderEndpoint != nil { + in, out := &in.ReaderEndpoint, &out.ReaderEndpoint + *out = make([]ReaderEndpointObservation, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SecurityGroupIds != nil { + in, out := &in.SecurityGroupIds, &out.SecurityGroupIds + *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.SnapshotArnsToRestore != nil { + in, out := &in.SnapshotArnsToRestore, &out.SnapshotArnsToRestore + *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.SnapshotRetentionLimit != nil { + in, out := &in.SnapshotRetentionLimit, &out.SnapshotRetentionLimit + *out = new(float64) + **out = **in + } + if in.Status != nil { + in, out := &in.Status, &out.Status + *out = new(string) + **out = **in + } + 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 { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + 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 { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.UserGroupID != nil { + in, out := &in.UserGroupID, &out.UserGroupID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerlessCacheObservation. +func (in *ServerlessCacheObservation) DeepCopy() *ServerlessCacheObservation { + if in == nil { + return nil + } + out := new(ServerlessCacheObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerlessCacheParameters) DeepCopyInto(out *ServerlessCacheParameters) { + *out = *in + if in.CacheUsageLimits != nil { + in, out := &in.CacheUsageLimits, &out.CacheUsageLimits + *out = make([]CacheUsageLimitsParameters, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.DailySnapshotTime != nil { + in, out := &in.DailySnapshotTime, &out.DailySnapshotTime + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Engine != nil { + in, out := &in.Engine, &out.Engine + *out = new(string) + **out = **in + } + if in.KMSKeyID != nil { + in, out := &in.KMSKeyID, &out.KMSKeyID + *out = new(string) + **out = **in + } + if in.KMSKeyIDRef != nil { + in, out := &in.KMSKeyIDRef, &out.KMSKeyIDRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.KMSKeyIDSelector != nil { + in, out := &in.KMSKeyIDSelector, &out.KMSKeyIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.MajorEngineVersion != nil { + in, out := &in.MajorEngineVersion, &out.MajorEngineVersion + *out = new(string) + **out = **in + } + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } + if in.SecurityGroupIDRefs != nil { + in, out := &in.SecurityGroupIDRefs, &out.SecurityGroupIDRefs + *out = make([]v1.Reference, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.SecurityGroupIDSelector != nil { + in, out := &in.SecurityGroupIDSelector, &out.SecurityGroupIDSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.SecurityGroupIds != nil { + in, out := &in.SecurityGroupIds, &out.SecurityGroupIds + *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.SnapshotArnsToRestore != nil { + in, out := &in.SnapshotArnsToRestore, &out.SnapshotArnsToRestore + *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.SnapshotRetentionLimit != nil { + in, out := &in.SnapshotRetentionLimit, &out.SnapshotRetentionLimit + *out = new(float64) + **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 { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.UserGroupID != nil { + in, out := &in.UserGroupID, &out.UserGroupID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerlessCacheParameters. +func (in *ServerlessCacheParameters) DeepCopy() *ServerlessCacheParameters { + if in == nil { + return nil + } + out := new(ServerlessCacheParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerlessCacheSpec) DeepCopyInto(out *ServerlessCacheSpec) { + *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 ServerlessCacheSpec. +func (in *ServerlessCacheSpec) DeepCopy() *ServerlessCacheSpec { + if in == nil { + return nil + } + out := new(ServerlessCacheSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ServerlessCacheStatus) DeepCopyInto(out *ServerlessCacheStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServerlessCacheStatus. +func (in *ServerlessCacheStatus) DeepCopy() *ServerlessCacheStatus { + if in == nil { + return nil + } + out := new(ServerlessCacheStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SubnetGroup) DeepCopyInto(out *SubnetGroup) { *out = *in diff --git a/apis/elasticache/v1beta1/zz_generated.managed.go b/apis/elasticache/v1beta1/zz_generated.managed.go index 3c159f0d41..8bc43f2a20 100644 --- a/apis/elasticache/v1beta1/zz_generated.managed.go +++ b/apis/elasticache/v1beta1/zz_generated.managed.go @@ -187,6 +187,66 @@ func (mg *ReplicationGroup) SetWriteConnectionSecretToReference(r *xpv1.SecretRe mg.Spec.WriteConnectionSecretToReference = r } +// GetCondition of this ServerlessCache. +func (mg *ServerlessCache) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this ServerlessCache. +func (mg *ServerlessCache) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this ServerlessCache. +func (mg *ServerlessCache) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this ServerlessCache. +func (mg *ServerlessCache) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetPublishConnectionDetailsTo of this ServerlessCache. +func (mg *ServerlessCache) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this ServerlessCache. +func (mg *ServerlessCache) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this ServerlessCache. +func (mg *ServerlessCache) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this ServerlessCache. +func (mg *ServerlessCache) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this ServerlessCache. +func (mg *ServerlessCache) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this ServerlessCache. +func (mg *ServerlessCache) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetPublishConnectionDetailsTo of this ServerlessCache. +func (mg *ServerlessCache) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this ServerlessCache. +func (mg *ServerlessCache) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} + // GetCondition of this SubnetGroup. func (mg *SubnetGroup) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) diff --git a/apis/elasticache/v1beta1/zz_generated.managedlist.go b/apis/elasticache/v1beta1/zz_generated.managedlist.go index 5d46632fbc..7e905f787e 100644 --- a/apis/elasticache/v1beta1/zz_generated.managedlist.go +++ b/apis/elasticache/v1beta1/zz_generated.managedlist.go @@ -34,6 +34,15 @@ func (l *ReplicationGroupList) GetItems() []resource.Managed { return items } +// GetItems of this ServerlessCacheList. +func (l *ServerlessCacheList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + // GetItems of this SubnetGroupList. func (l *SubnetGroupList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) diff --git a/apis/elasticache/v1beta1/zz_generated.resolvers.go b/apis/elasticache/v1beta1/zz_generated.resolvers.go index b39e302305..f2d27fcafd 100644 --- a/apis/elasticache/v1beta1/zz_generated.resolvers.go +++ b/apis/elasticache/v1beta1/zz_generated.resolvers.go @@ -310,6 +310,133 @@ func (mg *ReplicationGroup) ResolveReferences(ctx context.Context, c client.Read return nil } +// ResolveReferences of this ServerlessCache. +func (mg *ServerlessCache) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var mrsp reference.MultiResolutionResponse + var err error + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", "v1beta1", "Key", "KeyList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.ForProvider.KMSKeyIDRef, + Selector: mg.Spec.ForProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.KMSKeyID") + } + mg.Spec.ForProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", "v1beta1", "SecurityGroup", "SecurityGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.ForProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.ForProvider.SecurityGroupIDRefs, + Selector: mg.Spec.ForProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.SecurityGroupIds") + } + mg.Spec.ForProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) + mg.Spec.ForProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", "v1beta1", "Subnet", "SubnetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + 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: l, Managed: m}, + }) + } + 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 + { + m, l, err = apisresolver.GetManagedResource("kms.aws.upbound.io", "v1beta1", "Key", "KeyList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.KMSKeyID), + Extract: reference.ExternalName(), + Reference: mg.Spec.InitProvider.KMSKeyIDRef, + Selector: mg.Spec.InitProvider.KMSKeyIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.KMSKeyID") + } + mg.Spec.InitProvider.KMSKeyID = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.KMSKeyIDRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", "v1beta1", "SecurityGroup", "SecurityGroupList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SecurityGroupIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SecurityGroupIDRefs, + Selector: mg.Spec.InitProvider.SecurityGroupIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.SecurityGroupIds") + } + mg.Spec.InitProvider.SecurityGroupIds = reference.ToPtrValues(mrsp.ResolvedValues) + mg.Spec.InitProvider.SecurityGroupIDRefs = mrsp.ResolvedReferences + { + m, l, err = apisresolver.GetManagedResource("ec2.aws.upbound.io", "v1beta1", "Subnet", "SubnetList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + mrsp, err = r.ResolveMultiple(ctx, reference.MultiResolutionRequest{ + CurrentValues: reference.FromPtrValues(mg.Spec.InitProvider.SubnetIds), + Extract: reference.ExternalName(), + References: mg.Spec.InitProvider.SubnetIDRefs, + Selector: mg.Spec.InitProvider.SubnetIDSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.SubnetIds") + } + mg.Spec.InitProvider.SubnetIds = reference.ToPtrValues(mrsp.ResolvedValues) + mg.Spec.InitProvider.SubnetIDRefs = mrsp.ResolvedReferences + + return nil +} + // ResolveReferences of this SubnetGroup. func (mg *SubnetGroup) ResolveReferences(ctx context.Context, c client.Reader) error { var m xpresource.Managed diff --git a/apis/elasticache/v1beta1/zz_serverlesscache_terraformed.go b/apis/elasticache/v1beta1/zz_serverlesscache_terraformed.go new file mode 100755 index 0000000000..bee905d57d --- /dev/null +++ b/apis/elasticache/v1beta1/zz_serverlesscache_terraformed.go @@ -0,0 +1,129 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +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 ServerlessCache +func (mg *ServerlessCache) GetTerraformResourceType() string { + return "aws_elasticache_serverless_cache" +} + +// GetConnectionDetailsMapping for this ServerlessCache +func (tr *ServerlessCache) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ServerlessCache +func (tr *ServerlessCache) 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 ServerlessCache +func (tr *ServerlessCache) 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 ServerlessCache +func (tr *ServerlessCache) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ServerlessCache +func (tr *ServerlessCache) 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 ServerlessCache +func (tr *ServerlessCache) 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 ServerlessCache +func (tr *ServerlessCache) 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 ServerlessCache +func (tr *ServerlessCache) 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 ServerlessCache using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ServerlessCache) LateInitialize(attrs []byte) (bool, error) { + params := &ServerlessCacheParameters{} + 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 *ServerlessCache) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/elasticache/v1beta1/zz_serverlesscache_types.go b/apis/elasticache/v1beta1/zz_serverlesscache_types.go new file mode 100755 index 0000000000..c30fb7182e --- /dev/null +++ b/apis/elasticache/v1beta1/zz_serverlesscache_types.go @@ -0,0 +1,434 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// 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 CacheUsageLimitsInitParameters struct { + + // The maximum data storage limit in the cache, expressed in Gigabytes. See Data Storage config for more details. + DataStorage []DataStorageInitParameters `json:"dataStorage,omitempty" tf:"data_storage,omitempty"` + + // The configuration for the number of ElastiCache Processing Units (ECPU) the cache can consume per second.See config block for more details. + EcpuPerSecond []EcpuPerSecondInitParameters `json:"ecpuPerSecond,omitempty" tf:"ecpu_per_second,omitempty"` +} + +type CacheUsageLimitsObservation struct { + + // The maximum data storage limit in the cache, expressed in Gigabytes. See Data Storage config for more details. + DataStorage []DataStorageObservation `json:"dataStorage,omitempty" tf:"data_storage,omitempty"` + + // The configuration for the number of ElastiCache Processing Units (ECPU) the cache can consume per second.See config block for more details. + EcpuPerSecond []EcpuPerSecondObservation `json:"ecpuPerSecond,omitempty" tf:"ecpu_per_second,omitempty"` +} + +type CacheUsageLimitsParameters struct { + + // The maximum data storage limit in the cache, expressed in Gigabytes. See Data Storage config for more details. + // +kubebuilder:validation:Optional + DataStorage []DataStorageParameters `json:"dataStorage,omitempty" tf:"data_storage,omitempty"` + + // The configuration for the number of ElastiCache Processing Units (ECPU) the cache can consume per second.See config block for more details. + // +kubebuilder:validation:Optional + EcpuPerSecond []EcpuPerSecondParameters `json:"ecpuPerSecond,omitempty" tf:"ecpu_per_second,omitempty"` +} + +type DataStorageInitParameters struct { + + // The upper limit for data storage the cache is set to use. Must be between 1 and 5,000. + Maximum *float64 `json:"maximum,omitempty" tf:"maximum,omitempty"` + + // The lower limit for data storage the cache is set to use. Must be between 1 and 5,000. + Minimum *float64 `json:"minimum,omitempty" tf:"minimum,omitempty"` + + // The unit that the storage is measured in, in GB. + Unit *string `json:"unit,omitempty" tf:"unit,omitempty"` +} + +type DataStorageObservation struct { + + // The upper limit for data storage the cache is set to use. Must be between 1 and 5,000. + Maximum *float64 `json:"maximum,omitempty" tf:"maximum,omitempty"` + + // The lower limit for data storage the cache is set to use. Must be between 1 and 5,000. + Minimum *float64 `json:"minimum,omitempty" tf:"minimum,omitempty"` + + // The unit that the storage is measured in, in GB. + Unit *string `json:"unit,omitempty" tf:"unit,omitempty"` +} + +type DataStorageParameters struct { + + // The upper limit for data storage the cache is set to use. Must be between 1 and 5,000. + // +kubebuilder:validation:Optional + Maximum *float64 `json:"maximum,omitempty" tf:"maximum,omitempty"` + + // The lower limit for data storage the cache is set to use. Must be between 1 and 5,000. + // +kubebuilder:validation:Optional + Minimum *float64 `json:"minimum,omitempty" tf:"minimum,omitempty"` + + // The unit that the storage is measured in, in GB. + // +kubebuilder:validation:Optional + Unit *string `json:"unit" tf:"unit,omitempty"` +} + +type EcpuPerSecondInitParameters struct { + + // The upper limit for data storage the cache is set to use. Must be between 1 and 5,000. + Maximum *float64 `json:"maximum,omitempty" tf:"maximum,omitempty"` + + // The lower limit for data storage the cache is set to use. Must be between 1 and 5,000. + Minimum *float64 `json:"minimum,omitempty" tf:"minimum,omitempty"` +} + +type EcpuPerSecondObservation struct { + + // The upper limit for data storage the cache is set to use. Must be between 1 and 5,000. + Maximum *float64 `json:"maximum,omitempty" tf:"maximum,omitempty"` + + // The lower limit for data storage the cache is set to use. Must be between 1 and 5,000. + Minimum *float64 `json:"minimum,omitempty" tf:"minimum,omitempty"` +} + +type EcpuPerSecondParameters struct { + + // The upper limit for data storage the cache is set to use. Must be between 1 and 5,000. + // +kubebuilder:validation:Optional + Maximum *float64 `json:"maximum,omitempty" tf:"maximum,omitempty"` + + // The lower limit for data storage the cache is set to use. Must be between 1 and 5,000. + // +kubebuilder:validation:Optional + Minimum *float64 `json:"minimum,omitempty" tf:"minimum,omitempty"` +} + +type EndpointInitParameters struct { +} + +type EndpointObservation struct { + + // The DNS hostname of the cache node. + Address *string `json:"address,omitempty" tf:"address,omitempty"` + + // The port number that the cache engine is listening on. Set as integer. + Port *float64 `json:"port,omitempty" tf:"port,omitempty"` +} + +type EndpointParameters struct { +} + +type ReaderEndpointInitParameters struct { +} + +type ReaderEndpointObservation struct { + + // The DNS hostname of the cache node. + Address *string `json:"address,omitempty" tf:"address,omitempty"` + + // The port number that the cache engine is listening on. Set as integer. + Port *float64 `json:"port,omitempty" tf:"port,omitempty"` +} + +type ReaderEndpointParameters struct { +} + +type ServerlessCacheInitParameters struct { + + // Sets the cache usage limits for storage and ElastiCache Processing Units for the cache. See configuration below. + CacheUsageLimits []CacheUsageLimitsInitParameters `json:"cacheUsageLimits,omitempty" tf:"cache_usage_limits,omitempty"` + + // The daily time that snapshots will be created from the new serverless cache. Only supported for engine type "redis". Defaults to 0. + DailySnapshotTime *string `json:"dailySnapshotTime,omitempty" tf:"daily_snapshot_time,omitempty"` + + // User-provided description for the serverless cache. The default is NULL. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // – Name of the cache engine to be used for this cache cluster. Valid values are memcached or redis. + Engine *string `json:"engine,omitempty" tf:"engine,omitempty"` + + // ARN of the customer managed key for encrypting the data at rest. If no KMS key is provided, a default service key is used. + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/kms/v1beta1.Key + KMSKeyID *string `json:"kmsKeyId,omitempty" tf:"kms_key_id,omitempty"` + + // Reference to a Key in kms to populate kmsKeyId. + // +kubebuilder:validation:Optional + KMSKeyIDRef *v1.Reference `json:"kmsKeyIdRef,omitempty" tf:"-"` + + // Selector for a Key in kms to populate kmsKeyId. + // +kubebuilder:validation:Optional + KMSKeyIDSelector *v1.Selector `json:"kmsKeyIdSelector,omitempty" tf:"-"` + + // – The version of the cache engine that will be used to create the serverless cache. + // See Describe Cache Engine Versions in the AWS Documentation for supported versions. + MajorEngineVersion *string `json:"majorEngineVersion,omitempty" tf:"major_engine_version,omitempty"` + + // References to SecurityGroup in ec2 to populate securityGroupIds. + // +kubebuilder:validation:Optional + SecurityGroupIDRefs []v1.Reference `json:"securityGroupIdRefs,omitempty" tf:"-"` + + // Selector for a list of SecurityGroup in ec2 to populate securityGroupIds. + // +kubebuilder:validation:Optional + SecurityGroupIDSelector *v1.Selector `json:"securityGroupIdSelector,omitempty" tf:"-"` + + // A list of the one or more VPC security groups to be associated with the serverless cache. The security group will authorize traffic access for the VPC end-point (private-link). If no other information is given this will be the VPC’s Default Security Group that is associated with the cluster VPC end-point. + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup + // +crossplane:generate:reference:refFieldName=SecurityGroupIDRefs + // +crossplane:generate:reference:selectorFieldName=SecurityGroupIDSelector + // +listType=set + SecurityGroupIds []*string `json:"securityGroupIds,omitempty" tf:"security_group_ids,omitempty"` + + // The list of ARN(s) of the snapshot that the new serverless cache will be created from. Available for Redis only. + SnapshotArnsToRestore []*string `json:"snapshotArnsToRestore,omitempty" tf:"snapshot_arns_to_restore,omitempty"` + + // The number of snapshots that will be retained for the serverless cache that is being created. As new snapshots beyond this limit are added, the oldest snapshots will be deleted on a rolling basis. Available for Redis only. + SnapshotRetentionLimit *float64 `json:"snapshotRetentionLimit,omitempty" tf:"snapshot_retention_limit,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 identifiers of the subnets where the VPC endpoint for the serverless cache will be deployed. All the subnetIds must belong to the same VPC. + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.Subnet + // +crossplane:generate:reference:refFieldName=SubnetIDRefs + // +crossplane:generate:reference:selectorFieldName=SubnetIDSelector + // +listType=set + SubnetIds []*string `json:"subnetIds,omitempty" tf:"subnet_ids,omitempty"` + + // Key-value map of resource tags. + // +mapType=granular + Tags map[string]*string `json:"tags,omitempty" tf:"tags,omitempty"` + + // The identifier of the UserGroup to be associated with the serverless cache. Available for Redis only. Default is NULL. + UserGroupID *string `json:"userGroupId,omitempty" tf:"user_group_id,omitempty"` +} + +type ServerlessCacheObservation struct { + + // The Amazon Resource Name (ARN) of the serverless cache. + Arn *string `json:"arn,omitempty" tf:"arn,omitempty"` + + // Sets the cache usage limits for storage and ElastiCache Processing Units for the cache. See configuration below. + CacheUsageLimits []CacheUsageLimitsObservation `json:"cacheUsageLimits,omitempty" tf:"cache_usage_limits,omitempty"` + + // Timestamp of when the serverless cache was created. + CreateTime *string `json:"createTime,omitempty" tf:"create_time,omitempty"` + + // The daily time that snapshots will be created from the new serverless cache. Only supported for engine type "redis". Defaults to 0. + DailySnapshotTime *string `json:"dailySnapshotTime,omitempty" tf:"daily_snapshot_time,omitempty"` + + // User-provided description for the serverless cache. The default is NULL. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // Represents the information required for client programs to connect to a cache node. See config below for details. + Endpoint []EndpointObservation `json:"endpoint,omitempty" tf:"endpoint,omitempty"` + + // – Name of the cache engine to be used for this cache cluster. Valid values are memcached or redis. + Engine *string `json:"engine,omitempty" tf:"engine,omitempty"` + + // The name and version number of the engine the serverless cache is compatible with. + FullEngineVersion *string `json:"fullEngineVersion,omitempty" tf:"full_engine_version,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // ARN of the customer managed key for encrypting the data at rest. If no KMS key is provided, a default service key is used. + KMSKeyID *string `json:"kmsKeyId,omitempty" tf:"kms_key_id,omitempty"` + + // – The version of the cache engine that will be used to create the serverless cache. + // See Describe Cache Engine Versions in the AWS Documentation for supported versions. + MajorEngineVersion *string `json:"majorEngineVersion,omitempty" tf:"major_engine_version,omitempty"` + + // Represents the information required for client programs to connect to a cache node. See config below for details. + ReaderEndpoint []ReaderEndpointObservation `json:"readerEndpoint,omitempty" tf:"reader_endpoint,omitempty"` + + // A list of the one or more VPC security groups to be associated with the serverless cache. The security group will authorize traffic access for the VPC end-point (private-link). If no other information is given this will be the VPC’s Default Security Group that is associated with the cluster VPC end-point. + // +listType=set + SecurityGroupIds []*string `json:"securityGroupIds,omitempty" tf:"security_group_ids,omitempty"` + + // The list of ARN(s) of the snapshot that the new serverless cache will be created from. Available for Redis only. + SnapshotArnsToRestore []*string `json:"snapshotArnsToRestore,omitempty" tf:"snapshot_arns_to_restore,omitempty"` + + // The number of snapshots that will be retained for the serverless cache that is being created. As new snapshots beyond this limit are added, the oldest snapshots will be deleted on a rolling basis. Available for Redis only. + SnapshotRetentionLimit *float64 `json:"snapshotRetentionLimit,omitempty" tf:"snapshot_retention_limit,omitempty"` + + // The current status of the serverless cache. The allowed values are CREATING, AVAILABLE, DELETING, CREATE-FAILED and MODIFYING. + Status *string `json:"status,omitempty" tf:"status,omitempty"` + + // – A list of the identifiers of the subnets where the VPC endpoint for the serverless cache will be deployed. All the subnetIds must belong to the same VPC. + // +listType=set + SubnetIds []*string `json:"subnetIds,omitempty" tf:"subnet_ids,omitempty"` + + // Key-value map of resource tags. + // +mapType=granular + Tags map[string]*string `json:"tags,omitempty" tf:"tags,omitempty"` + + // +mapType=granular + TagsAll map[string]*string `json:"tagsAll,omitempty" tf:"tags_all,omitempty"` + + // The identifier of the UserGroup to be associated with the serverless cache. Available for Redis only. Default is NULL. + UserGroupID *string `json:"userGroupId,omitempty" tf:"user_group_id,omitempty"` +} + +type ServerlessCacheParameters struct { + + // Sets the cache usage limits for storage and ElastiCache Processing Units for the cache. See configuration below. + // +kubebuilder:validation:Optional + CacheUsageLimits []CacheUsageLimitsParameters `json:"cacheUsageLimits,omitempty" tf:"cache_usage_limits,omitempty"` + + // The daily time that snapshots will be created from the new serverless cache. Only supported for engine type "redis". Defaults to 0. + // +kubebuilder:validation:Optional + DailySnapshotTime *string `json:"dailySnapshotTime,omitempty" tf:"daily_snapshot_time,omitempty"` + + // User-provided description for the serverless cache. The default is NULL. + // +kubebuilder:validation:Optional + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // – Name of the cache engine to be used for this cache cluster. Valid values are memcached or redis. + // +kubebuilder:validation:Optional + Engine *string `json:"engine,omitempty" tf:"engine,omitempty"` + + // ARN of the customer managed key for encrypting the data at rest. If no KMS key is provided, a default service key is used. + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/kms/v1beta1.Key + // +kubebuilder:validation:Optional + KMSKeyID *string `json:"kmsKeyId,omitempty" tf:"kms_key_id,omitempty"` + + // Reference to a Key in kms to populate kmsKeyId. + // +kubebuilder:validation:Optional + KMSKeyIDRef *v1.Reference `json:"kmsKeyIdRef,omitempty" tf:"-"` + + // Selector for a Key in kms to populate kmsKeyId. + // +kubebuilder:validation:Optional + KMSKeyIDSelector *v1.Selector `json:"kmsKeyIdSelector,omitempty" tf:"-"` + + // – The version of the cache engine that will be used to create the serverless cache. + // See Describe Cache Engine Versions in the AWS Documentation for supported versions. + // +kubebuilder:validation:Optional + MajorEngineVersion *string `json:"majorEngineVersion,omitempty" tf:"major_engine_version,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:"-"` + + // References to SecurityGroup in ec2 to populate securityGroupIds. + // +kubebuilder:validation:Optional + SecurityGroupIDRefs []v1.Reference `json:"securityGroupIdRefs,omitempty" tf:"-"` + + // Selector for a list of SecurityGroup in ec2 to populate securityGroupIds. + // +kubebuilder:validation:Optional + SecurityGroupIDSelector *v1.Selector `json:"securityGroupIdSelector,omitempty" tf:"-"` + + // A list of the one or more VPC security groups to be associated with the serverless cache. The security group will authorize traffic access for the VPC end-point (private-link). If no other information is given this will be the VPC’s Default Security Group that is associated with the cluster VPC end-point. + // +crossplane:generate:reference:type=github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup + // +crossplane:generate:reference:refFieldName=SecurityGroupIDRefs + // +crossplane:generate:reference:selectorFieldName=SecurityGroupIDSelector + // +kubebuilder:validation:Optional + // +listType=set + SecurityGroupIds []*string `json:"securityGroupIds,omitempty" tf:"security_group_ids,omitempty"` + + // The list of ARN(s) of the snapshot that the new serverless cache will be created from. Available for Redis only. + // +kubebuilder:validation:Optional + SnapshotArnsToRestore []*string `json:"snapshotArnsToRestore,omitempty" tf:"snapshot_arns_to_restore,omitempty"` + + // The number of snapshots that will be retained for the serverless cache that is being created. As new snapshots beyond this limit are added, the oldest snapshots will be deleted on a rolling basis. Available for Redis only. + // +kubebuilder:validation:Optional + SnapshotRetentionLimit *float64 `json:"snapshotRetentionLimit,omitempty" tf:"snapshot_retention_limit,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 identifiers of the subnets where the VPC endpoint for the serverless cache will be deployed. All the subnetIds must belong to the same VPC. + // +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 + // +listType=set + SubnetIds []*string `json:"subnetIds,omitempty" tf:"subnet_ids,omitempty"` + + // Key-value map of resource tags. + // +kubebuilder:validation:Optional + // +mapType=granular + Tags map[string]*string `json:"tags,omitempty" tf:"tags,omitempty"` + + // The identifier of the UserGroup to be associated with the serverless cache. Available for Redis only. Default is NULL. + // +kubebuilder:validation:Optional + UserGroupID *string `json:"userGroupId,omitempty" tf:"user_group_id,omitempty"` +} + +// ServerlessCacheSpec defines the desired state of ServerlessCache +type ServerlessCacheSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider ServerlessCacheParameters `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 ServerlessCacheInitParameters `json:"initProvider,omitempty"` +} + +// ServerlessCacheStatus defines the observed state of ServerlessCache. +type ServerlessCacheStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider ServerlessCacheObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// ServerlessCache is the Schema for the ServerlessCaches API. Provides an ElastiCache Serverless Cache resource. +// +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 ServerlessCache 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.engine) || (has(self.initProvider) && has(self.initProvider.engine))",message="spec.forProvider.engine is a required parameter" + Spec ServerlessCacheSpec `json:"spec"` + Status ServerlessCacheStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ServerlessCacheList contains a list of ServerlessCaches +type ServerlessCacheList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ServerlessCache `json:"items"` +} + +// Repository type metadata. +var ( + ServerlessCache_Kind = "ServerlessCache" + ServerlessCache_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: ServerlessCache_Kind}.String() + ServerlessCache_KindAPIVersion = ServerlessCache_Kind + "." + CRDGroupVersion.String() + ServerlessCache_GroupVersionKind = CRDGroupVersion.WithKind(ServerlessCache_Kind) +) + +func init() { + SchemeBuilder.Register(&ServerlessCache{}, &ServerlessCacheList{}) +} diff --git a/config/elasticache/config.go b/config/elasticache/config.go index 9929179dd2..3863e1d17d 100644 --- a/config/elasticache/config.go +++ b/config/elasticache/config.go @@ -164,6 +164,19 @@ func Configure(p *config.Provider) { //nolint:gocyclo ) }) + p.AddResourceConfigurator("aws_elasticache_serverless_cache", func(r *config.Resource) { + r.UseAsync = true + r.References["kms_key_id"] = config.Reference{ + TerraformName: "aws_kms_key", + } + r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { + if diff != nil && diff.Attributes != nil { + delete(diff.Attributes, "security_group_names.#") + } + return diff, nil + } + }) + p.AddResourceConfigurator("aws_elasticache_user_group", func(r *config.Resource) { r.References["user_ids"] = config.Reference{ TerraformName: "aws_elasticache_user", diff --git a/config/externalname.go b/config/externalname.go index ac9217a68f..7ecdc549ad 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -50,6 +50,11 @@ var TerraformPluginFrameworkExternalNameConfigs = map[string]config.ExternalName // Imported by using the id: sgr-02108b27edd666983 "aws_vpc_security_group_ingress_rule": vpcSecurityGroupRule(), + // elasticache + // + // Imported by using the serverless cache name + "aws_elasticache_serverless_cache": config.NameAsIdentifier, + // eks // // PodIdentityAssociation can be imported using the association ID by passing spec.forProvider.clusterName field diff --git a/config/generated.lst b/config/generated.lst index 3c0b1e9687..a34727f267 100644 --- a/config/generated.lst +++ b/config/generated.lst @@ -376,6 +376,7 @@ "aws_elasticache_cluster", "aws_elasticache_parameter_group", "aws_elasticache_replication_group", +"aws_elasticache_serverless_cache", "aws_elasticache_subnet_group", "aws_elasticache_user", "aws_elasticache_user_group", diff --git a/examples-generated/elasticache/v1beta1/serverlesscache.yaml b/examples-generated/elasticache/v1beta1/serverlesscache.yaml new file mode 100644 index 0000000000..f7e8f8dcd0 --- /dev/null +++ b/examples-generated/elasticache/v1beta1/serverlesscache.yaml @@ -0,0 +1,28 @@ +apiVersion: elasticache.aws.upbound.io/v1beta1 +kind: ServerlessCache +metadata: + annotations: + meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + cacheUsageLimits: + - dataStorage: + - maximum: 10 + unit: GB + ecpuPerSecond: + - maximum: 5000 + description: Test Server + engine: memcached + kmsKeyIdSelector: + matchLabels: + testing.upbound.io/example-name: test + majorEngineVersion: "1.6" + region: us-west-1 + securityGroupIdRefs: + - name: test + subnetIdSelector: + matchLabels: + testing.upbound.io/example-name: test[*] diff --git a/examples/elasticache/v1beta1/serverlesscache.yaml b/examples/elasticache/v1beta1/serverlesscache.yaml new file mode 100644 index 0000000000..e9955b1e53 --- /dev/null +++ b/examples/elasticache/v1beta1/serverlesscache.yaml @@ -0,0 +1,94 @@ +apiVersion: elasticache.aws.upbound.io/v1beta1 +kind: ServerlessCache +metadata: + annotations: + meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + cacheUsageLimits: + - dataStorage: + - maximum: 10 + unit: GB + ecpuPerSecond: + - maximum: 5000 + description: Test Server + engine: memcached + majorEngineVersion: "1.6" + region: us-west-1 + securityGroupIdSelector: + matchLabels: + testing.upbound.io/example-name: example + subnetIdSelector: + matchLabels: + testing.upbound.io/example-name: example +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: SecurityGroup +metadata: + annotations: + meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache + labels: + testing.upbound.io/example-name: example + name: example +spec: + forProvider: + region: us-west-1 + vpcIdSelector: + matchLabels: + testing.upbound.io/example-name: example +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: VPC +metadata: + annotations: + meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache + labels: + testing.upbound.io/example-name: example + name: sample-vpc +spec: + forProvider: + region: us-west-1 + cidrBlock: 172.16.0.0/16 + tags: + Name: DemoVpc + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: Subnet +metadata: + annotations: + meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache + labels: + testing.upbound.io/example-name: example + name: sample-subnet1 +spec: + forProvider: + region: us-west-1 + availabilityZone: us-west-1a + vpcIdRef: + name: sample-vpc + cidrBlock: 172.16.10.0/24 + +--- + +apiVersion: ec2.aws.upbound.io/v1beta1 +kind: Subnet +metadata: + annotations: + meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache + labels: + testing.upbound.io/example-name: example + name: sample-subnet2 +spec: + forProvider: + region: us-west-1 + availabilityZone: us-west-1c + vpcIdRef: + name: sample-vpc + cidrBlock: 172.16.20.0/24 \ No newline at end of file diff --git a/internal/controller/elasticache/serverlesscache/zz_controller.go b/internal/controller/elasticache/serverlesscache/zz_controller.go new file mode 100755 index 0000000000..e4a1690f87 --- /dev/null +++ b/internal/controller/elasticache/serverlesscache/zz_controller.go @@ -0,0 +1,95 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package serverlesscache + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/handler" + "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" + ctrl "sigs.k8s.io/controller-runtime" + + v1beta1 "github.com/upbound/provider-aws/apis/elasticache/v1beta1" + features "github.com/upbound/provider-aws/internal/features" +) + +// Setup adds a controller that reconciles ServerlessCache managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1beta1.ServerlessCache_GroupVersionKind.String()) + var initializers managed.InitializerChain + for _, i := range o.Provider.Resources["aws_elasticache_serverless_cache"].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, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) + } + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.ServerlessCache_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ServerlessCache_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter( + tjcontroller.NewTerraformPluginFrameworkAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["aws_elasticache_serverless_cache"], + tjcontroller.WithTerraformPluginFrameworkAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginFrameworkAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginFrameworkAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginFrameworkAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.ServerlessCache_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginFrameworkAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } + if o.Features.Enabled(features.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + // register webhooks for the kind v1beta1.ServerlessCache + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.ServerlessCache{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.ServerlessCache") + } + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.ServerlessCacheList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.ServerlessCacheList") + } + } + + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.ServerlessCache_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + WithEventFilter(xpresource.DesiredStateChanged()). + Watches(&v1beta1.ServerlessCache{}, eventHandler). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_elasticache_setup.go b/internal/controller/zz_elasticache_setup.go index 64d9f07eaf..288f1745c1 100755 --- a/internal/controller/zz_elasticache_setup.go +++ b/internal/controller/zz_elasticache_setup.go @@ -12,6 +12,7 @@ import ( cluster "github.com/upbound/provider-aws/internal/controller/elasticache/cluster" parametergroup "github.com/upbound/provider-aws/internal/controller/elasticache/parametergroup" replicationgroup "github.com/upbound/provider-aws/internal/controller/elasticache/replicationgroup" + serverlesscache "github.com/upbound/provider-aws/internal/controller/elasticache/serverlesscache" subnetgroup "github.com/upbound/provider-aws/internal/controller/elasticache/subnetgroup" user "github.com/upbound/provider-aws/internal/controller/elasticache/user" usergroup "github.com/upbound/provider-aws/internal/controller/elasticache/usergroup" @@ -24,6 +25,7 @@ func Setup_elasticache(mgr ctrl.Manager, o controller.Options) error { cluster.Setup, parametergroup.Setup, replicationgroup.Setup, + serverlesscache.Setup, subnetgroup.Setup, user.Setup, usergroup.Setup, diff --git a/internal/controller/zz_monolith_setup.go b/internal/controller/zz_monolith_setup.go index f81323ae35..7851d0d127 100755 --- a/internal/controller/zz_monolith_setup.go +++ b/internal/controller/zz_monolith_setup.go @@ -423,6 +423,7 @@ import ( clusterelasticache "github.com/upbound/provider-aws/internal/controller/elasticache/cluster" parametergroupelasticache "github.com/upbound/provider-aws/internal/controller/elasticache/parametergroup" replicationgroup "github.com/upbound/provider-aws/internal/controller/elasticache/replicationgroup" + serverlesscache "github.com/upbound/provider-aws/internal/controller/elasticache/serverlesscache" subnetgroupelasticache "github.com/upbound/provider-aws/internal/controller/elasticache/subnetgroup" userelasticache "github.com/upbound/provider-aws/internal/controller/elasticache/user" usergroupelasticache "github.com/upbound/provider-aws/internal/controller/elasticache/usergroup" @@ -1376,6 +1377,7 @@ func Setup_monolith(mgr ctrl.Manager, o controller.Options) error { clusterelasticache.Setup, parametergroupelasticache.Setup, replicationgroup.Setup, + serverlesscache.Setup, subnetgroupelasticache.Setup, userelasticache.Setup, usergroupelasticache.Setup, diff --git a/package/crds/elasticache.aws.upbound.io_serverlesscaches.yaml b/package/crds/elasticache.aws.upbound.io_serverlesscaches.yaml new file mode 100644 index 0000000000..08ae76f0f8 --- /dev/null +++ b/package/crds/elasticache.aws.upbound.io_serverlesscaches.yaml @@ -0,0 +1,1167 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: serverlesscaches.elasticache.aws.upbound.io +spec: + group: elasticache.aws.upbound.io + names: + categories: + - crossplane + - managed + - aws + kind: ServerlessCache + listKind: ServerlessCacheList + plural: serverlesscaches + singular: serverlesscache + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: ServerlessCache is the Schema for the ServerlessCaches API. Provides + an ElastiCache Serverless Cache 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: ServerlessCacheSpec defines the desired state of ServerlessCache + 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: + cacheUsageLimits: + description: Sets the cache usage limits for storage and ElastiCache + Processing Units for the cache. See configuration below. + items: + properties: + dataStorage: + description: The maximum data storage limit in the cache, + expressed in Gigabytes. See Data Storage config for more + details. + items: + properties: + maximum: + description: The upper limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + minimum: + description: The lower limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + unit: + description: The unit that the storage is measured + in, in GB. + type: string + type: object + type: array + ecpuPerSecond: + description: The configuration for the number of ElastiCache + Processing Units (ECPU) the cache can consume per second.See + config block for more details. + items: + properties: + maximum: + description: The upper limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + minimum: + description: The lower limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + type: object + type: array + type: object + type: array + dailySnapshotTime: + description: The daily time that snapshots will be created from + the new serverless cache. Only supported for engine type "redis". + Defaults to 0. + type: string + description: + description: User-provided description for the serverless cache. + The default is NULL. + type: string + engine: + description: – Name of the cache engine to be used for this cache + cluster. Valid values are memcached or redis. + type: string + kmsKeyId: + description: ARN of the customer managed key for encrypting the + data at rest. If no KMS key is provided, a default service key + is used. + type: string + kmsKeyIdRef: + description: Reference to a Key in kms to populate kmsKeyId. + 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 + kmsKeyIdSelector: + description: Selector for a Key in kms to populate kmsKeyId. + 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 + majorEngineVersion: + description: |- + – The version of the cache engine that will be used to create the serverless cache. + See Describe Cache Engine Versions in the AWS Documentation for supported versions. + type: string + region: + description: Region is the region you'd like your resource to + be created in. + type: string + securityGroupIdRefs: + description: References to SecurityGroup in ec2 to populate securityGroupIds. + 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 + securityGroupIdSelector: + description: Selector for a list of SecurityGroup in ec2 to populate + securityGroupIds. + 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 + securityGroupIds: + description: A list of the one or more VPC security groups to + be associated with the serverless cache. The security group + will authorize traffic access for the VPC end-point (private-link). + If no other information is given this will be the VPC’s Default + Security Group that is associated with the cluster VPC end-point. + items: + type: string + type: array + x-kubernetes-list-type: set + snapshotArnsToRestore: + description: The list of ARN(s) of the snapshot that the new serverless + cache will be created from. Available for Redis only. + items: + type: string + type: array + snapshotRetentionLimit: + description: The number of snapshots that will be retained for + the serverless cache that is being created. As new snapshots + beyond this limit are added, the oldest snapshots will be deleted + on a rolling basis. Available for Redis only. + type: number + 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 identifiers of the subnets where + the VPC endpoint for the serverless cache will be deployed. + All the subnetIds must belong to the same VPC. + items: + type: string + type: array + x-kubernetes-list-type: set + tags: + additionalProperties: + type: string + description: Key-value map of resource tags. + type: object + x-kubernetes-map-type: granular + userGroupId: + description: The identifier of the UserGroup to be associated + with the serverless cache. Available for Redis only. Default + is NULL. + type: string + required: + - region + 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: + cacheUsageLimits: + description: Sets the cache usage limits for storage and ElastiCache + Processing Units for the cache. See configuration below. + items: + properties: + dataStorage: + description: The maximum data storage limit in the cache, + expressed in Gigabytes. See Data Storage config for more + details. + items: + properties: + maximum: + description: The upper limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + minimum: + description: The lower limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + unit: + description: The unit that the storage is measured + in, in GB. + type: string + type: object + type: array + ecpuPerSecond: + description: The configuration for the number of ElastiCache + Processing Units (ECPU) the cache can consume per second.See + config block for more details. + items: + properties: + maximum: + description: The upper limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + minimum: + description: The lower limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + type: object + type: array + type: object + type: array + dailySnapshotTime: + description: The daily time that snapshots will be created from + the new serverless cache. Only supported for engine type "redis". + Defaults to 0. + type: string + description: + description: User-provided description for the serverless cache. + The default is NULL. + type: string + engine: + description: – Name of the cache engine to be used for this cache + cluster. Valid values are memcached or redis. + type: string + kmsKeyId: + description: ARN of the customer managed key for encrypting the + data at rest. If no KMS key is provided, a default service key + is used. + type: string + kmsKeyIdRef: + description: Reference to a Key in kms to populate kmsKeyId. + 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 + kmsKeyIdSelector: + description: Selector for a Key in kms to populate kmsKeyId. + 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 + majorEngineVersion: + description: |- + – The version of the cache engine that will be used to create the serverless cache. + See Describe Cache Engine Versions in the AWS Documentation for supported versions. + type: string + securityGroupIdRefs: + description: References to SecurityGroup in ec2 to populate securityGroupIds. + 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 + securityGroupIdSelector: + description: Selector for a list of SecurityGroup in ec2 to populate + securityGroupIds. + 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 + securityGroupIds: + description: A list of the one or more VPC security groups to + be associated with the serverless cache. The security group + will authorize traffic access for the VPC end-point (private-link). + If no other information is given this will be the VPC’s Default + Security Group that is associated with the cluster VPC end-point. + items: + type: string + type: array + x-kubernetes-list-type: set + snapshotArnsToRestore: + description: The list of ARN(s) of the snapshot that the new serverless + cache will be created from. Available for Redis only. + items: + type: string + type: array + snapshotRetentionLimit: + description: The number of snapshots that will be retained for + the serverless cache that is being created. As new snapshots + beyond this limit are added, the oldest snapshots will be deleted + on a rolling basis. Available for Redis only. + type: number + 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 identifiers of the subnets where + the VPC endpoint for the serverless cache will be deployed. + All the subnetIds must belong to the same VPC. + items: + type: string + type: array + x-kubernetes-list-type: set + tags: + additionalProperties: + type: string + description: Key-value map of resource tags. + type: object + x-kubernetes-map-type: granular + userGroupId: + description: The identifier of the UserGroup to be associated + with the serverless cache. Available for Redis only. Default + is NULL. + type: string + 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.engine is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.engine) + || (has(self.initProvider) && has(self.initProvider.engine))' + status: + description: ServerlessCacheStatus defines the observed state of ServerlessCache. + properties: + atProvider: + properties: + arn: + description: The Amazon Resource Name (ARN) of the serverless + cache. + type: string + cacheUsageLimits: + description: Sets the cache usage limits for storage and ElastiCache + Processing Units for the cache. See configuration below. + items: + properties: + dataStorage: + description: The maximum data storage limit in the cache, + expressed in Gigabytes. See Data Storage config for more + details. + items: + properties: + maximum: + description: The upper limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + minimum: + description: The lower limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + unit: + description: The unit that the storage is measured + in, in GB. + type: string + type: object + type: array + ecpuPerSecond: + description: The configuration for the number of ElastiCache + Processing Units (ECPU) the cache can consume per second.See + config block for more details. + items: + properties: + maximum: + description: The upper limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + minimum: + description: The lower limit for data storage the + cache is set to use. Must be between 1 and 5,000. + type: number + type: object + type: array + type: object + type: array + createTime: + description: Timestamp of when the serverless cache was created. + type: string + dailySnapshotTime: + description: The daily time that snapshots will be created from + the new serverless cache. Only supported for engine type "redis". + Defaults to 0. + type: string + description: + description: User-provided description for the serverless cache. + The default is NULL. + type: string + endpoint: + description: Represents the information required for client programs + to connect to a cache node. See config below for details. + items: + properties: + address: + description: The DNS hostname of the cache node. + type: string + port: + description: The port number that the cache engine is listening + on. Set as integer. + type: number + type: object + type: array + engine: + description: – Name of the cache engine to be used for this cache + cluster. Valid values are memcached or redis. + type: string + fullEngineVersion: + description: The name and version number of the engine the serverless + cache is compatible with. + type: string + id: + type: string + kmsKeyId: + description: ARN of the customer managed key for encrypting the + data at rest. If no KMS key is provided, a default service key + is used. + type: string + majorEngineVersion: + description: |- + – The version of the cache engine that will be used to create the serverless cache. + See Describe Cache Engine Versions in the AWS Documentation for supported versions. + type: string + readerEndpoint: + description: Represents the information required for client programs + to connect to a cache node. See config below for details. + items: + properties: + address: + description: The DNS hostname of the cache node. + type: string + port: + description: The port number that the cache engine is listening + on. Set as integer. + type: number + type: object + type: array + securityGroupIds: + description: A list of the one or more VPC security groups to + be associated with the serverless cache. The security group + will authorize traffic access for the VPC end-point (private-link). + If no other information is given this will be the VPC’s Default + Security Group that is associated with the cluster VPC end-point. + items: + type: string + type: array + x-kubernetes-list-type: set + snapshotArnsToRestore: + description: The list of ARN(s) of the snapshot that the new serverless + cache will be created from. Available for Redis only. + items: + type: string + type: array + snapshotRetentionLimit: + description: The number of snapshots that will be retained for + the serverless cache that is being created. As new snapshots + beyond this limit are added, the oldest snapshots will be deleted + on a rolling basis. Available for Redis only. + type: number + status: + description: The current status of the serverless cache. The allowed + values are CREATING, AVAILABLE, DELETING, CREATE-FAILED and + MODIFYING. + type: string + subnetIds: + description: – A list of the identifiers of the subnets where + the VPC endpoint for the serverless cache will be deployed. + All the subnetIds must belong to the same VPC. + items: + type: string + type: array + x-kubernetes-list-type: set + tags: + additionalProperties: + type: string + description: Key-value map of resource tags. + type: object + x-kubernetes-map-type: granular + tagsAll: + additionalProperties: + type: string + type: object + x-kubernetes-map-type: granular + userGroupId: + description: The identifier of the UserGroup to be associated + with the serverless cache. Available for Redis only. Default + is NULL. + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time this condition transitioned from one + status to another. + format: date-time + type: string + message: + description: |- + A Message containing details about this condition's last transition from + one status to another, if any. + type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: |- + Type of this condition. At most one of each condition type may apply to + a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedGeneration: + description: |- + ObservedGeneration is the latest metadata.generation + which resulted in either a ready state, or stalled due to error + it can not recover from without human intervention. + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} From acb6a770c3e9376000da4af3ebebe601f6e39192 Mon Sep 17 00:00:00 2001 From: Blake R <85771645+blakeromano@users.noreply.github.com> Date: Sun, 28 Jul 2024 20:06:39 -0700 Subject: [PATCH 2/5] add file header Signed-off-by: Blake R <85771645+blakeromano@users.noreply.github.com> --- examples/elasticache/v1beta1/serverlesscache.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/elasticache/v1beta1/serverlesscache.yaml b/examples/elasticache/v1beta1/serverlesscache.yaml index e9955b1e53..1dfd187089 100644 --- a/examples/elasticache/v1beta1/serverlesscache.yaml +++ b/examples/elasticache/v1beta1/serverlesscache.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2024 The Crossplane Authors +# +# SPDX-License-Identifier: CC0-1.0 + apiVersion: elasticache.aws.upbound.io/v1beta1 kind: ServerlessCache metadata: From 4696592de02c23cdffd8f25227d36ce73ad6a5f1 Mon Sep 17 00:00:00 2001 From: Blake R <85771645+blakeromano@users.noreply.github.com> Date: Mon, 29 Jul 2024 08:16:00 -0700 Subject: [PATCH 3/5] update to us-west-1b Signed-off-by: Blake R <85771645+blakeromano@users.noreply.github.com> --- examples/elasticache/v1beta1/serverlesscache.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/elasticache/v1beta1/serverlesscache.yaml b/examples/elasticache/v1beta1/serverlesscache.yaml index 1dfd187089..172f3b9c1a 100644 --- a/examples/elasticache/v1beta1/serverlesscache.yaml +++ b/examples/elasticache/v1beta1/serverlesscache.yaml @@ -92,7 +92,7 @@ metadata: spec: forProvider: region: us-west-1 - availabilityZone: us-west-1c + availabilityZone: us-west-1b vpcIdRef: name: sample-vpc cidrBlock: 172.16.20.0/24 \ No newline at end of file From a87018ce94c94ae6f54cba6ae6bdd2934876c8b5 Mon Sep 17 00:00:00 2001 From: Blake R <85771645+blakeromano@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:15:24 -0700 Subject: [PATCH 4/5] update naming Signed-off-by: Blake R <85771645+blakeromano@users.noreply.github.com> --- examples/elasticache/v1beta1/serverlesscache.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/elasticache/v1beta1/serverlesscache.yaml b/examples/elasticache/v1beta1/serverlesscache.yaml index 172f3b9c1a..d06283bc02 100644 --- a/examples/elasticache/v1beta1/serverlesscache.yaml +++ b/examples/elasticache/v1beta1/serverlesscache.yaml @@ -9,7 +9,7 @@ metadata: meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache labels: testing.upbound.io/example-name: example - name: example + name: example-${Rand.RFC1123Subdomain} spec: forProvider: cacheUsageLimits: @@ -37,7 +37,7 @@ metadata: meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache labels: testing.upbound.io/example-name: example - name: example + name: example-sg-serverlesscache spec: forProvider: region: us-west-1 @@ -53,7 +53,7 @@ metadata: meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache labels: testing.upbound.io/example-name: example - name: sample-vpc + name: vpc-serverlesscache spec: forProvider: region: us-west-1 @@ -70,13 +70,13 @@ metadata: meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache labels: testing.upbound.io/example-name: example - name: sample-subnet1 + name: serverlesscache-subnet1 spec: forProvider: region: us-west-1 availabilityZone: us-west-1a vpcIdRef: - name: sample-vpc + name: vpc-serverlesscache cidrBlock: 172.16.10.0/24 --- @@ -88,11 +88,11 @@ metadata: meta.upbound.io/example-id: elasticache/v1beta1/serverlesscache labels: testing.upbound.io/example-name: example - name: sample-subnet2 + name: serverlesscache-subnet2 spec: forProvider: region: us-west-1 availabilityZone: us-west-1b vpcIdRef: - name: sample-vpc + name: vpc-serverlesscache cidrBlock: 172.16.20.0/24 \ No newline at end of file From 4d4dded8602418e220064ae0acfdacfee1fcba9a Mon Sep 17 00:00:00 2001 From: Blake R <85771645+blakeromano@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:58:41 -0700 Subject: [PATCH 5/5] remove ignorediff Signed-off-by: Blake R <85771645+blakeromano@users.noreply.github.com> --- config/elasticache/config.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/config/elasticache/config.go b/config/elasticache/config.go index 3863e1d17d..03051343eb 100644 --- a/config/elasticache/config.go +++ b/config/elasticache/config.go @@ -169,12 +169,6 @@ func Configure(p *config.Provider) { //nolint:gocyclo r.References["kms_key_id"] = config.Reference{ TerraformName: "aws_kms_key", } - r.TerraformCustomDiff = func(diff *terraform.InstanceDiff, _ *terraform.InstanceState, _ *terraform.ResourceConfig) (*terraform.InstanceDiff, error) { - if diff != nil && diff.Attributes != nil { - delete(diff.Attributes, "security_group_names.#") - } - return diff, nil - } }) p.AddResourceConfigurator("aws_elasticache_user_group", func(r *config.Resource) {