diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 135bc79..e90fce6 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2025-01-23T02:31:35Z" - build_hash: 2442aa071c05fcdf54841e63abd5f91d1951e152 - go_version: go1.23.5 - version: v0.41.0 -api_directory_checksum: 2be594918c4fa03c742bb5d656f8b097cbc7f4c5 + build_date: "2025-02-05T19:02:26Z" + build_hash: 3d74f13b9de7134b4c76ab7526a9c578c4857602 + go_version: go1.23.4 + version: v0.41.0-18-g3d74f13 +api_directory_checksum: 91842c987138f7cc6a3329814205d0ec285d0206 api_version: v1alpha1 -aws_sdk_go_version: v1.44.93 +aws_sdk_go_version: v1.32.6 generator_config_info: - file_checksum: a9c6bd3aab21b2e46fc2de93b53534f15bfdf2bb + file_checksum: 7d89869149ba948467065fc8d5947d9eff039b8b original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/broker.go b/apis/v1alpha1/broker.go index 005b04e..5acef18 100644 --- a/apis/v1alpha1/broker.go +++ b/apis/v1alpha1/broker.go @@ -22,33 +22,97 @@ import ( // BrokerSpec defines the desired state of Broker. type BrokerSpec struct { + + // Optional. The authentication strategy used to secure the broker. The default + // is SIMPLE. AuthenticationStrategy *string `json:"authenticationStrategy,omitempty"` + // Enables automatic upgrades to new patch versions for brokers as new versions + // are released and supported by Amazon MQ. Automatic upgrades occur during + // the scheduled maintenance window or after a manual broker reboot. Set to + // true by default, if no value is specified. + // + // Must be set to true for ActiveMQ brokers version 5.18 and above and for RabbitMQ + // brokers version 3.13 and above. + AutoMinorVersionUpgrade *bool `json:"autoMinorVersionUpgrade,omitempty"` + // A list of information about the configuration. + Configuration *ConfigurationID `json:"configuration,omitempty"` + // The unique ID that the requester receives for the created broker. Amazon + // MQ passes your ID with the API action. + // + // We recommend using a Universally Unique Identifier (UUID) for the creatorRequestId. + // You may omit the creatorRequestId if your application doesn't require idempotency. + CreatorRequestID *string `json:"creatorRequestID,omitempty"` + // Required. The broker's deployment mode. // +kubebuilder:validation:Required - AutoMinorVersionUpgrade *bool `json:"autoMinorVersionUpgrade"` - Configuration *ConfigurationID `json:"configuration,omitempty"` - CreatorRequestID *string `json:"creatorRequestID,omitempty"` - // +kubebuilder:validation:Required - DeploymentMode *string `json:"deploymentMode"` + DeploymentMode *string `json:"deploymentMode"` + // Encryption options for the broker. EncryptionOptions *EncryptionOptions `json:"encryptionOptions,omitempty"` + // Required. The type of broker engine. Currently, Amazon MQ supports ACTIVEMQ + // and RABBITMQ. // +kubebuilder:validation:Required EngineType *string `json:"engineType"` + // The broker engine version. Defaults to the latest available version for the + // specified broker engine type. For more information, see the ActiveMQ version + // management (https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/activemq-version-management.html) + // and the RabbitMQ version management (https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/rabbitmq-version-management.html) + // sections in the Amazon MQ Developer Guide. + EngineVersion *string `json:"engineVersion,omitempty"` + // Required. The broker's instance type. // +kubebuilder:validation:Required - EngineVersion *string `json:"engineVersion"` - // +kubebuilder:validation:Required - HostInstanceType *string `json:"hostInstanceType"` - LDAPServerMetadata *LDAPServerMetadataInput `json:"ldapServerMetadata,omitempty"` - Logs *Logs `json:"logs,omitempty"` - MaintenanceWindowStartTime *WeeklyStartTime `json:"maintenanceWindowStartTime,omitempty"` + HostInstanceType *string `json:"hostInstanceType"` + // Optional. The metadata of the LDAP server used to authenticate and authorize + // connections to the broker. Does not apply to RabbitMQ brokers. + LDAPServerMetadata *LDAPServerMetadataInput `json:"ldapServerMetadata,omitempty"` + // Enables Amazon CloudWatch logging for brokers. + Logs *Logs `json:"logs,omitempty"` + // The parameters that determine the WeeklyStartTime. + MaintenanceWindowStartTime *WeeklyStartTime `json:"maintenanceWindowStartTime,omitempty"` + // Required. The broker's name. This value must be unique in your Amazon Web + // Services account, 1-50 characters long, must contain only letters, numbers, + // dashes, and underscores, and must not contain white spaces, brackets, wildcard + // characters, or special characters. + // + // Do not add personally identifiable information (PII) or other confidential + // or sensitive information in broker names. Broker names are accessible to + // other Amazon Web Services services, including CloudWatch Logs. Broker names + // are not intended to be used for private or sensitive data. // +kubebuilder:validation:Required Name *string `json:"name"` + // Enables connections from applications outside of the VPC that hosts the broker's + // subnets. Set to false by default, if no value is provided. // +kubebuilder:validation:Required PubliclyAccessible *bool `json:"publiclyAccessible"` SecurityGroupRefs []*ackv1alpha1.AWSResourceReferenceWrapper `json:"securityGroupRefs,omitempty"` - SecurityGroups []*string `json:"securityGroups,omitempty"` - StorageType *string `json:"storageType,omitempty"` - SubnetIDs []*string `json:"subnetIDs,omitempty"` - SubnetRefs []*ackv1alpha1.AWSResourceReferenceWrapper `json:"subnetRefs,omitempty"` - Tags map[string]*string `json:"tags,omitempty"` + // The list of rules (1 minimum, 125 maximum) that authorize connections to + // brokers. + SecurityGroups []*string `json:"securityGroups,omitempty"` + // The broker's storage type. + StorageType *string `json:"storageType,omitempty"` + // The list of groups that define which subnets and IP ranges the broker can + // use from different Availability Zones. If you specify more than one subnet, + // the subnets must be in different Availability Zones. Amazon MQ will not be + // able to create VPC endpoints for your broker with multiple subnets in the + // same Availability Zone. A SINGLE_INSTANCE deployment requires one subnet + // (for example, the default subnet). An ACTIVE_STANDBY_MULTI_AZ Amazon MQ for + // ActiveMQ deployment requires two subnets. A CLUSTER_MULTI_AZ Amazon MQ for + // RabbitMQ deployment has no subnet requirements when deployed with public + // accessibility. Deployment without public accessibility requires at least + // one subnet. + // + // If you specify subnets in a shared VPC (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html) + // for a RabbitMQ broker, the associated VPC to which the specified subnets + // belong must be owned by your Amazon Web Services account. Amazon MQ will + // not be able to create VPC endpoints in VPCs that are not owned by your Amazon + // Web Services account. + SubnetIDs []*string `json:"subnetIDs,omitempty"` + SubnetRefs []*ackv1alpha1.AWSResourceReferenceWrapper `json:"subnetRefs,omitempty"` + // Create tags when creating the broker. + Tags map[string]*string `json:"tags,omitempty"` + // The list of broker users (persons or applications) who can access queues + // and topics. For Amazon MQ for RabbitMQ brokers, one and only one administrative + // user is accepted and created when a broker is first provisioned. All subsequent + // broker users are created by making RabbitMQ API calls directly to brokers + // or via the RabbitMQ web console. // +kubebuilder:validation:Required Users []*User `json:"users"` } @@ -66,10 +130,13 @@ type BrokerStatus struct { // resource // +kubebuilder:validation:Optional Conditions []*ackv1alpha1.Condition `json:"conditions"` + // The unique ID that Amazon MQ generates for the broker. // +kubebuilder:validation:Optional BrokerID *string `json:"brokerID,omitempty"` + // A list of information about allocated brokers. // +kubebuilder:validation:Optional BrokerInstances []*BrokerInstance `json:"brokerInstances,omitempty"` + // The broker's status. // +kubebuilder:validation:Optional BrokerState *string `json:"brokerState,omitempty"` } diff --git a/apis/v1alpha1/enums.go b/apis/v1alpha1/enums.go index aa1c9cd..69c24a7 100644 --- a/apis/v1alpha1/enums.go +++ b/apis/v1alpha1/enums.go @@ -18,19 +18,20 @@ package v1alpha1 type AuthenticationStrategy string const ( - AuthenticationStrategy_SIMPLE AuthenticationStrategy = "SIMPLE" AuthenticationStrategy_LDAP AuthenticationStrategy = "LDAP" + AuthenticationStrategy_SIMPLE AuthenticationStrategy = "SIMPLE" ) type BrokerState string const ( - BrokerState_CREATION_IN_PROGRESS BrokerState = "CREATION_IN_PROGRESS" BrokerState_CREATION_FAILED BrokerState = "CREATION_FAILED" + BrokerState_CREATION_IN_PROGRESS BrokerState = "CREATION_IN_PROGRESS" + BrokerState_CRITICAL_ACTION_REQUIRED BrokerState = "CRITICAL_ACTION_REQUIRED" BrokerState_DELETION_IN_PROGRESS BrokerState = "DELETION_IN_PROGRESS" - BrokerState_RUNNING BrokerState = "RUNNING" BrokerState_REBOOT_IN_PROGRESS BrokerState = "REBOOT_IN_PROGRESS" - BrokerState_CRITICAL_ACTION_REQUIRED BrokerState = "CRITICAL_ACTION_REQUIRED" + BrokerState_REPLICA BrokerState = "REPLICA" + BrokerState_RUNNING BrokerState = "RUNNING" ) type BrokerStorageType string @@ -44,28 +45,35 @@ type ChangeType string const ( ChangeType_CREATE ChangeType = "CREATE" - ChangeType_UPDATE ChangeType = "UPDATE" ChangeType_DELETE ChangeType = "DELETE" + ChangeType_UPDATE ChangeType = "UPDATE" +) + +type DataReplicationMode string + +const ( + DataReplicationMode_CRDR DataReplicationMode = "CRDR" + DataReplicationMode_NONE DataReplicationMode = "NONE" ) type DayOfWeek string const ( - DayOfWeek_MONDAY DayOfWeek = "MONDAY" - DayOfWeek_TUESDAY DayOfWeek = "TUESDAY" - DayOfWeek_WEDNESDAY DayOfWeek = "WEDNESDAY" - DayOfWeek_THURSDAY DayOfWeek = "THURSDAY" DayOfWeek_FRIDAY DayOfWeek = "FRIDAY" + DayOfWeek_MONDAY DayOfWeek = "MONDAY" DayOfWeek_SATURDAY DayOfWeek = "SATURDAY" DayOfWeek_SUNDAY DayOfWeek = "SUNDAY" + DayOfWeek_THURSDAY DayOfWeek = "THURSDAY" + DayOfWeek_TUESDAY DayOfWeek = "TUESDAY" + DayOfWeek_WEDNESDAY DayOfWeek = "WEDNESDAY" ) type DeploymentMode string const ( - DeploymentMode_SINGLE_INSTANCE DeploymentMode = "SINGLE_INSTANCE" DeploymentMode_ACTIVE_STANDBY_MULTI_AZ DeploymentMode = "ACTIVE_STANDBY_MULTI_AZ" DeploymentMode_CLUSTER_MULTI_AZ DeploymentMode = "CLUSTER_MULTI_AZ" + DeploymentMode_SINGLE_INSTANCE DeploymentMode = "SINGLE_INSTANCE" ) type EngineType string @@ -75,10 +83,17 @@ const ( EngineType_RABBITMQ EngineType = "RABBITMQ" ) +type PromoteMode string + +const ( + PromoteMode_FAILOVER PromoteMode = "FAILOVER" + PromoteMode_SWITCHOVER PromoteMode = "SWITCHOVER" +) + type SanitizationWarningReason string const ( - SanitizationWarningReason_DISALLOWED_ELEMENT_REMOVED SanitizationWarningReason = "DISALLOWED_ELEMENT_REMOVED" SanitizationWarningReason_DISALLOWED_ATTRIBUTE_REMOVED SanitizationWarningReason = "DISALLOWED_ATTRIBUTE_REMOVED" + SanitizationWarningReason_DISALLOWED_ELEMENT_REMOVED SanitizationWarningReason = "DISALLOWED_ELEMENT_REMOVED" SanitizationWarningReason_INVALID_ATTRIBUTE_VALUE_REMOVED SanitizationWarningReason = "INVALID_ATTRIBUTE_VALUE_REMOVED" ) diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index e4b5250..ac1e03d 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -2,6 +2,10 @@ ignore: resource_names: - Configuration - User + field_paths: + - CreateBrokerInput.DataReplicationPrimaryBrokerArn + - CreateBrokerInput.DataReplicationMode + - User.ReplicationUser resources: Broker: hooks: diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index f50ce5a..559f8d4 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -28,8 +28,7 @@ var ( _ = ackv1alpha1.AWSAccountID("") ) -// The action required to resolve a broker issue when the broker is in a CRITICAL_ACTION_REQUIRED -// state. +// Action required for a broker. type ActionRequired struct { ActionRequiredCode *string `json:"actionRequiredCode,omitempty"` ActionRequiredInfo *string `json:"actionRequiredInfo,omitempty"` @@ -97,8 +96,6 @@ type Configuration struct { } // A list of information about the configuration. -// -// Does not apply to RabbitMQ brokers. type ConfigurationID struct { ID *string `json:"id,omitempty"` Revision *int64 `json:"revision,omitempty"` @@ -114,18 +111,26 @@ type ConfigurationRevision struct { // Broker configuration information type Configurations struct { // A list of information about the configuration. - // - // Does not apply to RabbitMQ brokers. Current *ConfigurationID `json:"current,omitempty"` History []*ConfigurationID `json:"history,omitempty"` // A list of information about the configuration. - // - // Does not apply to RabbitMQ brokers. Pending *ConfigurationID `json:"pending,omitempty"` } -// Does not apply to RabbitMQ brokers. -// +// Specifies a broker in a data replication pair. +type DataReplicationCounterpart struct { + BrokerID *string `json:"brokerID,omitempty"` + Region *string `json:"region,omitempty"` +} + +// The replication details of the data replication-enabled broker. Only returned +// if dataReplicationMode or pendingDataReplicationMode is set to CRDR. +type DataReplicationMetadataOutput struct { + // Specifies a broker in a data replication pair. + DataReplicationCounterpart *DataReplicationCounterpart `json:"dataReplicationCounterpart,omitempty"` + DataReplicationRole *string `json:"dataReplicationRole,omitempty"` +} + // Encryption options for the broker. type EncryptionOptions struct { KMSKeyID *string `json:"kmsKeyID,omitempty"` @@ -193,17 +198,17 @@ type PendingLogs struct { General *bool `json:"general,omitempty"` } -// Returns information about the XML element or attribute that was sanitized -// in the configuration. +// Returns information about the configuration element or attribute that was +// sanitized in the configuration. type SanitizationWarning struct { AttributeName *string `json:"attributeName,omitempty"` ElementName *string `json:"elementName,omitempty"` } -// A user associated with the broker. For RabbitMQ brokers, one and only one -// administrative user is accepted and created when a broker is first provisioned. -// All subsequent broker users are created by making RabbitMQ API calls directly -// to brokers or via the RabbitMQ web console. +// A user associated with the broker. For Amazon MQ for RabbitMQ brokers, one +// and only one administrative user is accepted and created when a broker is +// first provisioned. All subsequent broker users are created by making RabbitMQ +// API calls directly to brokers or via the RabbitMQ web console. type User struct { ConsoleAccess *bool `json:"consoleAccess,omitempty"` Groups []*string `json:"groups,omitempty"` diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 52839d2..4baae03 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -652,6 +652,56 @@ func (in *Configurations) DeepCopy() *Configurations { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataReplicationCounterpart) DeepCopyInto(out *DataReplicationCounterpart) { + *out = *in + if in.BrokerID != nil { + in, out := &in.BrokerID, &out.BrokerID + *out = new(string) + **out = **in + } + if in.Region != nil { + in, out := &in.Region, &out.Region + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataReplicationCounterpart. +func (in *DataReplicationCounterpart) DeepCopy() *DataReplicationCounterpart { + if in == nil { + return nil + } + out := new(DataReplicationCounterpart) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DataReplicationMetadataOutput) DeepCopyInto(out *DataReplicationMetadataOutput) { + *out = *in + if in.DataReplicationCounterpart != nil { + in, out := &in.DataReplicationCounterpart, &out.DataReplicationCounterpart + *out = new(DataReplicationCounterpart) + (*in).DeepCopyInto(*out) + } + if in.DataReplicationRole != nil { + in, out := &in.DataReplicationRole, &out.DataReplicationRole + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DataReplicationMetadataOutput. +func (in *DataReplicationMetadataOutput) DeepCopy() *DataReplicationMetadataOutput { + if in == nil { + return nil + } + out := new(DataReplicationMetadataOutput) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *EncryptionOptions) DeepCopyInto(out *EncryptionOptions) { *out = *in diff --git a/cmd/controller/main.go b/cmd/controller/main.go index bb95693..823802f 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -16,6 +16,7 @@ package main import ( + "context" "os" ec2apitypes "github.com/aws-controllers-k8s/ec2-controller/apis/v1alpha1" @@ -38,7 +39,6 @@ import ( svctypes "github.com/aws-controllers-k8s/mq-controller/apis/v1alpha1" svcresource "github.com/aws-controllers-k8s/mq-controller/pkg/resource" - svcsdk "github.com/aws/aws-sdk-go/service/mq" _ "github.com/aws-controllers-k8s/mq-controller/pkg/resource/broker" @@ -46,11 +46,10 @@ import ( ) var ( - awsServiceAPIGroup = "mq.services.k8s.aws" - awsServiceAlias = "mq" - awsServiceEndpointsID = svcsdk.EndpointsID - scheme = runtime.NewScheme() - setupLog = ctrlrt.Log.WithName("setup") + awsServiceAPIGroup = "mq.services.k8s.aws" + awsServiceAlias = "mq" + scheme = runtime.NewScheme() + setupLog = ctrlrt.Log.WithName("setup") ) func init() { @@ -73,7 +72,8 @@ func main() { resourceGVKs = append(resourceGVKs, mf.ResourceDescriptor().GroupVersionKind()) } - if err := ackCfg.Validate(ackcfg.WithGVKs(resourceGVKs)); err != nil { + ctx := context.Background() + if err := ackCfg.Validate(ctx, ackcfg.WithGVKs(resourceGVKs)); err != nil { setupLog.Error( err, "Unable to create controller manager", "aws.service", awsServiceAlias, @@ -138,7 +138,7 @@ func main() { "aws.service", awsServiceAlias, ) sc := ackrt.NewServiceController( - awsServiceAlias, awsServiceAPIGroup, awsServiceEndpointsID, + awsServiceAlias, awsServiceAPIGroup, acktypes.VersionInfo{ version.GitCommit, version.GitVersion, diff --git a/config/crd/bases/mq.services.k8s.aws_brokers.yaml b/config/crd/bases/mq.services.k8s.aws_brokers.yaml index 106752f..23946b6 100644 --- a/config/crd/bases/mq.services.k8s.aws_brokers.yaml +++ b/config/crd/bases/mq.services.k8s.aws_brokers.yaml @@ -40,14 +40,22 @@ spec: description: BrokerSpec defines the desired state of Broker. properties: authenticationStrategy: + description: |- + Optional. The authentication strategy used to secure the broker. The default + is SIMPLE. type: string autoMinorVersionUpgrade: - type: boolean - configuration: description: |- - A list of information about the configuration. + Enables automatic upgrades to new patch versions for brokers as new versions + are released and supported by Amazon MQ. Automatic upgrades occur during + the scheduled maintenance window or after a manual broker reboot. Set to + true by default, if no value is specified. - Does not apply to RabbitMQ brokers. + Must be set to true for ActiveMQ brokers version 5.18 and above and for RabbitMQ + brokers version 3.13 and above. + type: boolean + configuration: + description: A list of information about the configuration. properties: id: type: string @@ -56,14 +64,18 @@ spec: type: integer type: object creatorRequestID: + description: |- + The unique ID that the requester receives for the created broker. Amazon + MQ passes your ID with the API action. + + We recommend using a Universally Unique Identifier (UUID) for the creatorRequestId. + You may omit the creatorRequestId if your application doesn't require idempotency. type: string deploymentMode: + description: Required. The broker's deployment mode. type: string encryptionOptions: - description: |- - Does not apply to RabbitMQ brokers. - - Encryption options for the broker. + description: Encryption options for the broker. properties: kmsKeyID: type: string @@ -71,17 +83,25 @@ spec: type: boolean type: object engineType: + description: |- + Required. The type of broker engine. Currently, Amazon MQ supports ACTIVEMQ + and RABBITMQ. type: string engineVersion: + description: |- + The broker engine version. Defaults to the latest available version for the + specified broker engine type. For more information, see the ActiveMQ version + management (https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/activemq-version-management.html) + and the RabbitMQ version management (https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/rabbitmq-version-management.html) + sections in the Amazon MQ Developer Guide. type: string hostInstanceType: + description: Required. The broker's instance type. type: string ldapServerMetadata: description: |- Optional. The metadata of the LDAP server used to authenticate and authorize - connections to the broker. - - Does not apply to RabbitMQ brokers. + connections to the broker. Does not apply to RabbitMQ brokers. properties: hosts: items: @@ -109,8 +129,7 @@ spec: type: boolean type: object logs: - description: The list of information about logs to be enabled for - the specified broker. + description: Enables Amazon CloudWatch logging for brokers. properties: audit: type: boolean @@ -118,9 +137,7 @@ spec: type: boolean type: object maintenanceWindowStartTime: - description: |- - The scheduled time period relative to UTC during which Amazon MQ begins to - apply pending updates or patches to the broker. + description: The parameters that determine the WeeklyStartTime. properties: dayOfWeek: type: string @@ -130,8 +147,21 @@ spec: type: string type: object name: + description: |- + Required. The broker's name. This value must be unique in your Amazon Web + Services account, 1-50 characters long, must contain only letters, numbers, + dashes, and underscores, and must not contain white spaces, brackets, wildcard + characters, or special characters. + + Do not add personally identifiable information (PII) or other confidential + or sensitive information in broker names. Broker names are accessible to + other Amazon Web Services services, including CloudWatch Logs. Broker names + are not intended to be used for private or sensitive data. type: string publiclyAccessible: + description: |- + Enables connections from applications outside of the VPC that hosts the broker's + subnets. Set to false by default, if no value is provided. type: boolean securityGroupRefs: items: @@ -153,12 +183,33 @@ spec: type: object type: array securityGroups: + description: |- + The list of rules (1 minimum, 125 maximum) that authorize connections to + brokers. items: type: string type: array storageType: + description: The broker's storage type. type: string subnetIDs: + description: |- + The list of groups that define which subnets and IP ranges the broker can + use from different Availability Zones. If you specify more than one subnet, + the subnets must be in different Availability Zones. Amazon MQ will not be + able to create VPC endpoints for your broker with multiple subnets in the + same Availability Zone. A SINGLE_INSTANCE deployment requires one subnet + (for example, the default subnet). An ACTIVE_STANDBY_MULTI_AZ Amazon MQ for + ActiveMQ deployment requires two subnets. A CLUSTER_MULTI_AZ Amazon MQ for + RabbitMQ deployment has no subnet requirements when deployed with public + accessibility. Deployment without public accessibility requires at least + one subnet. + + If you specify subnets in a shared VPC (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html) + for a RabbitMQ broker, the associated VPC to which the specified subnets + belong must be owned by your Amazon Web Services account. Amazon MQ will + not be able to create VPC endpoints in VPCs that are not owned by your Amazon + Web Services account. items: type: string type: array @@ -184,14 +235,21 @@ spec: tags: additionalProperties: type: string + description: Create tags when creating the broker. type: object users: + description: |- + The list of broker users (persons or applications) who can access queues + and topics. For Amazon MQ for RabbitMQ brokers, one and only one administrative + user is accepted and created when a broker is first provisioned. All subsequent + broker users are created by making RabbitMQ API calls directly to brokers + or via the RabbitMQ web console. items: description: |- - A user associated with the broker. For RabbitMQ brokers, one and only one - administrative user is accepted and created when a broker is first provisioned. - All subsequent broker users are created by making RabbitMQ API calls directly - to brokers or via the RabbitMQ web console. + A user associated with the broker. For Amazon MQ for RabbitMQ brokers, one + and only one administrative user is accepted and created when a broker is + first provisioned. All subsequent broker users are created by making RabbitMQ + API calls directly to brokers or via the RabbitMQ web console. properties: consoleAccess: type: boolean @@ -224,10 +282,8 @@ spec: type: object type: array required: - - autoMinorVersionUpgrade - deploymentMode - engineType - - engineVersion - hostInstanceType - name - publiclyAccessible @@ -266,8 +322,10 @@ spec: - region type: object brokerID: + description: The unique ID that Amazon MQ generates for the broker. type: string brokerInstances: + description: A list of information about allocated brokers. items: description: Returns information about all brokers. properties: @@ -282,6 +340,7 @@ spec: type: object type: array brokerState: + description: The broker's status. type: string conditions: description: |- diff --git a/generator.yaml b/generator.yaml index e4b5250..ac1e03d 100644 --- a/generator.yaml +++ b/generator.yaml @@ -2,6 +2,10 @@ ignore: resource_names: - Configuration - User + field_paths: + - CreateBrokerInput.DataReplicationPrimaryBrokerArn + - CreateBrokerInput.DataReplicationMode + - User.ReplicationUser resources: Broker: hooks: diff --git a/go.mod b/go.mod index 402241a..413892c 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,11 @@ toolchain go1.22.5 require ( github.com/aws-controllers-k8s/ec2-controller v0.0.21 - github.com/aws-controllers-k8s/runtime v0.41.0 + github.com/aws-controllers-k8s/runtime v0.41.1-0.20250204215244-e48dd7b2d6d0 github.com/aws/aws-sdk-go v1.49.0 + github.com/aws/aws-sdk-go-v2 v1.34.0 + github.com/aws/aws-sdk-go-v2/service/mq v1.27.13 + github.com/aws/smithy-go v1.22.2 github.com/go-logr/logr v1.4.2 github.com/spf13/pflag v1.0.5 k8s.io/api v0.31.0 @@ -17,6 +20,17 @@ require ( ) require ( + github.com/aws/aws-sdk-go-v2/config v1.28.6 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.47 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.21 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.29 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.29 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.7 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.6 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.33.2 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect @@ -40,7 +54,6 @@ require ( github.com/itchyny/gojq v0.12.6 // indirect github.com/itchyny/timefmt-go v0.1.3 // indirect github.com/jaypipes/envutil v1.0.0 // indirect - github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.7.7 // indirect diff --git a/go.sum b/go.sum index 54d5211..f8a7909 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,37 @@ github.com/aws-controllers-k8s/ec2-controller v0.0.21 h1:5O7/9aED2Tl9OT0TL2rWrc1Ix5V1UxYEgDKAhvFhPJQ= github.com/aws-controllers-k8s/ec2-controller v0.0.21/go.mod h1:OMsmJeJ3iQZ1sJgs3hqnjBRnJ3hmTzJUO38W5rxnB5M= -github.com/aws-controllers-k8s/runtime v0.41.0 h1:WumDnUiVlqnYYGEIGSOUBgDPWTIEozW8HT0qwGapDgA= -github.com/aws-controllers-k8s/runtime v0.41.0/go.mod h1:Tuq5AFGJQcU00MY+J5hBYbLctpR50I8iGs5TPLox+u8= +github.com/aws-controllers-k8s/runtime v0.41.1-0.20250204215244-e48dd7b2d6d0 h1:ygZwhPfearlE8/P0HY8rXpFsbarwJ5tzBIov+3xgQfk= +github.com/aws-controllers-k8s/runtime v0.41.1-0.20250204215244-e48dd7b2d6d0/go.mod h1:Oy0JKvDxZMZ+SVupm4NZVqP00KLIIAMfk93KnOwlt5c= github.com/aws/aws-sdk-go v1.49.0 h1:g9BkW1fo9GqKfwg2+zCD+TW/D36Ux+vtfJ8guF4AYmY= github.com/aws/aws-sdk-go v1.49.0/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go-v2 v1.34.0 h1:9iyL+cjifckRGEVpRKZP3eIxVlL06Qk1Tk13vreaVQU= +github.com/aws/aws-sdk-go-v2 v1.34.0/go.mod h1:JgstGg0JjWU1KpVJjD5H0y0yyAIpSdKEq556EI6yOOM= +github.com/aws/aws-sdk-go-v2/config v1.28.6 h1:D89IKtGrs/I3QXOLNTH93NJYtDhm8SYa9Q5CsPShmyo= +github.com/aws/aws-sdk-go-v2/config v1.28.6/go.mod h1:GDzxJ5wyyFSCoLkS+UhGB0dArhb9mI+Co4dHtoTxbko= +github.com/aws/aws-sdk-go-v2/credentials v1.17.47 h1:48bA+3/fCdi2yAwVt+3COvmatZ6jUDNkDTIsqDiMUdw= +github.com/aws/aws-sdk-go-v2/credentials v1.17.47/go.mod h1:+KdckOejLW3Ks3b0E3b5rHsr2f9yuORBum0WPnE5o5w= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.21 h1:AmoU1pziydclFT/xRV+xXE/Vb8fttJCLRPv8oAkprc0= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.21/go.mod h1:AjUdLYe4Tgs6kpH4Bv7uMZo7pottoyHMn4eTcIcneaY= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.29 h1:Ej0Rf3GMv50Qh4G4852j2djtoDb7AzQ7MuQeFHa3D70= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.29/go.mod h1:oeNTC7PwJNoM5AznVr23wxhLnuJv0ZDe5v7w0wqIs9M= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.29 h1:6e8a71X+9GfghragVevC5bZqvATtc3mAMgxpSNbgzF0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.29/go.mod h1:c4jkZiQ+BWpNqq7VtrxjwISrLrt/VvPq3XiopkUIolI= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.6 h1:50+XsN70RS7dwJ2CkVNXzj7U2L1HKP8nqTd3XWEXBN4= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.6/go.mod h1:WqgLmwY7so32kG01zD8CPTJWVWM+TzJoOVHwTg4aPug= +github.com/aws/aws-sdk-go-v2/service/mq v1.27.13 h1:IjnEUEezx59kxaVcZ3AvXebRHKmfbxLz7bhCOM///js= +github.com/aws/aws-sdk-go-v2/service/mq v1.27.13/go.mod h1:842Pv2fRL/xgTy1ewrCb7sm1hTE91IVRoZkPh6R+y5s= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.7 h1:rLnYAfXQ3YAccocshIH5mzNNwZBkBo+bP6EhIxak6Hw= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.7/go.mod h1:ZHtuQJ6t9A/+YDuxOLnbryAmITtr8UysSny3qcyvJTc= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.6 h1:JnhTZR3PiYDNKlXy50/pNeix9aGMo6lLpXwJ1mw8MD4= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.6/go.mod h1:URronUEGfXZN1VpdktPSD1EkAL9mfrV+2F4sjH38qOY= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.2 h1:s4074ZO1Hk8qv65GqNXqDjmkf4HSQqJukaLuuW0TpDA= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.2/go.mod h1:mVggCnIWoM09jP71Wh+ea7+5gAp53q+49wDFs1SW5z8= +github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ= +github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= @@ -67,8 +95,6 @@ github.com/jaypipes/envutil v1.0.0 h1:u6Vwy9HwruFihoZrL0bxDLCa/YNadGVwKyPElNmZWo github.com/jaypipes/envutil v1.0.0/go.mod h1:vgIRDly+xgBq0eeZRcflOHMMobMwgC6MkMbxo/Nw65M= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= diff --git a/helm/crds/mq.services.k8s.aws_brokers.yaml b/helm/crds/mq.services.k8s.aws_brokers.yaml index 106752f..23946b6 100644 --- a/helm/crds/mq.services.k8s.aws_brokers.yaml +++ b/helm/crds/mq.services.k8s.aws_brokers.yaml @@ -40,14 +40,22 @@ spec: description: BrokerSpec defines the desired state of Broker. properties: authenticationStrategy: + description: |- + Optional. The authentication strategy used to secure the broker. The default + is SIMPLE. type: string autoMinorVersionUpgrade: - type: boolean - configuration: description: |- - A list of information about the configuration. + Enables automatic upgrades to new patch versions for brokers as new versions + are released and supported by Amazon MQ. Automatic upgrades occur during + the scheduled maintenance window or after a manual broker reboot. Set to + true by default, if no value is specified. - Does not apply to RabbitMQ brokers. + Must be set to true for ActiveMQ brokers version 5.18 and above and for RabbitMQ + brokers version 3.13 and above. + type: boolean + configuration: + description: A list of information about the configuration. properties: id: type: string @@ -56,14 +64,18 @@ spec: type: integer type: object creatorRequestID: + description: |- + The unique ID that the requester receives for the created broker. Amazon + MQ passes your ID with the API action. + + We recommend using a Universally Unique Identifier (UUID) for the creatorRequestId. + You may omit the creatorRequestId if your application doesn't require idempotency. type: string deploymentMode: + description: Required. The broker's deployment mode. type: string encryptionOptions: - description: |- - Does not apply to RabbitMQ brokers. - - Encryption options for the broker. + description: Encryption options for the broker. properties: kmsKeyID: type: string @@ -71,17 +83,25 @@ spec: type: boolean type: object engineType: + description: |- + Required. The type of broker engine. Currently, Amazon MQ supports ACTIVEMQ + and RABBITMQ. type: string engineVersion: + description: |- + The broker engine version. Defaults to the latest available version for the + specified broker engine type. For more information, see the ActiveMQ version + management (https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/activemq-version-management.html) + and the RabbitMQ version management (https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/rabbitmq-version-management.html) + sections in the Amazon MQ Developer Guide. type: string hostInstanceType: + description: Required. The broker's instance type. type: string ldapServerMetadata: description: |- Optional. The metadata of the LDAP server used to authenticate and authorize - connections to the broker. - - Does not apply to RabbitMQ brokers. + connections to the broker. Does not apply to RabbitMQ brokers. properties: hosts: items: @@ -109,8 +129,7 @@ spec: type: boolean type: object logs: - description: The list of information about logs to be enabled for - the specified broker. + description: Enables Amazon CloudWatch logging for brokers. properties: audit: type: boolean @@ -118,9 +137,7 @@ spec: type: boolean type: object maintenanceWindowStartTime: - description: |- - The scheduled time period relative to UTC during which Amazon MQ begins to - apply pending updates or patches to the broker. + description: The parameters that determine the WeeklyStartTime. properties: dayOfWeek: type: string @@ -130,8 +147,21 @@ spec: type: string type: object name: + description: |- + Required. The broker's name. This value must be unique in your Amazon Web + Services account, 1-50 characters long, must contain only letters, numbers, + dashes, and underscores, and must not contain white spaces, brackets, wildcard + characters, or special characters. + + Do not add personally identifiable information (PII) or other confidential + or sensitive information in broker names. Broker names are accessible to + other Amazon Web Services services, including CloudWatch Logs. Broker names + are not intended to be used for private or sensitive data. type: string publiclyAccessible: + description: |- + Enables connections from applications outside of the VPC that hosts the broker's + subnets. Set to false by default, if no value is provided. type: boolean securityGroupRefs: items: @@ -153,12 +183,33 @@ spec: type: object type: array securityGroups: + description: |- + The list of rules (1 minimum, 125 maximum) that authorize connections to + brokers. items: type: string type: array storageType: + description: The broker's storage type. type: string subnetIDs: + description: |- + The list of groups that define which subnets and IP ranges the broker can + use from different Availability Zones. If you specify more than one subnet, + the subnets must be in different Availability Zones. Amazon MQ will not be + able to create VPC endpoints for your broker with multiple subnets in the + same Availability Zone. A SINGLE_INSTANCE deployment requires one subnet + (for example, the default subnet). An ACTIVE_STANDBY_MULTI_AZ Amazon MQ for + ActiveMQ deployment requires two subnets. A CLUSTER_MULTI_AZ Amazon MQ for + RabbitMQ deployment has no subnet requirements when deployed with public + accessibility. Deployment without public accessibility requires at least + one subnet. + + If you specify subnets in a shared VPC (https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html) + for a RabbitMQ broker, the associated VPC to which the specified subnets + belong must be owned by your Amazon Web Services account. Amazon MQ will + not be able to create VPC endpoints in VPCs that are not owned by your Amazon + Web Services account. items: type: string type: array @@ -184,14 +235,21 @@ spec: tags: additionalProperties: type: string + description: Create tags when creating the broker. type: object users: + description: |- + The list of broker users (persons or applications) who can access queues + and topics. For Amazon MQ for RabbitMQ brokers, one and only one administrative + user is accepted and created when a broker is first provisioned. All subsequent + broker users are created by making RabbitMQ API calls directly to brokers + or via the RabbitMQ web console. items: description: |- - A user associated with the broker. For RabbitMQ brokers, one and only one - administrative user is accepted and created when a broker is first provisioned. - All subsequent broker users are created by making RabbitMQ API calls directly - to brokers or via the RabbitMQ web console. + A user associated with the broker. For Amazon MQ for RabbitMQ brokers, one + and only one administrative user is accepted and created when a broker is + first provisioned. All subsequent broker users are created by making RabbitMQ + API calls directly to brokers or via the RabbitMQ web console. properties: consoleAccess: type: boolean @@ -224,10 +282,8 @@ spec: type: object type: array required: - - autoMinorVersionUpgrade - deploymentMode - engineType - - engineVersion - hostInstanceType - name - publiclyAccessible @@ -266,8 +322,10 @@ spec: - region type: object brokerID: + description: The unique ID that Amazon MQ generates for the broker. type: string brokerInstances: + description: A list of information about allocated brokers. items: description: Returns information about all brokers. properties: @@ -282,6 +340,7 @@ spec: type: object type: array brokerState: + description: The broker's status. type: string conditions: description: |- diff --git a/pkg/resource/broker/manager.go b/pkg/resource/broker/manager.go index f8af65d..dd85884 100644 --- a/pkg/resource/broker/manager.go +++ b/pkg/resource/broker/manager.go @@ -32,9 +32,8 @@ import ( acktags "github.com/aws-controllers-k8s/runtime/pkg/tags" acktypes "github.com/aws-controllers-k8s/runtime/pkg/types" ackutil "github.com/aws-controllers-k8s/runtime/pkg/util" - "github.com/aws/aws-sdk-go/aws/session" - svcsdk "github.com/aws/aws-sdk-go/service/mq" - svcsdkapi "github.com/aws/aws-sdk-go/service/mq/mqiface" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/mq" "github.com/go-logr/logr" corev1 "k8s.io/api/core/v1" @@ -59,6 +58,9 @@ type resourceManager struct { // cfg is a copy of the ackcfg.Config object passed on start of the service // controller cfg ackcfg.Config + // clientcfg is a copy of the client configuration passed on start of the + // service controller + clientcfg aws.Config // log refers to the logr.Logger object handling logging for the service // controller log logr.Logger @@ -73,12 +75,9 @@ type resourceManager struct { awsAccountID ackv1alpha1.AWSAccountID // The AWS Region that this resource manager targets awsRegion ackv1alpha1.AWSRegion - // sess is the AWS SDK Session object used to communicate with the backend - // AWS service API - sess *session.Session - // sdk is a pointer to the AWS service API interface exposed by the - // aws-sdk-go/services/{alias}/{alias}iface package. - sdkapi svcsdkapi.MQAPI + // sdk is a pointer to the AWS service API client exposed by the + // aws-sdk-go-v2/services/{alias} package. + sdkapi *svcsdk.Client } // concreteResource returns a pointer to a resource from the supplied @@ -299,24 +298,25 @@ func (rm *resourceManager) EnsureTags( // newResourceManager returns a new struct implementing // acktypes.AWSResourceManager +// This is for AWS-SDK-GO-V2 - Created newResourceManager With AWS sdk-Go-ClientV2 func newResourceManager( cfg ackcfg.Config, + clientcfg aws.Config, log logr.Logger, metrics *ackmetrics.Metrics, rr acktypes.Reconciler, - sess *session.Session, id ackv1alpha1.AWSAccountID, region ackv1alpha1.AWSRegion, ) (*resourceManager, error) { return &resourceManager{ cfg: cfg, + clientcfg: clientcfg, log: log, metrics: metrics, rr: rr, awsAccountID: id, awsRegion: region, - sess: sess, - sdkapi: svcsdk.New(sess), + sdkapi: svcsdk.NewFromConfig(clientcfg), }, nil } diff --git a/pkg/resource/broker/manager_factory.go b/pkg/resource/broker/manager_factory.go index 6a48c2d..a4ad4fe 100644 --- a/pkg/resource/broker/manager_factory.go +++ b/pkg/resource/broker/manager_factory.go @@ -23,7 +23,7 @@ import ( ackcfg "github.com/aws-controllers-k8s/runtime/pkg/config" ackmetrics "github.com/aws-controllers-k8s/runtime/pkg/metrics" acktypes "github.com/aws-controllers-k8s/runtime/pkg/types" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go-v2/aws" "github.com/go-logr/logr" svcresource "github.com/aws-controllers-k8s/mq-controller/pkg/resource" @@ -47,10 +47,10 @@ func (f *resourceManagerFactory) ResourceDescriptor() acktypes.AWSResourceDescri // supplied AWS account func (f *resourceManagerFactory) ManagerFor( cfg ackcfg.Config, + clientcfg aws.Config, log logr.Logger, metrics *ackmetrics.Metrics, rr acktypes.Reconciler, - sess *session.Session, id ackv1alpha1.AWSAccountID, region ackv1alpha1.AWSRegion, roleARN ackv1alpha1.AWSResourceName, @@ -70,7 +70,7 @@ func (f *resourceManagerFactory) ManagerFor( f.Lock() defer f.Unlock() - rm, err := newResourceManager(cfg, log, metrics, rr, sess, id, region) + rm, err := newResourceManager(cfg, clientcfg, log, metrics, rr, id, region) if err != nil { return nil, err } diff --git a/pkg/resource/broker/sdk.go b/pkg/resource/broker/sdk.go index 9219c20..b47ed4b 100644 --- a/pkg/resource/broker/sdk.go +++ b/pkg/resource/broker/sdk.go @@ -19,6 +19,7 @@ import ( "context" "errors" "fmt" + "math" "reflect" "strings" @@ -28,8 +29,10 @@ import ( ackerr "github.com/aws-controllers-k8s/runtime/pkg/errors" ackrequeue "github.com/aws-controllers-k8s/runtime/pkg/requeue" ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" - "github.com/aws/aws-sdk-go/aws" - svcsdk "github.com/aws/aws-sdk-go/service/mq" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/mq" + svcsdktypes "github.com/aws/aws-sdk-go-v2/service/mq/types" + smithy "github.com/aws/smithy-go" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,8 +43,7 @@ import ( var ( _ = &metav1.Time{} _ = strings.ToLower("") - _ = &aws.JSONValue{} - _ = &svcsdk.MQ{} + _ = &svcsdk.Client{} _ = &svcapitypes.Broker{} _ = ackv1alpha1.AWSAccountID("") _ = &ackerr.NotFound @@ -49,6 +51,7 @@ var ( _ = &reflect.Value{} _ = fmt.Sprintf("") _ = &ackrequeue.NoRequeue{} + _ = &aws.Config{} ) // sdkFind returns SDK-specific information about a supplied resource @@ -73,14 +76,12 @@ func (rm *resourceManager) sdkFind( return nil, err } - var resp *svcsdk.DescribeBrokerResponse - resp, err = rm.sdkapi.DescribeBrokerWithContext(ctx, input) + var resp *svcsdk.DescribeBrokerOutput + resp, err = rm.sdkapi.DescribeBroker(ctx, input) rm.metrics.RecordAPICall("READ_ONE", "DescribeBroker", err) if err != nil { - if reqErr, ok := ackerr.AWSRequestFailure(err); ok && reqErr.StatusCode() == 404 { - return nil, ackerr.NotFound - } - if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "NotFoundException" { + var awsErr smithy.APIError + if errors.As(err, &awsErr) && awsErr.ErrorCode() == "NotFoundException" { return nil, ackerr.NotFound } return nil, err @@ -90,8 +91,8 @@ func (rm *resourceManager) sdkFind( // the original Kubernetes object we passed to the function ko := r.ko.DeepCopy() - if resp.AuthenticationStrategy != nil { - ko.Spec.AuthenticationStrategy = resp.AuthenticationStrategy + if resp.AuthenticationStrategy != "" { + ko.Spec.AuthenticationStrategy = aws.String(string(resp.AuthenticationStrategy)) } else { ko.Spec.AuthenticationStrategy = nil } @@ -120,13 +121,7 @@ func (rm *resourceManager) sdkFind( f5elem.ConsoleURL = f5iter.ConsoleURL } if f5iter.Endpoints != nil { - f5elemf1 := []*string{} - for _, f5elemf1iter := range f5iter.Endpoints { - var f5elemf1elem string - f5elemf1elem = *f5elemf1iter - f5elemf1 = append(f5elemf1, &f5elemf1elem) - } - f5elem.Endpoints = f5elemf1 + f5elem.Endpoints = aws.StringSlice(f5iter.Endpoints) } if f5iter.IpAddress != nil { f5elem.IPAddress = f5iter.IpAddress @@ -137,30 +132,30 @@ func (rm *resourceManager) sdkFind( } else { ko.Status.BrokerInstances = nil } - if resp.BrokerState != nil { - ko.Status.BrokerState = resp.BrokerState + if resp.BrokerState != "" { + ko.Status.BrokerState = aws.String(string(resp.BrokerState)) } else { ko.Status.BrokerState = nil } - if resp.DeploymentMode != nil { - ko.Spec.DeploymentMode = resp.DeploymentMode + if resp.DeploymentMode != "" { + ko.Spec.DeploymentMode = aws.String(string(resp.DeploymentMode)) } else { ko.Spec.DeploymentMode = nil } if resp.EncryptionOptions != nil { - f11 := &svcapitypes.EncryptionOptions{} + f13 := &svcapitypes.EncryptionOptions{} if resp.EncryptionOptions.KmsKeyId != nil { - f11.KMSKeyID = resp.EncryptionOptions.KmsKeyId + f13.KMSKeyID = resp.EncryptionOptions.KmsKeyId } if resp.EncryptionOptions.UseAwsOwnedKey != nil { - f11.UseAWSOwnedKey = resp.EncryptionOptions.UseAwsOwnedKey + f13.UseAWSOwnedKey = resp.EncryptionOptions.UseAwsOwnedKey } - ko.Spec.EncryptionOptions = f11 + ko.Spec.EncryptionOptions = f13 } else { ko.Spec.EncryptionOptions = nil } - if resp.EngineType != nil { - ko.Spec.EngineType = resp.EngineType + if resp.EngineType != "" { + ko.Spec.EngineType = aws.String(string(resp.EngineType)) } else { ko.Spec.EngineType = nil } @@ -175,71 +170,65 @@ func (rm *resourceManager) sdkFind( ko.Spec.HostInstanceType = nil } if resp.LdapServerMetadata != nil { - f15 := &svcapitypes.LDAPServerMetadataInput{} + f17 := &svcapitypes.LDAPServerMetadataInput{} if resp.LdapServerMetadata.Hosts != nil { - f15f0 := []*string{} - for _, f15f0iter := range resp.LdapServerMetadata.Hosts { - var f15f0elem string - f15f0elem = *f15f0iter - f15f0 = append(f15f0, &f15f0elem) - } - f15.Hosts = f15f0 + f17.Hosts = aws.StringSlice(resp.LdapServerMetadata.Hosts) } if resp.LdapServerMetadata.RoleBase != nil { - f15.RoleBase = resp.LdapServerMetadata.RoleBase + f17.RoleBase = resp.LdapServerMetadata.RoleBase } if resp.LdapServerMetadata.RoleName != nil { - f15.RoleName = resp.LdapServerMetadata.RoleName + f17.RoleName = resp.LdapServerMetadata.RoleName } if resp.LdapServerMetadata.RoleSearchMatching != nil { - f15.RoleSearchMatching = resp.LdapServerMetadata.RoleSearchMatching + f17.RoleSearchMatching = resp.LdapServerMetadata.RoleSearchMatching } if resp.LdapServerMetadata.RoleSearchSubtree != nil { - f15.RoleSearchSubtree = resp.LdapServerMetadata.RoleSearchSubtree + f17.RoleSearchSubtree = resp.LdapServerMetadata.RoleSearchSubtree } if resp.LdapServerMetadata.ServiceAccountUsername != nil { - f15.ServiceAccountUsername = resp.LdapServerMetadata.ServiceAccountUsername + f17.ServiceAccountUsername = resp.LdapServerMetadata.ServiceAccountUsername } if resp.LdapServerMetadata.UserBase != nil { - f15.UserBase = resp.LdapServerMetadata.UserBase + f17.UserBase = resp.LdapServerMetadata.UserBase } if resp.LdapServerMetadata.UserRoleName != nil { - f15.UserRoleName = resp.LdapServerMetadata.UserRoleName + f17.UserRoleName = resp.LdapServerMetadata.UserRoleName } if resp.LdapServerMetadata.UserSearchMatching != nil { - f15.UserSearchMatching = resp.LdapServerMetadata.UserSearchMatching + f17.UserSearchMatching = resp.LdapServerMetadata.UserSearchMatching } if resp.LdapServerMetadata.UserSearchSubtree != nil { - f15.UserSearchSubtree = resp.LdapServerMetadata.UserSearchSubtree + f17.UserSearchSubtree = resp.LdapServerMetadata.UserSearchSubtree } - ko.Spec.LDAPServerMetadata = f15 + ko.Spec.LDAPServerMetadata = f17 } else { ko.Spec.LDAPServerMetadata = nil } if resp.Logs != nil { - f16 := &svcapitypes.Logs{} + f18 := &svcapitypes.Logs{} if resp.Logs.Audit != nil { - f16.Audit = resp.Logs.Audit + f18.Audit = resp.Logs.Audit } if resp.Logs.General != nil { - f16.General = resp.Logs.General + f18.General = resp.Logs.General } - ko.Spec.Logs = f16 + ko.Spec.Logs = f18 } else { ko.Spec.Logs = nil } if resp.MaintenanceWindowStartTime != nil { - f17 := &svcapitypes.WeeklyStartTime{} - if resp.MaintenanceWindowStartTime.DayOfWeek != nil { - f17.DayOfWeek = resp.MaintenanceWindowStartTime.DayOfWeek + f19 := &svcapitypes.WeeklyStartTime{} + if resp.MaintenanceWindowStartTime.DayOfWeek != "" { + f19.DayOfWeek = aws.String(string(resp.MaintenanceWindowStartTime.DayOfWeek)) } if resp.MaintenanceWindowStartTime.TimeOfDay != nil { - f17.TimeOfDay = resp.MaintenanceWindowStartTime.TimeOfDay + f19.TimeOfDay = resp.MaintenanceWindowStartTime.TimeOfDay } if resp.MaintenanceWindowStartTime.TimeZone != nil { - f17.TimeZone = resp.MaintenanceWindowStartTime.TimeZone + f19.TimeZone = resp.MaintenanceWindowStartTime.TimeZone } - ko.Spec.MaintenanceWindowStartTime = f17 + ko.Spec.MaintenanceWindowStartTime = f19 } else { ko.Spec.MaintenanceWindowStartTime = nil } @@ -249,53 +238,35 @@ func (rm *resourceManager) sdkFind( ko.Spec.PubliclyAccessible = nil } if resp.SecurityGroups != nil { - f24 := []*string{} - for _, f24iter := range resp.SecurityGroups { - var f24elem string - f24elem = *f24iter - f24 = append(f24, &f24elem) - } - ko.Spec.SecurityGroups = f24 + ko.Spec.SecurityGroups = aws.StringSlice(resp.SecurityGroups) } else { ko.Spec.SecurityGroups = nil } - if resp.StorageType != nil { - ko.Spec.StorageType = resp.StorageType + if resp.StorageType != "" { + ko.Spec.StorageType = aws.String(string(resp.StorageType)) } else { ko.Spec.StorageType = nil } if resp.SubnetIds != nil { - f26 := []*string{} - for _, f26iter := range resp.SubnetIds { - var f26elem string - f26elem = *f26iter - f26 = append(f26, &f26elem) - } - ko.Spec.SubnetIDs = f26 + ko.Spec.SubnetIDs = aws.StringSlice(resp.SubnetIds) } else { ko.Spec.SubnetIDs = nil } if resp.Tags != nil { - f27 := map[string]*string{} - for f27key, f27valiter := range resp.Tags { - var f27val string - f27val = *f27valiter - f27[f27key] = &f27val - } - ko.Spec.Tags = f27 + ko.Spec.Tags = aws.StringMap(resp.Tags) } else { ko.Spec.Tags = nil } if resp.Users != nil { - f28 := []*svcapitypes.User{} - for _, f28iter := range resp.Users { - f28elem := &svcapitypes.User{} - if f28iter.Username != nil { - f28elem.Username = f28iter.Username + f32 := []*svcapitypes.User{} + for _, f32iter := range resp.Users { + f32elem := &svcapitypes.User{} + if f32iter.Username != nil { + f32elem.Username = f32iter.Username } - f28 = append(f28, f28elem) + f32 = append(f32, f32elem) } - ko.Spec.Users = f28 + ko.Spec.Users = f32 } else { ko.Spec.Users = nil } @@ -325,7 +296,7 @@ func (rm *resourceManager) newDescribeRequestPayload( res := &svcsdk.DescribeBrokerInput{} if r.ko.Status.BrokerID != nil { - res.SetBrokerId(*r.ko.Status.BrokerID) + res.BrokerId = r.ko.Status.BrokerID } return res, nil @@ -348,9 +319,9 @@ func (rm *resourceManager) sdkCreate( return nil, err } - var resp *svcsdk.CreateBrokerResponse + var resp *svcsdk.CreateBrokerOutput _ = resp - resp, err = rm.sdkapi.CreateBrokerWithContext(ctx, input) + resp, err = rm.sdkapi.CreateBroker(ctx, input) rm.metrics.RecordAPICall("CREATE", "CreateBroker", err) if err != nil { return nil, err @@ -381,167 +352,142 @@ func (rm *resourceManager) sdkCreate( func (rm *resourceManager) newCreateRequestPayload( ctx context.Context, r *resource, -) (*svcsdk.CreateBrokerRequest, error) { - res := &svcsdk.CreateBrokerRequest{} +) (*svcsdk.CreateBrokerInput, error) { + res := &svcsdk.CreateBrokerInput{} if r.ko.Spec.AuthenticationStrategy != nil { - res.SetAuthenticationStrategy(*r.ko.Spec.AuthenticationStrategy) + res.AuthenticationStrategy = svcsdktypes.AuthenticationStrategy(*r.ko.Spec.AuthenticationStrategy) } if r.ko.Spec.AutoMinorVersionUpgrade != nil { - res.SetAutoMinorVersionUpgrade(*r.ko.Spec.AutoMinorVersionUpgrade) + res.AutoMinorVersionUpgrade = r.ko.Spec.AutoMinorVersionUpgrade } if r.ko.Spec.Name != nil { - res.SetBrokerName(*r.ko.Spec.Name) + res.BrokerName = r.ko.Spec.Name } if r.ko.Spec.Configuration != nil { - f3 := &svcsdk.ConfigurationId{} + f3 := &svcsdktypes.ConfigurationId{} if r.ko.Spec.Configuration.ID != nil { - f3.SetId(*r.ko.Spec.Configuration.ID) + f3.Id = r.ko.Spec.Configuration.ID } if r.ko.Spec.Configuration.Revision != nil { - f3.SetRevision(*r.ko.Spec.Configuration.Revision) + revisionCopy0 := *r.ko.Spec.Configuration.Revision + if revisionCopy0 > math.MaxInt32 || revisionCopy0 < math.MinInt32 { + return nil, fmt.Errorf("error: field Revision is of type int32") + } + revisionCopy := int32(revisionCopy0) + f3.Revision = &revisionCopy } - res.SetConfiguration(f3) + res.Configuration = f3 } if r.ko.Spec.CreatorRequestID != nil { - res.SetCreatorRequestId(*r.ko.Spec.CreatorRequestID) + res.CreatorRequestId = r.ko.Spec.CreatorRequestID } if r.ko.Spec.DeploymentMode != nil { - res.SetDeploymentMode(*r.ko.Spec.DeploymentMode) + res.DeploymentMode = svcsdktypes.DeploymentMode(*r.ko.Spec.DeploymentMode) } if r.ko.Spec.EncryptionOptions != nil { - f6 := &svcsdk.EncryptionOptions{} + f6 := &svcsdktypes.EncryptionOptions{} if r.ko.Spec.EncryptionOptions.KMSKeyID != nil { - f6.SetKmsKeyId(*r.ko.Spec.EncryptionOptions.KMSKeyID) + f6.KmsKeyId = r.ko.Spec.EncryptionOptions.KMSKeyID } if r.ko.Spec.EncryptionOptions.UseAWSOwnedKey != nil { - f6.SetUseAwsOwnedKey(*r.ko.Spec.EncryptionOptions.UseAWSOwnedKey) + f6.UseAwsOwnedKey = r.ko.Spec.EncryptionOptions.UseAWSOwnedKey } - res.SetEncryptionOptions(f6) + res.EncryptionOptions = f6 } if r.ko.Spec.EngineType != nil { - res.SetEngineType(*r.ko.Spec.EngineType) + res.EngineType = svcsdktypes.EngineType(*r.ko.Spec.EngineType) } if r.ko.Spec.EngineVersion != nil { - res.SetEngineVersion(*r.ko.Spec.EngineVersion) + res.EngineVersion = r.ko.Spec.EngineVersion } if r.ko.Spec.HostInstanceType != nil { - res.SetHostInstanceType(*r.ko.Spec.HostInstanceType) + res.HostInstanceType = r.ko.Spec.HostInstanceType } if r.ko.Spec.LDAPServerMetadata != nil { - f10 := &svcsdk.LdapServerMetadataInput{} + f10 := &svcsdktypes.LdapServerMetadataInput{} if r.ko.Spec.LDAPServerMetadata.Hosts != nil { - f10f0 := []*string{} - for _, f10f0iter := range r.ko.Spec.LDAPServerMetadata.Hosts { - var f10f0elem string - f10f0elem = *f10f0iter - f10f0 = append(f10f0, &f10f0elem) - } - f10.SetHosts(f10f0) + f10.Hosts = aws.ToStringSlice(r.ko.Spec.LDAPServerMetadata.Hosts) } if r.ko.Spec.LDAPServerMetadata.RoleBase != nil { - f10.SetRoleBase(*r.ko.Spec.LDAPServerMetadata.RoleBase) + f10.RoleBase = r.ko.Spec.LDAPServerMetadata.RoleBase } if r.ko.Spec.LDAPServerMetadata.RoleName != nil { - f10.SetRoleName(*r.ko.Spec.LDAPServerMetadata.RoleName) + f10.RoleName = r.ko.Spec.LDAPServerMetadata.RoleName } if r.ko.Spec.LDAPServerMetadata.RoleSearchMatching != nil { - f10.SetRoleSearchMatching(*r.ko.Spec.LDAPServerMetadata.RoleSearchMatching) + f10.RoleSearchMatching = r.ko.Spec.LDAPServerMetadata.RoleSearchMatching } if r.ko.Spec.LDAPServerMetadata.RoleSearchSubtree != nil { - f10.SetRoleSearchSubtree(*r.ko.Spec.LDAPServerMetadata.RoleSearchSubtree) + f10.RoleSearchSubtree = r.ko.Spec.LDAPServerMetadata.RoleSearchSubtree } if r.ko.Spec.LDAPServerMetadata.ServiceAccountPassword != nil { - f10.SetServiceAccountPassword(*r.ko.Spec.LDAPServerMetadata.ServiceAccountPassword) + f10.ServiceAccountPassword = r.ko.Spec.LDAPServerMetadata.ServiceAccountPassword } if r.ko.Spec.LDAPServerMetadata.ServiceAccountUsername != nil { - f10.SetServiceAccountUsername(*r.ko.Spec.LDAPServerMetadata.ServiceAccountUsername) + f10.ServiceAccountUsername = r.ko.Spec.LDAPServerMetadata.ServiceAccountUsername } if r.ko.Spec.LDAPServerMetadata.UserBase != nil { - f10.SetUserBase(*r.ko.Spec.LDAPServerMetadata.UserBase) + f10.UserBase = r.ko.Spec.LDAPServerMetadata.UserBase } if r.ko.Spec.LDAPServerMetadata.UserRoleName != nil { - f10.SetUserRoleName(*r.ko.Spec.LDAPServerMetadata.UserRoleName) + f10.UserRoleName = r.ko.Spec.LDAPServerMetadata.UserRoleName } if r.ko.Spec.LDAPServerMetadata.UserSearchMatching != nil { - f10.SetUserSearchMatching(*r.ko.Spec.LDAPServerMetadata.UserSearchMatching) + f10.UserSearchMatching = r.ko.Spec.LDAPServerMetadata.UserSearchMatching } if r.ko.Spec.LDAPServerMetadata.UserSearchSubtree != nil { - f10.SetUserSearchSubtree(*r.ko.Spec.LDAPServerMetadata.UserSearchSubtree) + f10.UserSearchSubtree = r.ko.Spec.LDAPServerMetadata.UserSearchSubtree } - res.SetLdapServerMetadata(f10) + res.LdapServerMetadata = f10 } if r.ko.Spec.Logs != nil { - f11 := &svcsdk.Logs{} + f11 := &svcsdktypes.Logs{} if r.ko.Spec.Logs.Audit != nil { - f11.SetAudit(*r.ko.Spec.Logs.Audit) + f11.Audit = r.ko.Spec.Logs.Audit } if r.ko.Spec.Logs.General != nil { - f11.SetGeneral(*r.ko.Spec.Logs.General) + f11.General = r.ko.Spec.Logs.General } - res.SetLogs(f11) + res.Logs = f11 } if r.ko.Spec.MaintenanceWindowStartTime != nil { - f12 := &svcsdk.WeeklyStartTime{} + f12 := &svcsdktypes.WeeklyStartTime{} if r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek != nil { - f12.SetDayOfWeek(*r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek) + f12.DayOfWeek = svcsdktypes.DayOfWeek(*r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek) } if r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay != nil { - f12.SetTimeOfDay(*r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay) + f12.TimeOfDay = r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay } if r.ko.Spec.MaintenanceWindowStartTime.TimeZone != nil { - f12.SetTimeZone(*r.ko.Spec.MaintenanceWindowStartTime.TimeZone) + f12.TimeZone = r.ko.Spec.MaintenanceWindowStartTime.TimeZone } - res.SetMaintenanceWindowStartTime(f12) + res.MaintenanceWindowStartTime = f12 } if r.ko.Spec.PubliclyAccessible != nil { - res.SetPubliclyAccessible(*r.ko.Spec.PubliclyAccessible) + res.PubliclyAccessible = r.ko.Spec.PubliclyAccessible } if r.ko.Spec.SecurityGroups != nil { - f14 := []*string{} - for _, f14iter := range r.ko.Spec.SecurityGroups { - var f14elem string - f14elem = *f14iter - f14 = append(f14, &f14elem) - } - res.SetSecurityGroups(f14) + res.SecurityGroups = aws.ToStringSlice(r.ko.Spec.SecurityGroups) } if r.ko.Spec.StorageType != nil { - res.SetStorageType(*r.ko.Spec.StorageType) + res.StorageType = svcsdktypes.BrokerStorageType(*r.ko.Spec.StorageType) } if r.ko.Spec.SubnetIDs != nil { - f16 := []*string{} - for _, f16iter := range r.ko.Spec.SubnetIDs { - var f16elem string - f16elem = *f16iter - f16 = append(f16, &f16elem) - } - res.SetSubnetIds(f16) + res.SubnetIds = aws.ToStringSlice(r.ko.Spec.SubnetIDs) } if r.ko.Spec.Tags != nil { - f17 := map[string]*string{} - for f17key, f17valiter := range r.ko.Spec.Tags { - var f17val string - f17val = *f17valiter - f17[f17key] = &f17val - } - res.SetTags(f17) + res.Tags = aws.ToStringMap(r.ko.Spec.Tags) } if r.ko.Spec.Users != nil { - f18 := []*svcsdk.User{} + f18 := []svcsdktypes.User{} for _, f18iter := range r.ko.Spec.Users { - f18elem := &svcsdk.User{} + f18elem := &svcsdktypes.User{} if f18iter.ConsoleAccess != nil { - f18elem.SetConsoleAccess(*f18iter.ConsoleAccess) + f18elem.ConsoleAccess = f18iter.ConsoleAccess } if f18iter.Groups != nil { - f18elemf1 := []*string{} - for _, f18elemf1iter := range f18iter.Groups { - var f18elemf1elem string - f18elemf1elem = *f18elemf1iter - f18elemf1 = append(f18elemf1, &f18elemf1elem) - } - f18elem.SetGroups(f18elemf1) + f18elem.Groups = aws.ToStringSlice(f18iter.Groups) } if f18iter.Password != nil { tmpSecret, err := rm.rr.SecretValueFromReference(ctx, f18iter.Password) @@ -549,15 +495,15 @@ func (rm *resourceManager) newCreateRequestPayload( return nil, ackrequeue.Needed(err) } if tmpSecret != "" { - f18elem.SetPassword(tmpSecret) + f18elem.Password = aws.String(tmpSecret) } } if f18iter.Username != nil { - f18elem.SetUsername(*f18iter.Username) + f18elem.Username = f18iter.Username } - f18 = append(f18, f18elem) + f18 = append(f18, *f18elem) } - res.SetUsers(f18) + res.Users = f18 } return res, nil @@ -598,9 +544,9 @@ func (rm *resourceManager) sdkUpdate( return nil, err } - var resp *svcsdk.UpdateBrokerResponse + var resp *svcsdk.UpdateBrokerOutput _ = resp - resp, err = rm.sdkapi.UpdateBrokerWithContext(ctx, input) + resp, err = rm.sdkapi.UpdateBroker(ctx, input) rm.metrics.RecordAPICall("UPDATE", "UpdateBroker", err) if err != nil { return nil, err @@ -612,8 +558,8 @@ func (rm *resourceManager) sdkUpdate( latestKOStatus := latest.ko.DeepCopy().Status ko.Status = latestKOStatus - if resp.AuthenticationStrategy != nil { - ko.Spec.AuthenticationStrategy = resp.AuthenticationStrategy + if resp.AuthenticationStrategy != "" { + ko.Spec.AuthenticationStrategy = aws.String(string(resp.AuthenticationStrategy)) } else { ko.Spec.AuthenticationStrategy = nil } @@ -633,7 +579,8 @@ func (rm *resourceManager) sdkUpdate( f3.ID = resp.Configuration.Id } if resp.Configuration.Revision != nil { - f3.Revision = resp.Configuration.Revision + revisionCopy := int64(*resp.Configuration.Revision) + f3.Revision = &revisionCopy } ko.Spec.Configuration = f3 } else { @@ -650,82 +597,70 @@ func (rm *resourceManager) sdkUpdate( ko.Spec.HostInstanceType = nil } if resp.LdapServerMetadata != nil { - f6 := &svcapitypes.LDAPServerMetadataInput{} + f8 := &svcapitypes.LDAPServerMetadataInput{} if resp.LdapServerMetadata.Hosts != nil { - f6f0 := []*string{} - for _, f6f0iter := range resp.LdapServerMetadata.Hosts { - var f6f0elem string - f6f0elem = *f6f0iter - f6f0 = append(f6f0, &f6f0elem) - } - f6.Hosts = f6f0 + f8.Hosts = aws.StringSlice(resp.LdapServerMetadata.Hosts) } if resp.LdapServerMetadata.RoleBase != nil { - f6.RoleBase = resp.LdapServerMetadata.RoleBase + f8.RoleBase = resp.LdapServerMetadata.RoleBase } if resp.LdapServerMetadata.RoleName != nil { - f6.RoleName = resp.LdapServerMetadata.RoleName + f8.RoleName = resp.LdapServerMetadata.RoleName } if resp.LdapServerMetadata.RoleSearchMatching != nil { - f6.RoleSearchMatching = resp.LdapServerMetadata.RoleSearchMatching + f8.RoleSearchMatching = resp.LdapServerMetadata.RoleSearchMatching } if resp.LdapServerMetadata.RoleSearchSubtree != nil { - f6.RoleSearchSubtree = resp.LdapServerMetadata.RoleSearchSubtree + f8.RoleSearchSubtree = resp.LdapServerMetadata.RoleSearchSubtree } if resp.LdapServerMetadata.ServiceAccountUsername != nil { - f6.ServiceAccountUsername = resp.LdapServerMetadata.ServiceAccountUsername + f8.ServiceAccountUsername = resp.LdapServerMetadata.ServiceAccountUsername } if resp.LdapServerMetadata.UserBase != nil { - f6.UserBase = resp.LdapServerMetadata.UserBase + f8.UserBase = resp.LdapServerMetadata.UserBase } if resp.LdapServerMetadata.UserRoleName != nil { - f6.UserRoleName = resp.LdapServerMetadata.UserRoleName + f8.UserRoleName = resp.LdapServerMetadata.UserRoleName } if resp.LdapServerMetadata.UserSearchMatching != nil { - f6.UserSearchMatching = resp.LdapServerMetadata.UserSearchMatching + f8.UserSearchMatching = resp.LdapServerMetadata.UserSearchMatching } if resp.LdapServerMetadata.UserSearchSubtree != nil { - f6.UserSearchSubtree = resp.LdapServerMetadata.UserSearchSubtree + f8.UserSearchSubtree = resp.LdapServerMetadata.UserSearchSubtree } - ko.Spec.LDAPServerMetadata = f6 + ko.Spec.LDAPServerMetadata = f8 } else { ko.Spec.LDAPServerMetadata = nil } if resp.Logs != nil { - f7 := &svcapitypes.Logs{} + f9 := &svcapitypes.Logs{} if resp.Logs.Audit != nil { - f7.Audit = resp.Logs.Audit + f9.Audit = resp.Logs.Audit } if resp.Logs.General != nil { - f7.General = resp.Logs.General + f9.General = resp.Logs.General } - ko.Spec.Logs = f7 + ko.Spec.Logs = f9 } else { ko.Spec.Logs = nil } if resp.MaintenanceWindowStartTime != nil { - f8 := &svcapitypes.WeeklyStartTime{} - if resp.MaintenanceWindowStartTime.DayOfWeek != nil { - f8.DayOfWeek = resp.MaintenanceWindowStartTime.DayOfWeek + f10 := &svcapitypes.WeeklyStartTime{} + if resp.MaintenanceWindowStartTime.DayOfWeek != "" { + f10.DayOfWeek = aws.String(string(resp.MaintenanceWindowStartTime.DayOfWeek)) } if resp.MaintenanceWindowStartTime.TimeOfDay != nil { - f8.TimeOfDay = resp.MaintenanceWindowStartTime.TimeOfDay + f10.TimeOfDay = resp.MaintenanceWindowStartTime.TimeOfDay } if resp.MaintenanceWindowStartTime.TimeZone != nil { - f8.TimeZone = resp.MaintenanceWindowStartTime.TimeZone + f10.TimeZone = resp.MaintenanceWindowStartTime.TimeZone } - ko.Spec.MaintenanceWindowStartTime = f8 + ko.Spec.MaintenanceWindowStartTime = f10 } else { ko.Spec.MaintenanceWindowStartTime = nil } if resp.SecurityGroups != nil { - f9 := []*string{} - for _, f9iter := range resp.SecurityGroups { - var f9elem string - f9elem = *f9iter - f9 = append(f9, &f9elem) - } - ko.Spec.SecurityGroups = f9 + ko.Spec.SecurityGroups = aws.StringSlice(resp.SecurityGroups) } else { ko.Spec.SecurityGroups = nil } @@ -740,108 +675,101 @@ func (rm *resourceManager) newUpdateRequestPayload( ctx context.Context, r *resource, delta *ackcompare.Delta, -) (*svcsdk.UpdateBrokerRequest, error) { - res := &svcsdk.UpdateBrokerRequest{} +) (*svcsdk.UpdateBrokerInput, error) { + res := &svcsdk.UpdateBrokerInput{} if r.ko.Spec.AuthenticationStrategy != nil { - res.SetAuthenticationStrategy(*r.ko.Spec.AuthenticationStrategy) + res.AuthenticationStrategy = svcsdktypes.AuthenticationStrategy(*r.ko.Spec.AuthenticationStrategy) } if r.ko.Spec.AutoMinorVersionUpgrade != nil { - res.SetAutoMinorVersionUpgrade(*r.ko.Spec.AutoMinorVersionUpgrade) + res.AutoMinorVersionUpgrade = r.ko.Spec.AutoMinorVersionUpgrade } if r.ko.Status.BrokerID != nil { - res.SetBrokerId(*r.ko.Status.BrokerID) + res.BrokerId = r.ko.Status.BrokerID } if r.ko.Spec.Configuration != nil { - f3 := &svcsdk.ConfigurationId{} + f3 := &svcsdktypes.ConfigurationId{} if r.ko.Spec.Configuration.ID != nil { - f3.SetId(*r.ko.Spec.Configuration.ID) + f3.Id = r.ko.Spec.Configuration.ID } if r.ko.Spec.Configuration.Revision != nil { - f3.SetRevision(*r.ko.Spec.Configuration.Revision) + revisionCopy0 := *r.ko.Spec.Configuration.Revision + if revisionCopy0 > math.MaxInt32 || revisionCopy0 < math.MinInt32 { + return nil, fmt.Errorf("error: field Revision is of type int32") + } + revisionCopy := int32(revisionCopy0) + f3.Revision = &revisionCopy } - res.SetConfiguration(f3) + res.Configuration = f3 } if r.ko.Spec.EngineVersion != nil { - res.SetEngineVersion(*r.ko.Spec.EngineVersion) + res.EngineVersion = r.ko.Spec.EngineVersion } if r.ko.Spec.HostInstanceType != nil { - res.SetHostInstanceType(*r.ko.Spec.HostInstanceType) + res.HostInstanceType = r.ko.Spec.HostInstanceType } if r.ko.Spec.LDAPServerMetadata != nil { - f6 := &svcsdk.LdapServerMetadataInput{} + f7 := &svcsdktypes.LdapServerMetadataInput{} if r.ko.Spec.LDAPServerMetadata.Hosts != nil { - f6f0 := []*string{} - for _, f6f0iter := range r.ko.Spec.LDAPServerMetadata.Hosts { - var f6f0elem string - f6f0elem = *f6f0iter - f6f0 = append(f6f0, &f6f0elem) - } - f6.SetHosts(f6f0) + f7.Hosts = aws.ToStringSlice(r.ko.Spec.LDAPServerMetadata.Hosts) } if r.ko.Spec.LDAPServerMetadata.RoleBase != nil { - f6.SetRoleBase(*r.ko.Spec.LDAPServerMetadata.RoleBase) + f7.RoleBase = r.ko.Spec.LDAPServerMetadata.RoleBase } if r.ko.Spec.LDAPServerMetadata.RoleName != nil { - f6.SetRoleName(*r.ko.Spec.LDAPServerMetadata.RoleName) + f7.RoleName = r.ko.Spec.LDAPServerMetadata.RoleName } if r.ko.Spec.LDAPServerMetadata.RoleSearchMatching != nil { - f6.SetRoleSearchMatching(*r.ko.Spec.LDAPServerMetadata.RoleSearchMatching) + f7.RoleSearchMatching = r.ko.Spec.LDAPServerMetadata.RoleSearchMatching } if r.ko.Spec.LDAPServerMetadata.RoleSearchSubtree != nil { - f6.SetRoleSearchSubtree(*r.ko.Spec.LDAPServerMetadata.RoleSearchSubtree) + f7.RoleSearchSubtree = r.ko.Spec.LDAPServerMetadata.RoleSearchSubtree } if r.ko.Spec.LDAPServerMetadata.ServiceAccountPassword != nil { - f6.SetServiceAccountPassword(*r.ko.Spec.LDAPServerMetadata.ServiceAccountPassword) + f7.ServiceAccountPassword = r.ko.Spec.LDAPServerMetadata.ServiceAccountPassword } if r.ko.Spec.LDAPServerMetadata.ServiceAccountUsername != nil { - f6.SetServiceAccountUsername(*r.ko.Spec.LDAPServerMetadata.ServiceAccountUsername) + f7.ServiceAccountUsername = r.ko.Spec.LDAPServerMetadata.ServiceAccountUsername } if r.ko.Spec.LDAPServerMetadata.UserBase != nil { - f6.SetUserBase(*r.ko.Spec.LDAPServerMetadata.UserBase) + f7.UserBase = r.ko.Spec.LDAPServerMetadata.UserBase } if r.ko.Spec.LDAPServerMetadata.UserRoleName != nil { - f6.SetUserRoleName(*r.ko.Spec.LDAPServerMetadata.UserRoleName) + f7.UserRoleName = r.ko.Spec.LDAPServerMetadata.UserRoleName } if r.ko.Spec.LDAPServerMetadata.UserSearchMatching != nil { - f6.SetUserSearchMatching(*r.ko.Spec.LDAPServerMetadata.UserSearchMatching) + f7.UserSearchMatching = r.ko.Spec.LDAPServerMetadata.UserSearchMatching } if r.ko.Spec.LDAPServerMetadata.UserSearchSubtree != nil { - f6.SetUserSearchSubtree(*r.ko.Spec.LDAPServerMetadata.UserSearchSubtree) + f7.UserSearchSubtree = r.ko.Spec.LDAPServerMetadata.UserSearchSubtree } - res.SetLdapServerMetadata(f6) + res.LdapServerMetadata = f7 } if r.ko.Spec.Logs != nil { - f7 := &svcsdk.Logs{} + f8 := &svcsdktypes.Logs{} if r.ko.Spec.Logs.Audit != nil { - f7.SetAudit(*r.ko.Spec.Logs.Audit) + f8.Audit = r.ko.Spec.Logs.Audit } if r.ko.Spec.Logs.General != nil { - f7.SetGeneral(*r.ko.Spec.Logs.General) + f8.General = r.ko.Spec.Logs.General } - res.SetLogs(f7) + res.Logs = f8 } if r.ko.Spec.MaintenanceWindowStartTime != nil { - f8 := &svcsdk.WeeklyStartTime{} + f9 := &svcsdktypes.WeeklyStartTime{} if r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek != nil { - f8.SetDayOfWeek(*r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek) + f9.DayOfWeek = svcsdktypes.DayOfWeek(*r.ko.Spec.MaintenanceWindowStartTime.DayOfWeek) } if r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay != nil { - f8.SetTimeOfDay(*r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay) + f9.TimeOfDay = r.ko.Spec.MaintenanceWindowStartTime.TimeOfDay } if r.ko.Spec.MaintenanceWindowStartTime.TimeZone != nil { - f8.SetTimeZone(*r.ko.Spec.MaintenanceWindowStartTime.TimeZone) + f9.TimeZone = r.ko.Spec.MaintenanceWindowStartTime.TimeZone } - res.SetMaintenanceWindowStartTime(f8) + res.MaintenanceWindowStartTime = f9 } if r.ko.Spec.SecurityGroups != nil { - f9 := []*string{} - for _, f9iter := range r.ko.Spec.SecurityGroups { - var f9elem string - f9elem = *f9iter - f9 = append(f9, &f9elem) - } - res.SetSecurityGroups(f9) + res.SecurityGroups = aws.ToStringSlice(r.ko.Spec.SecurityGroups) } return res, nil @@ -865,9 +793,9 @@ func (rm *resourceManager) sdkDelete( if err != nil { return nil, err } - var resp *svcsdk.DeleteBrokerResponse + var resp *svcsdk.DeleteBrokerOutput _ = resp - resp, err = rm.sdkapi.DeleteBrokerWithContext(ctx, input) + resp, err = rm.sdkapi.DeleteBroker(ctx, input) rm.metrics.RecordAPICall("DELETE", "DeleteBroker", err) return nil, err } @@ -880,7 +808,7 @@ func (rm *resourceManager) newDeleteRequestPayload( res := &svcsdk.DeleteBrokerInput{} if r.ko.Status.BrokerID != nil { - res.SetBrokerId(*r.ko.Status.BrokerID) + res.BrokerId = r.ko.Status.BrokerID } return res, nil