diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 08877b5..a1c8025 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-23T21:58:23Z" - build_hash: 2442aa071c05fcdf54841e63abd5f91d1951e152 - go_version: go1.23.5 - version: v0.41.0 -api_directory_checksum: 534d27c418bac624a3bc306248291bca1ef6650a + build_date: "2025-01-30T06:24:25Z" + build_hash: c5084b21e423e4ca08cf3dfb1b4e3a05c94c8466 + go_version: go1.22.5 + version: v0.40.0-13-gc5084b2 +api_directory_checksum: 5284854d51404276f1021c283d3b851b0cf7298d api_version: v1alpha1 -aws_sdk_go_version: v1.50.20 +aws_sdk_go_version: v1.32.6 generator_config_info: - file_checksum: 49996cda2d2dbd0e56c884494811b5351910b8dd + file_checksum: 36603534d9a60683b93987da04c2b6a23282b903 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/enums.go b/apis/v1alpha1/enums.go index 54e37b2..fb07349 100644 --- a/apis/v1alpha1/enums.go +++ b/apis/v1alpha1/enums.go @@ -18,98 +18,122 @@ package v1alpha1 type ActionTypeEnum string const ( - ActionTypeEnum_forward ActionTypeEnum = "forward" - ActionTypeEnum_authenticate_oidc ActionTypeEnum = "authenticate-oidc" - ActionTypeEnum_authenticate_cognito ActionTypeEnum = "authenticate-cognito" - ActionTypeEnum_redirect ActionTypeEnum = "redirect" - ActionTypeEnum_fixed_response ActionTypeEnum = "fixed-response" + ActionTypeEnum_AUTHENTICATE_COGNITO ActionTypeEnum = "AUTHENTICATE_COGNITO" + ActionTypeEnum_AUTHENTICATE_OIDC ActionTypeEnum = "AUTHENTICATE_OIDC" + ActionTypeEnum_FIXED_RESPONSE ActionTypeEnum = "FIXED_RESPONSE" + ActionTypeEnum_FORWARD ActionTypeEnum = "FORWARD" + ActionTypeEnum_REDIRECT ActionTypeEnum = "REDIRECT" +) + +type AdvertiseTrustStoreCaNamesEnum string + +const ( + AdvertiseTrustStoreCaNamesEnum_off AdvertiseTrustStoreCaNamesEnum = "off" + AdvertiseTrustStoreCaNamesEnum_on AdvertiseTrustStoreCaNamesEnum = "on" ) type AnomalyResultEnum string const ( - AnomalyResultEnum_anomalous AnomalyResultEnum = "anomalous" - AnomalyResultEnum_normal AnomalyResultEnum = "normal" + AnomalyResultEnum_ANOMALOUS AnomalyResultEnum = "ANOMALOUS" + AnomalyResultEnum_NORMAL AnomalyResultEnum = "NORMAL" ) type AuthenticateCognitoActionConditionalBehaviorEnum string const ( - AuthenticateCognitoActionConditionalBehaviorEnum_deny AuthenticateCognitoActionConditionalBehaviorEnum = "deny" - AuthenticateCognitoActionConditionalBehaviorEnum_allow AuthenticateCognitoActionConditionalBehaviorEnum = "allow" - AuthenticateCognitoActionConditionalBehaviorEnum_authenticate AuthenticateCognitoActionConditionalBehaviorEnum = "authenticate" + AuthenticateCognitoActionConditionalBehaviorEnum_ALLOW AuthenticateCognitoActionConditionalBehaviorEnum = "ALLOW" + AuthenticateCognitoActionConditionalBehaviorEnum_AUTHENTICATE AuthenticateCognitoActionConditionalBehaviorEnum = "AUTHENTICATE" + AuthenticateCognitoActionConditionalBehaviorEnum_DENY AuthenticateCognitoActionConditionalBehaviorEnum = "DENY" ) type AuthenticateOIDCActionConditionalBehaviorEnum string const ( - AuthenticateOIDCActionConditionalBehaviorEnum_deny AuthenticateOIDCActionConditionalBehaviorEnum = "deny" - AuthenticateOIDCActionConditionalBehaviorEnum_allow AuthenticateOIDCActionConditionalBehaviorEnum = "allow" - AuthenticateOIDCActionConditionalBehaviorEnum_authenticate AuthenticateOIDCActionConditionalBehaviorEnum = "authenticate" + AuthenticateOIDCActionConditionalBehaviorEnum_ALLOW AuthenticateOIDCActionConditionalBehaviorEnum = "ALLOW" + AuthenticateOIDCActionConditionalBehaviorEnum_AUTHENTICATE AuthenticateOIDCActionConditionalBehaviorEnum = "AUTHENTICATE" + AuthenticateOIDCActionConditionalBehaviorEnum_DENY AuthenticateOIDCActionConditionalBehaviorEnum = "DENY" +) + +type CapacityReservationStateEnum string + +const ( + CapacityReservationStateEnum_FAILED CapacityReservationStateEnum = "FAILED" + CapacityReservationStateEnum_PENDING CapacityReservationStateEnum = "PENDING" + CapacityReservationStateEnum_PROVISIONED CapacityReservationStateEnum = "PROVISIONED" + CapacityReservationStateEnum_REBALANCING CapacityReservationStateEnum = "REBALANCING" ) type DescribeTargetHealthInputIncludeEnum string const ( - DescribeTargetHealthInputIncludeEnum_AnomalyDetection DescribeTargetHealthInputIncludeEnum = "AnomalyDetection" - DescribeTargetHealthInputIncludeEnum_All DescribeTargetHealthInputIncludeEnum = "All" + DescribeTargetHealthInputIncludeEnum_ALL DescribeTargetHealthInputIncludeEnum = "ALL" + DescribeTargetHealthInputIncludeEnum_ANOMALY DescribeTargetHealthInputIncludeEnum = "ANOMALY" +) + +type EnablePrefixForIPv6SourceNATEnum string + +const ( + EnablePrefixForIPv6SourceNATEnum_OFF EnablePrefixForIPv6SourceNATEnum = "OFF" + EnablePrefixForIPv6SourceNATEnum_ON EnablePrefixForIPv6SourceNATEnum = "ON" ) type EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum string const ( - EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum_on EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum = "on" EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum_off EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum = "off" + EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum_on EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum = "on" ) type IPAddressType string const ( - IPAddressType_ipv4 IPAddressType = "ipv4" - IPAddressType_dualstack IPAddressType = "dualstack" + IPAddressType_DUALSTACK IPAddressType = "DUALSTACK" + IPAddressType_DUALSTACK_WITHOUT_PUBLIC_IPV4 IPAddressType = "DUALSTACK_WITHOUT_PUBLIC_IPV4" + IPAddressType_IPV4 IPAddressType = "IPV4" ) type LoadBalancerSchemeEnum string const ( - LoadBalancerSchemeEnum_internet_facing LoadBalancerSchemeEnum = "internet-facing" - LoadBalancerSchemeEnum_internal LoadBalancerSchemeEnum = "internal" + LoadBalancerSchemeEnum_INTERNAL LoadBalancerSchemeEnum = "INTERNAL" + LoadBalancerSchemeEnum_INTERNET_FACING LoadBalancerSchemeEnum = "INTERNET_FACING" ) type LoadBalancerStateEnum string const ( - LoadBalancerStateEnum_active LoadBalancerStateEnum = "active" - LoadBalancerStateEnum_provisioning LoadBalancerStateEnum = "provisioning" - LoadBalancerStateEnum_active_impaired LoadBalancerStateEnum = "active_impaired" - LoadBalancerStateEnum_failed LoadBalancerStateEnum = "failed" + LoadBalancerStateEnum_ACTIVE LoadBalancerStateEnum = "ACTIVE" + LoadBalancerStateEnum_ACTIVE_IMPAIRED LoadBalancerStateEnum = "ACTIVE_IMPAIRED" + LoadBalancerStateEnum_FAILED LoadBalancerStateEnum = "FAILED" + LoadBalancerStateEnum_PROVISIONING LoadBalancerStateEnum = "PROVISIONING" ) type LoadBalancerTypeEnum string const ( - LoadBalancerTypeEnum_application LoadBalancerTypeEnum = "application" - LoadBalancerTypeEnum_network LoadBalancerTypeEnum = "network" - LoadBalancerTypeEnum_gateway LoadBalancerTypeEnum = "gateway" + LoadBalancerTypeEnum_APPLICATION LoadBalancerTypeEnum = "APPLICATION" + LoadBalancerTypeEnum_GATEWAY LoadBalancerTypeEnum = "GATEWAY" + LoadBalancerTypeEnum_NETWORK LoadBalancerTypeEnum = "NETWORK" ) type MitigationInEffectEnum string const ( - MitigationInEffectEnum_yes MitigationInEffectEnum = "yes" - MitigationInEffectEnum_no MitigationInEffectEnum = "no" + MitigationInEffectEnum_NO MitigationInEffectEnum = "NO" + MitigationInEffectEnum_YES MitigationInEffectEnum = "YES" ) type ProtocolEnum string const ( + ProtocolEnum_GENEVE ProtocolEnum = "GENEVE" ProtocolEnum_HTTP ProtocolEnum = "HTTP" ProtocolEnum_HTTPS ProtocolEnum = "HTTPS" ProtocolEnum_TCP ProtocolEnum = "TCP" + ProtocolEnum_TCP_UDP ProtocolEnum = "TCP_UDP" ProtocolEnum_TLS ProtocolEnum = "TLS" ProtocolEnum_UDP ProtocolEnum = "UDP" - ProtocolEnum_TCP_UDP ProtocolEnum = "TCP_UDP" - ProtocolEnum_GENEVE ProtocolEnum = "GENEVE" ) type RedirectActionStatusCodeEnum string @@ -125,49 +149,74 @@ const ( RevocationType_CRL RevocationType = "CRL" ) +type TargetAdministrativeOverrideReasonEnum string + +const ( + TargetAdministrativeOverrideReasonEnum_INTERNAL_ERROR TargetAdministrativeOverrideReasonEnum = "INTERNAL_ERROR" + TargetAdministrativeOverrideReasonEnum_NO_OVERRIDE_ENGAGED TargetAdministrativeOverrideReasonEnum = "NO_OVERRIDE_ENGAGED" + TargetAdministrativeOverrideReasonEnum_ZONAL_SHIFT_DELEGATED_TO_DNS TargetAdministrativeOverrideReasonEnum = "ZONAL_SHIFT_DELEGATED_TO_DNS" + TargetAdministrativeOverrideReasonEnum_ZONAL_SHIFT_ENGAGED TargetAdministrativeOverrideReasonEnum = "ZONAL_SHIFT_ENGAGED" +) + +type TargetAdministrativeOverrideStateEnum string + +const ( + TargetAdministrativeOverrideStateEnum_NO_OVERRIDE TargetAdministrativeOverrideStateEnum = "NO_OVERRIDE" + TargetAdministrativeOverrideStateEnum_UNKNOWN TargetAdministrativeOverrideStateEnum = "UNKNOWN" + TargetAdministrativeOverrideStateEnum_ZONAL_SHIFT_ACTIVE TargetAdministrativeOverrideStateEnum = "ZONAL_SHIFT_ACTIVE" + TargetAdministrativeOverrideStateEnum_ZONAL_SHIFT_DELEGATED_TO_DNS TargetAdministrativeOverrideStateEnum = "ZONAL_SHIFT_DELEGATED_TO_DNS" +) + type TargetGroupIPAddressTypeEnum string const ( - TargetGroupIPAddressTypeEnum_ipv4 TargetGroupIPAddressTypeEnum = "ipv4" - TargetGroupIPAddressTypeEnum_ipv6 TargetGroupIPAddressTypeEnum = "ipv6" + TargetGroupIPAddressTypeEnum_IPV4 TargetGroupIPAddressTypeEnum = "IPV4" + TargetGroupIPAddressTypeEnum_IPV6 TargetGroupIPAddressTypeEnum = "IPV6" ) type TargetHealthReasonEnum string const ( - TargetHealthReasonEnum_Elb_RegistrationInProgress TargetHealthReasonEnum = "Elb.RegistrationInProgress" - TargetHealthReasonEnum_Elb_InitialHealthChecking TargetHealthReasonEnum = "Elb.InitialHealthChecking" - TargetHealthReasonEnum_Target_ResponseCodeMismatch TargetHealthReasonEnum = "Target.ResponseCodeMismatch" - TargetHealthReasonEnum_Target_Timeout TargetHealthReasonEnum = "Target.Timeout" - TargetHealthReasonEnum_Target_FailedHealthChecks TargetHealthReasonEnum = "Target.FailedHealthChecks" - TargetHealthReasonEnum_Target_NotRegistered TargetHealthReasonEnum = "Target.NotRegistered" - TargetHealthReasonEnum_Target_NotInUse TargetHealthReasonEnum = "Target.NotInUse" - TargetHealthReasonEnum_Target_DeregistrationInProgress TargetHealthReasonEnum = "Target.DeregistrationInProgress" - TargetHealthReasonEnum_Target_InvalidState TargetHealthReasonEnum = "Target.InvalidState" - TargetHealthReasonEnum_Target_IpUnusable TargetHealthReasonEnum = "Target.IpUnusable" - TargetHealthReasonEnum_Target_HealthCheckDisabled TargetHealthReasonEnum = "Target.HealthCheckDisabled" - TargetHealthReasonEnum_Elb_InternalError TargetHealthReasonEnum = "Elb.InternalError" + TargetHealthReasonEnum_DEREGISTRATION_IN_PROGRESS TargetHealthReasonEnum = "DEREGISTRATION_IN_PROGRESS" + TargetHealthReasonEnum_FAILED_HEALTH_CHECKS TargetHealthReasonEnum = "FAILED_HEALTH_CHECKS" + TargetHealthReasonEnum_HEALTH_CHECK_DISABLED TargetHealthReasonEnum = "HEALTH_CHECK_DISABLED" + TargetHealthReasonEnum_INITIAL_HEALTH_CHECKING TargetHealthReasonEnum = "INITIAL_HEALTH_CHECKING" + TargetHealthReasonEnum_INTERNAL_ERROR TargetHealthReasonEnum = "INTERNAL_ERROR" + TargetHealthReasonEnum_INVALID_STATE TargetHealthReasonEnum = "INVALID_STATE" + TargetHealthReasonEnum_IP_UNUSABLE TargetHealthReasonEnum = "IP_UNUSABLE" + TargetHealthReasonEnum_NOT_IN_USE TargetHealthReasonEnum = "NOT_IN_USE" + TargetHealthReasonEnum_NOT_REGISTERED TargetHealthReasonEnum = "NOT_REGISTERED" + TargetHealthReasonEnum_REGISTRATION_IN_PROGRESS TargetHealthReasonEnum = "REGISTRATION_IN_PROGRESS" + TargetHealthReasonEnum_RESPONSE_CODE_MISMATCH TargetHealthReasonEnum = "RESPONSE_CODE_MISMATCH" + TargetHealthReasonEnum_TIMEOUT TargetHealthReasonEnum = "TIMEOUT" ) type TargetHealthStateEnum string const ( - TargetHealthStateEnum_initial TargetHealthStateEnum = "initial" - TargetHealthStateEnum_healthy TargetHealthStateEnum = "healthy" - TargetHealthStateEnum_unhealthy TargetHealthStateEnum = "unhealthy" - TargetHealthStateEnum_unhealthy_draining TargetHealthStateEnum = "unhealthy.draining" - TargetHealthStateEnum_unused TargetHealthStateEnum = "unused" - TargetHealthStateEnum_draining TargetHealthStateEnum = "draining" - TargetHealthStateEnum_unavailable TargetHealthStateEnum = "unavailable" + TargetHealthStateEnum_DRAINING TargetHealthStateEnum = "DRAINING" + TargetHealthStateEnum_HEALTHY TargetHealthStateEnum = "HEALTHY" + TargetHealthStateEnum_INITIAL TargetHealthStateEnum = "INITIAL" + TargetHealthStateEnum_UNAVAILABLE TargetHealthStateEnum = "UNAVAILABLE" + TargetHealthStateEnum_UNHEALTHY TargetHealthStateEnum = "UNHEALTHY" + TargetHealthStateEnum_UNHEALTHY_DRAINING TargetHealthStateEnum = "UNHEALTHY_DRAINING" + TargetHealthStateEnum_UNUSED TargetHealthStateEnum = "UNUSED" ) type TargetTypeEnum string const ( - TargetTypeEnum_instance TargetTypeEnum = "instance" - TargetTypeEnum_ip TargetTypeEnum = "ip" - TargetTypeEnum_lambda TargetTypeEnum = "lambda" - TargetTypeEnum_alb TargetTypeEnum = "alb" + TargetTypeEnum_ALB TargetTypeEnum = "ALB" + TargetTypeEnum_INSTANCE TargetTypeEnum = "INSTANCE" + TargetTypeEnum_IP TargetTypeEnum = "IP" + TargetTypeEnum_LAMBDA TargetTypeEnum = "LAMBDA" +) + +type TrustStoreAssociationStatusEnum string + +const ( + TrustStoreAssociationStatusEnum_ACTIVE TrustStoreAssociationStatusEnum = "ACTIVE" + TrustStoreAssociationStatusEnum_REMOVED TrustStoreAssociationStatusEnum = "REMOVED" ) type TrustStoreStatus string diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 4dbcafb..d73d52d 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -8,7 +8,8 @@ ignore: field_paths: - DescribeLoadBalancersOutput.NextMarker sdk_names: - model_name: elasticloadbalancingv2 + model_name: elastic-load-balancing-v2 + package_name: elasticloadbalancingv2 operations: DescribeLoadBalancers: operation_type: @@ -108,11 +109,10 @@ resources: exceptions: errors: 404: - code: LoadBalancerNotFound + code: LoadBalancerNotFoundException terminal_codes: - - ValidationError - - InvalidConfigurationRequest - - InvalidScheme + - InvalidConfigurationRequestException + - InvalidSchemeException hooks: delta_pre_compare: code: customPreCompare(delta, a, b) @@ -139,17 +139,15 @@ resources: exceptions: errors: 404: - code: ListenerNotFound + code: ListenerNotFoundException terminal_codes: - - ValidationError - - ALPNPolicyNotFound - - DuplicateListener - - IncompatibleProtocols - - InvalidConfigurationRequest - - InvalidLoadBalancerAction - - SSLPolicyNotFound - - UnsupportedProtocol - - InvalidParameter + - ALPNPolicyNotSupportedException + - DuplicateListenerException + - IncompatibleProtocolsException + - InvalidConfigurationRequestException + - InvalidLoadBalancerActionException + - SSLPolicyNotFoundException + - UnsupportedProtocolException tags: ignore: true hooks: @@ -182,9 +180,9 @@ resources: exceptions: errors: 404: - code: TargetGroupNotFound + code: TargetGroupNotFoundException terminal_codes: - - InvalidConfigurationRequest + - InvalidConfigurationRequestException tags: ignore: true renames: @@ -212,12 +210,12 @@ resources: exceptions: errors: 404: - code: RuleNotFound + code: RuleNotFoundException terminal_codes: - - InvalidConfigurationRequest - - IncompatibleProtocols - - UnsupportedProtocol - - InvalidLoadBalancerAction + - InvalidConfigurationRequestException + - IncompatibleProtocolsException + - UnsupportedProtocolException + - InvalidLoadBalancerActionException tags: ignore: true hooks: @@ -226,4 +224,4 @@ resources: sdk_update_pre_build_request: template_path: hooks/rule/sdk_update_pre_build_request.go.tpl sdk_read_many_post_set_output: - template_path: hooks/rule/sdk_read_many_post_set_output.go.tpl \ No newline at end of file + template_path: hooks/rule/sdk_read_many_post_set_output.go.tpl diff --git a/apis/v1alpha1/listener.go b/apis/v1alpha1/listener.go index 9e60bd5..d14da53 100644 --- a/apis/v1alpha1/listener.go +++ b/apis/v1alpha1/listener.go @@ -53,13 +53,13 @@ type ListenerSpec struct { LoadBalancerRef *ackv1alpha1.AWSResourceReferenceWrapper `json:"loadBalancerRef,omitempty"` // The mutual authentication configuration information. MutualAuthentication *MutualAuthenticationAttributes `json:"mutualAuthentication,omitempty"` - // The port on which the load balancer is listening. You cannot specify a port + // The port on which the load balancer is listening. You can't specify a port // for a Gateway Load Balancer. Port *int64 `json:"port,omitempty"` // The protocol for connections from clients to the load balancer. For Application // Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load // Balancers, the supported protocols are TCP, TLS, UDP, and TCP_UDP. You can’t - // specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You cannot + // specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You can't // specify a protocol for a Gateway Load Balancer. Protocol *string `json:"protocol,omitempty"` // [HTTPS and TLS listeners] The security policy that defines which protocols diff --git a/apis/v1alpha1/load_balancer.go b/apis/v1alpha1/load_balancer.go index 0976205..8a0fc37 100644 --- a/apis/v1alpha1/load_balancer.go +++ b/apis/v1alpha1/load_balancer.go @@ -30,9 +30,18 @@ type LoadBalancerSpec struct { // [Application Load Balancers on Outposts] The ID of the customer-owned address // pool (CoIP pool). CustomerOwnedIPv4Pool *string `json:"customerOwnedIPv4Pool,omitempty"` - // The type of IP addresses used by the subnets for your load balancer. The - // possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and - // IPv6 addresses). + // [Network Load Balancers with UDP listeners] Indicates whether to use an IPv6 + // prefix from each subnet for source NAT. The IP address type must be dualstack. + // The default value is off. + EnablePrefixForIPv6SourceNAT *string `json:"enablePrefixForIPv6SourceNAT,omitempty"` + // The IP address type. Internal load balancers must use ipv4. + // + // [Application Load Balancers] The possible values are ipv4 (IPv4 addresses), + // dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public + // IPv6 addresses and private IPv4 and IPv6 addresses). + // + // [Network Load Balancers and Gateway Load Balancers] The possible values are + // ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses). IPAddressType *string `json:"ipAddressType,omitempty"` // The name of the load balancer. // @@ -52,7 +61,7 @@ type LoadBalancerSpec struct { // // The default is an Internet-facing load balancer. // - // You cannot specify a scheme for a Gateway Load Balancer. + // You can't specify a scheme for a Gateway Load Balancer. Scheme *string `json:"scheme,omitempty"` SecurityGroupRefs []*ackv1alpha1.AWSResourceReferenceWrapper `json:"securityGroupRefs,omitempty"` // [Application Load Balancers and Network Load Balancers] The IDs of the security @@ -62,7 +71,7 @@ type LoadBalancerSpec struct { // Zone. You must specify either subnets or subnet mappings, but not both. // // [Application Load Balancers] You must specify subnets from at least two Availability - // Zones. You cannot specify Elastic IP addresses for your subnets. + // Zones. You can't specify Elastic IP addresses for your subnets. // // [Application Load Balancers on Outposts] You must specify one Outpost subnet. // @@ -77,7 +86,7 @@ type LoadBalancerSpec struct { // per subnet. // // [Gateway Load Balancers] You can specify subnets from one or more Availability - // Zones. You cannot specify Elastic IP addresses for your subnets. + // Zones. You can't specify Elastic IP addresses for your subnets. SubnetMappings []*SubnetMapping `json:"subnetMappings,omitempty"` SubnetRefs []*ackv1alpha1.AWSResourceReferenceWrapper `json:"subnetRefs,omitempty"` // The IDs of the subnets. You can specify only one subnet per Availability @@ -92,11 +101,8 @@ type LoadBalancerSpec struct { // [Application Load Balancers on Local Zones] You can specify subnets from // one or more Local Zones. // - // [Network Load Balancers] You can specify subnets from one or more Availability - // Zones. - // - // [Gateway Load Balancers] You can specify subnets from one or more Availability - // Zones. + // [Network Load Balancers and Gateway Load Balancers] You can specify subnets + // from one or more Availability Zones. Subnets []*string `json:"subnets,omitempty"` // The tags to assign to the load balancer. Tags []*Tag `json:"tags,omitempty"` diff --git a/apis/v1alpha1/target_group.go b/apis/v1alpha1/target_group.go index 425af6f..5ad64c4 100644 --- a/apis/v1alpha1/target_group.go +++ b/apis/v1alpha1/target_group.go @@ -27,7 +27,7 @@ type TargetGroupSpec struct { // Indicates whether health checks are enabled. If the target type is lambda, // health checks are disabled by default but can be enabled. If the target type - // is instance, ip, or alb, health checks are always enabled and cannot be disabled. + // is instance, ip, or alb, health checks are always enabled and can't be disabled. HealthCheckEnabled *bool `json:"healthCheckEnabled,omitempty"` // The approximate amount of time, in seconds, between health checks of an individual // target. The range is 5-300. If the target group protocol is TCP, TLS, UDP, @@ -66,9 +66,7 @@ type TargetGroupSpec struct { // a protocol of GENEVE, the default is 5. If the target type is lambda, the // default is 5. HealthyThresholdCount *int64 `json:"healthyThresholdCount,omitempty"` - // The type of IP address used for this target group. The possible values are - // ipv4 and ipv6. This is an optional parameter. If not specified, the IP address - // type defaults to ipv4. + // The IP address type. The default value is ipv4. IPAddressType *string `json:"ipAddressType,omitempty"` // [HTTP/HTTPS health checks] The HTTP or gRPC codes to use when checking for // a successful response from a target. For target groups with a protocol of diff --git a/apis/v1alpha1/types.go b/apis/v1alpha1/types.go index dab0433..ceff681 100644 --- a/apis/v1alpha1/types.go +++ b/apis/v1alpha1/types.go @@ -106,10 +106,16 @@ type AuthenticateOIDCActionConfig struct { type AvailabilityZone struct { LoadBalancerAddresses []*LoadBalancerAddress `json:"loadBalancerAddresses,omitempty"` OutpostID *string `json:"outpostID,omitempty"` + SourceNATIPv6Prefixes []*string `json:"sourceNATIPv6Prefixes,omitempty"` SubnetID *string `json:"subnetID,omitempty"` ZoneName *string `json:"zoneName,omitempty"` } +// The status of a capacity reservation. +type CapacityReservationStatus struct { + Reason *string `json:"reason,omitempty"` +} + // Information about an SSL server certificate. type Certificate struct { CertificateARN *string `json:"certificateARN,omitempty"` @@ -199,6 +205,7 @@ type LoadBalancer_SDK struct { CreatedTime *metav1.Time `json:"createdTime,omitempty"` CustomerOwnedIPv4Pool *string `json:"customerOwnedIPv4Pool,omitempty"` DNSName *string `json:"dnsName,omitempty"` + EnablePrefixForIPv6SourceNAT *string `json:"enablePrefixForIPv6SourceNAT,omitempty"` EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic *string `json:"enforceSecurityGroupInboundRulesOnPrivateLinkTraffic,omitempty"` IPAddressType *string `json:"ipAddressType,omitempty"` LoadBalancerARN *string `json:"loadBalancerARN,omitempty"` @@ -221,9 +228,11 @@ type Matcher struct { // Information about the mutual authentication attributes of a listener. type MutualAuthenticationAttributes struct { + AdvertiseTrustStoreCaNames *string `json:"advertiseTrustStoreCaNames,omitempty"` IgnoreClientCertificateExpiry *bool `json:"ignoreClientCertificateExpiry,omitempty"` Mode *string `json:"mode,omitempty"` TrustStoreARN *string `json:"trustStoreARN,omitempty"` + TrustStoreAssociationStatus *string `json:"trustStoreAssociationStatus,omitempty"` } // Information about a path pattern condition. @@ -282,8 +291,8 @@ type RedirectActionConfig struct { // Each rule can optionally include up to one of each of the following conditions: // http-request-method, host-header, path-pattern, and source-ip. Each rule // can also optionally include one or more of each of the following conditions: -// http-header and query-string. Note that the value for a condition cannot -// be empty. +// http-header and query-string. Note that the value for a condition can't be +// empty. // // For more information, see Quotas for your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html). type RuleCondition struct { @@ -351,10 +360,11 @@ type SourceIPConditionConfig struct { // Information about a subnet mapping. type SubnetMapping struct { - AllocationID *string `json:"allocationID,omitempty"` - IPv6Address *string `json:"ipv6Address,omitempty"` - PrivateIPv4Address *string `json:"privateIPv4Address,omitempty"` - SubnetID *string `json:"subnetID,omitempty"` + AllocationID *string `json:"allocationID,omitempty"` + IPv6Address *string `json:"ipv6Address,omitempty"` + PrivateIPv4Address *string `json:"privateIPv4Address,omitempty"` + SourceNATIPv6Prefix *string `json:"sourceNATIPv6Prefix,omitempty"` + SubnetID *string `json:"subnetID,omitempty"` // Reference field for SubnetID SubnetRef *ackv1alpha1.AWSResourceReferenceWrapper `json:"subnetRef,omitempty"` } @@ -433,3 +443,8 @@ type TrustStore struct { type TrustStoreRevocation struct { TrustStoreARN *string `json:"trustStoreARN,omitempty"` } + +// The capacity reservation status for each availability zone. +type ZonalCapacityReservationState struct { + AvailabilityZone *string `json:"availabilityZone,omitempty"` +} diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index d0bd763..8f1c205 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -255,6 +255,17 @@ func (in *AvailabilityZone) DeepCopyInto(out *AvailabilityZone) { *out = new(string) **out = **in } + if in.SourceNATIPv6Prefixes != nil { + in, out := &in.SourceNATIPv6Prefixes, &out.SourceNATIPv6Prefixes + *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.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) @@ -277,6 +288,26 @@ func (in *AvailabilityZone) DeepCopy() *AvailabilityZone { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CapacityReservationStatus) DeepCopyInto(out *CapacityReservationStatus) { + *out = *in + if in.Reason != nil { + in, out := &in.Reason, &out.Reason + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CapacityReservationStatus. +func (in *CapacityReservationStatus) DeepCopy() *CapacityReservationStatus { + if in == nil { + return nil + } + out := new(CapacityReservationStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Certificate) DeepCopyInto(out *Certificate) { *out = *in @@ -861,6 +892,11 @@ func (in *LoadBalancerSpec) DeepCopyInto(out *LoadBalancerSpec) { *out = new(string) **out = **in } + if in.EnablePrefixForIPv6SourceNAT != nil { + in, out := &in.EnablePrefixForIPv6SourceNAT, &out.EnablePrefixForIPv6SourceNAT + *out = new(string) + **out = **in + } if in.IPAddressType != nil { in, out := &in.IPAddressType, &out.IPAddressType *out = new(string) @@ -1088,6 +1124,11 @@ func (in *LoadBalancer_SDK) DeepCopyInto(out *LoadBalancer_SDK) { *out = new(string) **out = **in } + if in.EnablePrefixForIPv6SourceNAT != nil { + in, out := &in.EnablePrefixForIPv6SourceNAT, &out.EnablePrefixForIPv6SourceNAT + *out = new(string) + **out = **in + } if in.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic != nil { in, out := &in.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic, &out.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic *out = new(string) @@ -1179,6 +1220,11 @@ func (in *Matcher) DeepCopy() *Matcher { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MutualAuthenticationAttributes) DeepCopyInto(out *MutualAuthenticationAttributes) { *out = *in + if in.AdvertiseTrustStoreCaNames != nil { + in, out := &in.AdvertiseTrustStoreCaNames, &out.AdvertiseTrustStoreCaNames + *out = new(string) + **out = **in + } if in.IgnoreClientCertificateExpiry != nil { in, out := &in.IgnoreClientCertificateExpiry, &out.IgnoreClientCertificateExpiry *out = new(bool) @@ -1194,6 +1240,11 @@ func (in *MutualAuthenticationAttributes) DeepCopyInto(out *MutualAuthentication *out = new(string) **out = **in } + if in.TrustStoreAssociationStatus != nil { + in, out := &in.TrustStoreAssociationStatus, &out.TrustStoreAssociationStatus + *out = new(string) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MutualAuthenticationAttributes. @@ -1699,6 +1750,11 @@ func (in *SubnetMapping) DeepCopyInto(out *SubnetMapping) { *out = new(string) **out = **in } + if in.SourceNATIPv6Prefix != nil { + in, out := &in.SourceNATIPv6Prefix, &out.SourceNATIPv6Prefix + *out = new(string) + **out = **in + } if in.SubnetID != nil { in, out := &in.SubnetID, &out.SubnetID *out = new(string) @@ -2255,3 +2311,23 @@ func (in *TrustStoreRevocation) DeepCopy() *TrustStoreRevocation { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ZonalCapacityReservationState) DeepCopyInto(out *ZonalCapacityReservationState) { + *out = *in + if in.AvailabilityZone != nil { + in, out := &in.AvailabilityZone, &out.AvailabilityZone + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ZonalCapacityReservationState. +func (in *ZonalCapacityReservationState) DeepCopy() *ZonalCapacityReservationState { + if in == nil { + return nil + } + out := new(ZonalCapacityReservationState) + in.DeepCopyInto(out) + return out +} diff --git a/cmd/controller/main.go b/cmd/controller/main.go index e122b11..0818c1e 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -16,9 +16,11 @@ package main import ( + "context" "os" ec2apitypes "github.com/aws-controllers-k8s/ec2-controller/apis/v1alpha1" + elbv2apitypes "github.com/aws-controllers-k8s/elbv2-controller/apis/v1alpha1" ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" ackcfg "github.com/aws-controllers-k8s/runtime/pkg/config" ackrt "github.com/aws-controllers-k8s/runtime/pkg/runtime" @@ -38,7 +40,6 @@ import ( svctypes "github.com/aws-controllers-k8s/elbv2-controller/apis/v1alpha1" svcresource "github.com/aws-controllers-k8s/elbv2-controller/pkg/resource" - svcsdk "github.com/aws/aws-sdk-go/service/elbv2" _ "github.com/aws-controllers-k8s/elbv2-controller/pkg/resource/listener" _ "github.com/aws-controllers-k8s/elbv2-controller/pkg/resource/load_balancer" @@ -49,11 +50,10 @@ import ( ) var ( - awsServiceAPIGroup = "elbv2.services.k8s.aws" - awsServiceAlias = "elbv2" - awsServiceEndpointsID = svcsdk.EndpointsID - scheme = runtime.NewScheme() - setupLog = ctrlrt.Log.WithName("setup") + awsServiceAPIGroup = "elbv2.services.k8s.aws" + awsServiceAlias = "elbv2" + scheme = runtime.NewScheme() + setupLog = ctrlrt.Log.WithName("setup") ) func init() { @@ -62,6 +62,7 @@ func init() { _ = svctypes.AddToScheme(scheme) _ = ackv1alpha1.AddToScheme(scheme) _ = ec2apitypes.AddToScheme(scheme) + _ = elbv2apitypes.AddToScheme(scheme) } func main() { @@ -76,7 +77,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, @@ -141,7 +143,7 @@ func main() { "aws.service", awsServiceAlias, ) sc := ackrt.NewServiceController( - awsServiceAlias, awsServiceAPIGroup, awsServiceEndpointsID, + awsServiceAlias, awsServiceAPIGroup, acktypes.VersionInfo{ version.GitCommit, version.GitVersion, diff --git a/config/controller/kustomization.yaml b/config/controller/kustomization.yaml index 7254f3a..c205508 100644 --- a/config/controller/kustomization.yaml +++ b/config/controller/kustomization.yaml @@ -6,4 +6,4 @@ kind: Kustomization images: - name: controller newName: public.ecr.aws/aws-controllers-k8s/elbv2-controller - newTag: 1.0.3 + newTag: 0.0.0-non-release-version diff --git a/config/crd/bases/elbv2.services.k8s.aws_listeners.yaml b/config/crd/bases/elbv2.services.k8s.aws_listeners.yaml index aa57e30..87d5e59 100644 --- a/config/crd/bases/elbv2.services.k8s.aws_listeners.yaml +++ b/config/crd/bases/elbv2.services.k8s.aws_listeners.yaml @@ -278,16 +278,20 @@ spec: mutualAuthentication: description: The mutual authentication configuration information. properties: + advertiseTrustStoreCaNames: + type: string ignoreClientCertificateExpiry: type: boolean mode: type: string trustStoreARN: type: string + trustStoreAssociationStatus: + type: string type: object port: description: |- - The port on which the load balancer is listening. You cannot specify a port + The port on which the load balancer is listening. You can't specify a port for a Gateway Load Balancer. format: int64 type: integer @@ -296,7 +300,7 @@ spec: The protocol for connections from clients to the load balancer. For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, and TCP_UDP. You can’t - specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You cannot + specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You can't specify a protocol for a Gateway Load Balancer. type: string sslPolicy: diff --git a/config/crd/bases/elbv2.services.k8s.aws_loadbalancers.yaml b/config/crd/bases/elbv2.services.k8s.aws_loadbalancers.yaml index 6c52068..bbd9567 100644 --- a/config/crd/bases/elbv2.services.k8s.aws_loadbalancers.yaml +++ b/config/crd/bases/elbv2.services.k8s.aws_loadbalancers.yaml @@ -58,11 +58,22 @@ spec: [Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool). type: string + enablePrefixForIPv6SourceNAT: + description: |- + [Network Load Balancers with UDP listeners] Indicates whether to use an IPv6 + prefix from each subnet for source NAT. The IP address type must be dualstack. + The default value is off. + type: string ipAddressType: description: |- - The type of IP addresses used by the subnets for your load balancer. The - possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and - IPv6 addresses). + The IP address type. Internal load balancers must use ipv4. + + [Application Load Balancers] The possible values are ipv4 (IPv4 addresses), + dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public + IPv6 addresses and private IPv4 and IPv6 addresses). + + [Network Load Balancers and Gateway Load Balancers] The possible values are + ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses). type: string name: description: |- @@ -86,7 +97,7 @@ spec: The default is an Internet-facing load balancer. - You cannot specify a scheme for a Gateway Load Balancer. + You can't specify a scheme for a Gateway Load Balancer. type: string securityGroupRefs: items: @@ -120,7 +131,7 @@ spec: Zone. You must specify either subnets or subnet mappings, but not both. [Application Load Balancers] You must specify subnets from at least two Availability - Zones. You cannot specify Elastic IP addresses for your subnets. + Zones. You can't specify Elastic IP addresses for your subnets. [Application Load Balancers on Outposts] You must specify one Outpost subnet. @@ -135,7 +146,7 @@ spec: per subnet. [Gateway Load Balancers] You can specify subnets from one or more Availability - Zones. You cannot specify Elastic IP addresses for your subnets. + Zones. You can't specify Elastic IP addresses for your subnets. items: description: Information about a subnet mapping. properties: @@ -145,6 +156,8 @@ spec: type: string privateIPv4Address: type: string + sourceNATIPv6Prefix: + type: string subnetID: type: string subnetRef: @@ -196,11 +209,8 @@ spec: [Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones. - [Network Load Balancers] You can specify subnets from one or more Availability - Zones. - - [Gateway Load Balancers] You can specify subnets from one or more Availability - Zones. + [Network Load Balancers and Gateway Load Balancers] You can specify subnets + from one or more Availability Zones. items: type: string type: array @@ -273,6 +283,10 @@ spec: type: array outpostID: type: string + sourceNATIPv6Prefixes: + items: + type: string + type: array subnetID: type: string zoneName: diff --git a/config/crd/bases/elbv2.services.k8s.aws_rules.yaml b/config/crd/bases/elbv2.services.k8s.aws_rules.yaml index e22832d..0b8c9c5 100644 --- a/config/crd/bases/elbv2.services.k8s.aws_rules.yaml +++ b/config/crd/bases/elbv2.services.k8s.aws_rules.yaml @@ -230,8 +230,8 @@ spec: Each rule can optionally include up to one of each of the following conditions: http-request-method, host-header, path-pattern, and source-ip. Each rule can also optionally include one or more of each of the following conditions: - http-header and query-string. Note that the value for a condition cannot - be empty. + http-header and query-string. Note that the value for a condition can't be + empty. For more information, see Quotas for your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html). properties: diff --git a/config/crd/bases/elbv2.services.k8s.aws_targetgroups.yaml b/config/crd/bases/elbv2.services.k8s.aws_targetgroups.yaml index 1fe3b94..0c80652 100644 --- a/config/crd/bases/elbv2.services.k8s.aws_targetgroups.yaml +++ b/config/crd/bases/elbv2.services.k8s.aws_targetgroups.yaml @@ -46,7 +46,7 @@ spec: description: |- Indicates whether health checks are enabled. If the target type is lambda, health checks are disabled by default but can be enabled. If the target type - is instance, ip, or alb, health checks are always enabled and cannot be disabled. + is instance, ip, or alb, health checks are always enabled and can't be disabled. type: boolean healthCheckIntervalSeconds: description: |- @@ -101,10 +101,7 @@ spec: format: int64 type: integer ipAddressType: - description: |- - The type of IP address used for this target group. The possible values are - ipv4 and ipv6. This is an optional parameter. If not specified, the IP address - type defaults to ipv4. + description: The IP address type. The default value is ipv4. type: string matcher: description: |- diff --git a/config/rbac/cluster-role-controller.yaml b/config/rbac/cluster-role-controller.yaml index f6d4b46..ce7ee7f 100644 --- a/config/rbac/cluster-role-controller.yaml +++ b/config/rbac/cluster-role-controller.yaml @@ -54,10 +54,18 @@ rules: resources: - listeners/status - loadbalancers/status - - rules/status - targetgroups/status verbs: - get + - list + - patch + - update +- apiGroups: + - elbv2.services.k8s.aws + resources: + - rules/status + verbs: + - get - patch - update - apiGroups: diff --git a/generator.yaml b/generator.yaml index 4dbcafb..d73d52d 100644 --- a/generator.yaml +++ b/generator.yaml @@ -8,7 +8,8 @@ ignore: field_paths: - DescribeLoadBalancersOutput.NextMarker sdk_names: - model_name: elasticloadbalancingv2 + model_name: elastic-load-balancing-v2 + package_name: elasticloadbalancingv2 operations: DescribeLoadBalancers: operation_type: @@ -108,11 +109,10 @@ resources: exceptions: errors: 404: - code: LoadBalancerNotFound + code: LoadBalancerNotFoundException terminal_codes: - - ValidationError - - InvalidConfigurationRequest - - InvalidScheme + - InvalidConfigurationRequestException + - InvalidSchemeException hooks: delta_pre_compare: code: customPreCompare(delta, a, b) @@ -139,17 +139,15 @@ resources: exceptions: errors: 404: - code: ListenerNotFound + code: ListenerNotFoundException terminal_codes: - - ValidationError - - ALPNPolicyNotFound - - DuplicateListener - - IncompatibleProtocols - - InvalidConfigurationRequest - - InvalidLoadBalancerAction - - SSLPolicyNotFound - - UnsupportedProtocol - - InvalidParameter + - ALPNPolicyNotSupportedException + - DuplicateListenerException + - IncompatibleProtocolsException + - InvalidConfigurationRequestException + - InvalidLoadBalancerActionException + - SSLPolicyNotFoundException + - UnsupportedProtocolException tags: ignore: true hooks: @@ -182,9 +180,9 @@ resources: exceptions: errors: 404: - code: TargetGroupNotFound + code: TargetGroupNotFoundException terminal_codes: - - InvalidConfigurationRequest + - InvalidConfigurationRequestException tags: ignore: true renames: @@ -212,12 +210,12 @@ resources: exceptions: errors: 404: - code: RuleNotFound + code: RuleNotFoundException terminal_codes: - - InvalidConfigurationRequest - - IncompatibleProtocols - - UnsupportedProtocol - - InvalidLoadBalancerAction + - InvalidConfigurationRequestException + - IncompatibleProtocolsException + - UnsupportedProtocolException + - InvalidLoadBalancerActionException tags: ignore: true hooks: @@ -226,4 +224,4 @@ resources: sdk_update_pre_build_request: template_path: hooks/rule/sdk_update_pre_build_request.go.tpl sdk_read_many_post_set_output: - template_path: hooks/rule/sdk_read_many_post_set_output.go.tpl \ No newline at end of file + template_path: hooks/rule/sdk_read_many_post_set_output.go.tpl diff --git a/go.mod b/go.mod index a89e869..7e01417 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,8 @@ require ( github.com/aws-controllers-k8s/ec2-controller v1.2.4 github.com/aws-controllers-k8s/runtime v0.41.0 github.com/aws/aws-sdk-go v1.50.20 + github.com/aws/aws-sdk-go-v2 v1.34.0 + github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.8 github.com/go-logr/logr v1.4.2 github.com/spf13/pflag v1.0.5 k8s.io/api v0.31.0 @@ -17,6 +19,18 @@ 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/aws/smithy-go v1.22.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 @@ -76,3 +90,5 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) + +replace github.com/aws-controllers-k8s/runtime => github.com/michaelhtm/ack-runtime v0.40.1-0.20250128172628-d6fa812b5fbd diff --git a/go.sum b/go.sum index a91f441..9265980 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,35 @@ github.com/aws-controllers-k8s/ec2-controller v1.2.4 h1:lLm/jH4Zmylykuyjo/P8lgHYCdu4do+apX8A34cA0Rk= github.com/aws-controllers-k8s/ec2-controller v1.2.4/go.mod h1:d1pRZ8OyXqokbMNmsVcr/gD6ZZ8EJurOK/6jbiV4y14= -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/aws-sdk-go v1.50.20 h1:xfAnSDVf/azIWTVQXQODp89bubvCS85r70O3nuQ4dnE= github.com/aws/aws-sdk-go v1.50.20/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/elasticloadbalancingv2 v1.43.8 h1:ukbsLI1BgjYPVdhDXsIYMR+yhiEBjjE5jY6G2hCQs28= +github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.8/go.mod h1:7eYWJcAR97y5ZlEtGF6Ux3HXRPBfXLDHZm6d7bXNQNI= +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/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= @@ -86,6 +112,8 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/michaelhtm/ack-runtime v0.40.1-0.20250128172628-d6fa812b5fbd h1:GK9B7aq6CUzF0euwMsqdXXSjKYXBpR9oZInttTNkeqo= +github.com/michaelhtm/ack-runtime v0.40.1-0.20250128172628-d6fa812b5fbd/go.mod h1:X0vuDLFbyCH6pAsWWADEAyw4f5c+KtQkKXkhWEamYkw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= diff --git a/helm/Chart.yaml b/helm/Chart.yaml index a209c14..5b925f2 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v1 name: elbv2-chart description: A Helm chart for the ACK service controller for Elastic Load Balancing (ELB) -version: 1.0.3 -appVersion: 1.0.3 +version: 0.0.0-non-release-version +appVersion: 0.0.0-non-release-version home: https://github.com/aws-controllers-k8s/elbv2-controller icon: https://raw.githubusercontent.com/aws/eks-charts/master/docs/logo/aws.png sources: diff --git a/helm/crds/elbv2.services.k8s.aws_listeners.yaml b/helm/crds/elbv2.services.k8s.aws_listeners.yaml index 1998d89..471b077 100644 --- a/helm/crds/elbv2.services.k8s.aws_listeners.yaml +++ b/helm/crds/elbv2.services.k8s.aws_listeners.yaml @@ -278,16 +278,20 @@ spec: mutualAuthentication: description: The mutual authentication configuration information. properties: + advertiseTrustStoreCaNames: + type: string ignoreClientCertificateExpiry: type: boolean mode: type: string trustStoreARN: type: string + trustStoreAssociationStatus: + type: string type: object port: description: |- - The port on which the load balancer is listening. You cannot specify a port + The port on which the load balancer is listening. You can't specify a port for a Gateway Load Balancer. format: int64 type: integer @@ -296,7 +300,7 @@ spec: The protocol for connections from clients to the load balancer. For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, and TCP_UDP. You can’t - specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You cannot + specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You can't specify a protocol for a Gateway Load Balancer. type: string sslPolicy: diff --git a/helm/crds/elbv2.services.k8s.aws_loadbalancers.yaml b/helm/crds/elbv2.services.k8s.aws_loadbalancers.yaml index 6c52068..bbd9567 100644 --- a/helm/crds/elbv2.services.k8s.aws_loadbalancers.yaml +++ b/helm/crds/elbv2.services.k8s.aws_loadbalancers.yaml @@ -58,11 +58,22 @@ spec: [Application Load Balancers on Outposts] The ID of the customer-owned address pool (CoIP pool). type: string + enablePrefixForIPv6SourceNAT: + description: |- + [Network Load Balancers with UDP listeners] Indicates whether to use an IPv6 + prefix from each subnet for source NAT. The IP address type must be dualstack. + The default value is off. + type: string ipAddressType: description: |- - The type of IP addresses used by the subnets for your load balancer. The - possible values are ipv4 (for IPv4 addresses) and dualstack (for IPv4 and - IPv6 addresses). + The IP address type. Internal load balancers must use ipv4. + + [Application Load Balancers] The possible values are ipv4 (IPv4 addresses), + dualstack (IPv4 and IPv6 addresses), and dualstack-without-public-ipv4 (public + IPv6 addresses and private IPv4 and IPv6 addresses). + + [Network Load Balancers and Gateway Load Balancers] The possible values are + ipv4 (IPv4 addresses) and dualstack (IPv4 and IPv6 addresses). type: string name: description: |- @@ -86,7 +97,7 @@ spec: The default is an Internet-facing load balancer. - You cannot specify a scheme for a Gateway Load Balancer. + You can't specify a scheme for a Gateway Load Balancer. type: string securityGroupRefs: items: @@ -120,7 +131,7 @@ spec: Zone. You must specify either subnets or subnet mappings, but not both. [Application Load Balancers] You must specify subnets from at least two Availability - Zones. You cannot specify Elastic IP addresses for your subnets. + Zones. You can't specify Elastic IP addresses for your subnets. [Application Load Balancers on Outposts] You must specify one Outpost subnet. @@ -135,7 +146,7 @@ spec: per subnet. [Gateway Load Balancers] You can specify subnets from one or more Availability - Zones. You cannot specify Elastic IP addresses for your subnets. + Zones. You can't specify Elastic IP addresses for your subnets. items: description: Information about a subnet mapping. properties: @@ -145,6 +156,8 @@ spec: type: string privateIPv4Address: type: string + sourceNATIPv6Prefix: + type: string subnetID: type: string subnetRef: @@ -196,11 +209,8 @@ spec: [Application Load Balancers on Local Zones] You can specify subnets from one or more Local Zones. - [Network Load Balancers] You can specify subnets from one or more Availability - Zones. - - [Gateway Load Balancers] You can specify subnets from one or more Availability - Zones. + [Network Load Balancers and Gateway Load Balancers] You can specify subnets + from one or more Availability Zones. items: type: string type: array @@ -273,6 +283,10 @@ spec: type: array outpostID: type: string + sourceNATIPv6Prefixes: + items: + type: string + type: array subnetID: type: string zoneName: diff --git a/helm/crds/elbv2.services.k8s.aws_rules.yaml b/helm/crds/elbv2.services.k8s.aws_rules.yaml index e22832d..0b8c9c5 100644 --- a/helm/crds/elbv2.services.k8s.aws_rules.yaml +++ b/helm/crds/elbv2.services.k8s.aws_rules.yaml @@ -230,8 +230,8 @@ spec: Each rule can optionally include up to one of each of the following conditions: http-request-method, host-header, path-pattern, and source-ip. Each rule can also optionally include one or more of each of the following conditions: - http-header and query-string. Note that the value for a condition cannot - be empty. + http-header and query-string. Note that the value for a condition can't be + empty. For more information, see Quotas for your Application Load Balancers (https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-limits.html). properties: diff --git a/helm/crds/elbv2.services.k8s.aws_targetgroups.yaml b/helm/crds/elbv2.services.k8s.aws_targetgroups.yaml index d95db99..529634e 100644 --- a/helm/crds/elbv2.services.k8s.aws_targetgroups.yaml +++ b/helm/crds/elbv2.services.k8s.aws_targetgroups.yaml @@ -46,7 +46,7 @@ spec: description: |- Indicates whether health checks are enabled. If the target type is lambda, health checks are disabled by default but can be enabled. If the target type - is instance, ip, or alb, health checks are always enabled and cannot be disabled. + is instance, ip, or alb, health checks are always enabled and can't be disabled. type: boolean healthCheckIntervalSeconds: description: |- @@ -101,10 +101,7 @@ spec: format: int64 type: integer ipAddressType: - description: |- - The type of IP address used for this target group. The possible values are - ipv4 and ipv6. This is an optional parameter. If not specified, the IP address - type defaults to ipv4. + description: The IP address type. The default value is ipv4. type: string matcher: description: |- diff --git a/helm/templates/NOTES.txt b/helm/templates/NOTES.txt index 4b75832..0de6750 100644 --- a/helm/templates/NOTES.txt +++ b/helm/templates/NOTES.txt @@ -1,5 +1,5 @@ {{ .Chart.Name }} has been installed. -This chart deploys "public.ecr.aws/aws-controllers-k8s/elbv2-controller:1.0.3". +This chart deploys "public.ecr.aws/aws-controllers-k8s/elbv2-controller:0.0.0-non-release-version". Check its status by running: kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/instance={{ .Release.Name }}" diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index bff6dd8..b36f75d 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -101,10 +101,18 @@ rules: resources: - listeners/status - loadbalancers/status - - rules/status - targetgroups/status verbs: - get + - list + - patch + - update +- apiGroups: + - elbv2.services.k8s.aws + resources: + - rules/status + verbs: + - get - patch - update - apiGroups: diff --git a/helm/values.yaml b/helm/values.yaml index 63c065e..f851c01 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -4,7 +4,7 @@ image: repository: public.ecr.aws/aws-controllers-k8s/elbv2-controller - tag: 1.0.3 + tag: 0.0.0-non-release-version pullPolicy: IfNotPresent pullSecrets: [] diff --git a/pkg/resource/listener/delta.go b/pkg/resource/listener/delta.go index 313f430..9d02c3d 100644 --- a/pkg/resource/listener/delta.go +++ b/pkg/resource/listener/delta.go @@ -77,6 +77,13 @@ func newResourceDelta( if ackcompare.HasNilDifference(a.ko.Spec.MutualAuthentication, b.ko.Spec.MutualAuthentication) { delta.Add("Spec.MutualAuthentication", a.ko.Spec.MutualAuthentication, b.ko.Spec.MutualAuthentication) } else if a.ko.Spec.MutualAuthentication != nil && b.ko.Spec.MutualAuthentication != nil { + if ackcompare.HasNilDifference(a.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames, b.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames) { + delta.Add("Spec.MutualAuthentication.AdvertiseTrustStoreCaNames", a.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames, b.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames) + } else if a.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames != nil && b.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames != nil { + if *a.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames != *b.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames { + delta.Add("Spec.MutualAuthentication.AdvertiseTrustStoreCaNames", a.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames, b.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames) + } + } if ackcompare.HasNilDifference(a.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry, b.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry) { delta.Add("Spec.MutualAuthentication.IgnoreClientCertificateExpiry", a.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry, b.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry) } else if a.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry != nil && b.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry != nil { @@ -98,6 +105,13 @@ func newResourceDelta( delta.Add("Spec.MutualAuthentication.TrustStoreARN", a.ko.Spec.MutualAuthentication.TrustStoreARN, b.ko.Spec.MutualAuthentication.TrustStoreARN) } } + if ackcompare.HasNilDifference(a.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus, b.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus) { + delta.Add("Spec.MutualAuthentication.TrustStoreAssociationStatus", a.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus, b.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus) + } else if a.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus != nil && b.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus != nil { + if *a.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus != *b.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus { + delta.Add("Spec.MutualAuthentication.TrustStoreAssociationStatus", a.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus, b.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus) + } + } } if ackcompare.HasNilDifference(a.ko.Spec.Port, b.ko.Spec.Port) { delta.Add("Spec.Port", a.ko.Spec.Port, b.ko.Spec.Port) diff --git a/pkg/resource/listener/manager.go b/pkg/resource/listener/manager.go index 50de3fb..8db270e 100644 --- a/pkg/resource/listener/manager.go +++ b/pkg/resource/listener/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/elbv2" - svcsdkapi "github.com/aws/aws-sdk-go/service/elbv2/elbv2iface" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" "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.ELBV2API + // 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 @@ -289,24 +288,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/listener/manager_factory.go b/pkg/resource/listener/manager_factory.go index 5418ffb..1ce3301 100644 --- a/pkg/resource/listener/manager_factory.go +++ b/pkg/resource/listener/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/elbv2-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/listener/references.go b/pkg/resource/listener/references.go index 6c9df34..9342732 100644 --- a/pkg/resource/listener/references.go +++ b/pkg/resource/listener/references.go @@ -30,6 +30,15 @@ import ( svcapitypes "github.com/aws-controllers-k8s/elbv2-controller/apis/v1alpha1" ) +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=targetgroups,verbs=get;list +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=targetgroups/status,verbs=get;list + +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=targetgroups,verbs=get;list +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=targetgroups/status,verbs=get;list + +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=loadbalancers,verbs=get;list +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=loadbalancers/status,verbs=get;list + // ClearResolvedReferences removes any reference values that were made // concrete in the spec. It returns a copy of the input AWSResource which // contains the original *Ref values, but none of their respective concrete diff --git a/pkg/resource/listener/sdk.go b/pkg/resource/listener/sdk.go index 840b02f..5844aa9 100644 --- a/pkg/resource/listener/sdk.go +++ b/pkg/resource/listener/sdk.go @@ -19,6 +19,7 @@ import ( "context" "errors" "fmt" + "math" "reflect" "strings" @@ -28,8 +29,9 @@ 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/elbv2" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" + svcsdktypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,8 +42,7 @@ import ( var ( _ = &metav1.Time{} _ = strings.ToLower("") - _ = &aws.JSONValue{} - _ = &svcsdk.ELBV2{} + _ = &svcsdk.Client{} _ = &svcapitypes.Listener{} _ = ackv1alpha1.AWSAccountID("") _ = &ackerr.NotFound @@ -49,6 +50,7 @@ var ( _ = &reflect.Value{} _ = fmt.Sprintf("") _ = &ackrequeue.NoRequeue{} + _ = &aws.Config{} ) // sdkFind returns SDK-specific information about a supplied resource @@ -73,15 +75,16 @@ func (rm *resourceManager) sdkFind( return nil, err } // The ARN is guaranteed to be checked by the sdkFind method. We can safely cast it here. - input.SetListenerArns([]*string{(*string)(r.ko.Status.ACKResourceMetadata.ARN)}) + input.ListenerArns = []string{(string)(*r.ko.Status.ACKResourceMetadata.ARN)} // Unset the LoadBalancerArn field since we can't set both ListenerArn and LoadBalancerArn // Probably needs to be done in the code-generator. @a-hilaly. input.LoadBalancerArn = nil var resp *svcsdk.DescribeListenersOutput - resp, err = rm.sdkapi.DescribeListenersWithContext(ctx, input) + resp, err = rm.sdkapi.DescribeListeners(ctx, input) rm.metrics.RecordAPICall("READ_MANY", "DescribeListeners", err) if err != nil { - if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "ListenerNotFound" { + var notFound *svcsdktypes.ListenerNotFoundException + if errors.As(err, ¬Found) { return nil, ackerr.NotFound } return nil, err @@ -94,13 +97,7 @@ func (rm *resourceManager) sdkFind( found := false for _, elem := range resp.Listeners { if elem.AlpnPolicy != nil { - f0 := []*string{} - for _, f0iter := range elem.AlpnPolicy { - var f0elem string - f0elem = *f0iter - f0 = append(f0, &f0elem) - } - ko.Spec.AlpnPolicy = f0 + ko.Spec.AlpnPolicy = aws.StringSlice(elem.AlpnPolicy) } else { ko.Spec.AlpnPolicy = nil } @@ -127,16 +124,10 @@ func (rm *resourceManager) sdkFind( if f2iter.AuthenticateCognitoConfig != nil { f2elemf0 := &svcapitypes.AuthenticateCognitoActionConfig{} if f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f2elemf0f0 := map[string]*string{} - for f2elemf0f0key, f2elemf0f0valiter := range f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f2elemf0f0val string - f2elemf0f0val = *f2elemf0f0valiter - f2elemf0f0[f2elemf0f0key] = &f2elemf0f0val - } - f2elemf0.AuthenticationRequestExtraParams = f2elemf0f0 + f2elemf0.AuthenticationRequestExtraParams = aws.StringMap(f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } - if f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f2elemf0.OnUnauthenticatedRequest = f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest + if f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != "" { + f2elemf0.OnUnauthenticatedRequest = aws.String(string(f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest)) } if f2iter.AuthenticateCognitoConfig.Scope != nil { f2elemf0.Scope = f2iter.AuthenticateCognitoConfig.Scope @@ -161,13 +152,7 @@ func (rm *resourceManager) sdkFind( if f2iter.AuthenticateOidcConfig != nil { f2elemf1 := &svcapitypes.AuthenticateOIDCActionConfig{} if f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams != nil { - f2elemf1f0 := map[string]*string{} - for f2elemf1f0key, f2elemf1f0valiter := range f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams { - var f2elemf1f0val string - f2elemf1f0val = *f2elemf1f0valiter - f2elemf1f0[f2elemf1f0key] = &f2elemf1f0val - } - f2elemf1.AuthenticationRequestExtraParams = f2elemf1f0 + f2elemf1.AuthenticationRequestExtraParams = aws.StringMap(f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams) } if f2iter.AuthenticateOidcConfig.AuthorizationEndpoint != nil { f2elemf1.AuthorizationEndpoint = f2iter.AuthenticateOidcConfig.AuthorizationEndpoint @@ -181,8 +166,8 @@ func (rm *resourceManager) sdkFind( if f2iter.AuthenticateOidcConfig.Issuer != nil { f2elemf1.Issuer = f2iter.AuthenticateOidcConfig.Issuer } - if f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != nil { - f2elemf1.OnUnauthenticatedRequest = f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest + if f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != "" { + f2elemf1.OnUnauthenticatedRequest = aws.String(string(f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest)) } if f2iter.AuthenticateOidcConfig.Scope != nil { f2elemf1.Scope = f2iter.AuthenticateOidcConfig.Scope @@ -222,7 +207,8 @@ func (rm *resourceManager) sdkFind( if f2iter.ForwardConfig.TargetGroupStickinessConfig != nil { f2elemf3f0 := &svcapitypes.TargetGroupStickinessConfig{} if f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f2elemf3f0.DurationSeconds = f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds + durationSecondsCopy := int64(*f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f2elemf3f0.DurationSeconds = &durationSecondsCopy } if f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { f2elemf3f0.Enabled = f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled @@ -237,7 +223,8 @@ func (rm *resourceManager) sdkFind( f2elemf3f1elem.TargetGroupARN = f2elemf3f1iter.TargetGroupArn } if f2elemf3f1iter.Weight != nil { - f2elemf3f1elem.Weight = f2elemf3f1iter.Weight + weightCopy := int64(*f2elemf3f1iter.Weight) + f2elemf3f1elem.Weight = &weightCopy } f2elemf3f1 = append(f2elemf3f1, f2elemf3f1elem) } @@ -246,7 +233,8 @@ func (rm *resourceManager) sdkFind( f2elem.ForwardConfig = f2elemf3 } if f2iter.Order != nil { - f2elem.Order = f2iter.Order + orderCopy := int64(*f2iter.Order) + f2elem.Order = &orderCopy } if f2iter.RedirectConfig != nil { f2elemf5 := &svcapitypes.RedirectActionConfig{} @@ -265,16 +253,16 @@ func (rm *resourceManager) sdkFind( if f2iter.RedirectConfig.Query != nil { f2elemf5.Query = f2iter.RedirectConfig.Query } - if f2iter.RedirectConfig.StatusCode != nil { - f2elemf5.StatusCode = f2iter.RedirectConfig.StatusCode + if f2iter.RedirectConfig.StatusCode != "" { + f2elemf5.StatusCode = aws.String(string(f2iter.RedirectConfig.StatusCode)) } f2elem.RedirectConfig = f2elemf5 } if f2iter.TargetGroupArn != nil { f2elem.TargetGroupARN = f2iter.TargetGroupArn } - if f2iter.Type != nil { - f2elem.Type = f2iter.Type + if f2iter.Type != "" { + f2elem.Type = aws.String(string(f2iter.Type)) } f2 = append(f2, f2elem) } @@ -296,6 +284,9 @@ func (rm *resourceManager) sdkFind( } if elem.MutualAuthentication != nil { f5 := &svcapitypes.MutualAuthenticationAttributes{} + if elem.MutualAuthentication.AdvertiseTrustStoreCaNames != "" { + f5.AdvertiseTrustStoreCaNames = aws.String(string(elem.MutualAuthentication.AdvertiseTrustStoreCaNames)) + } if elem.MutualAuthentication.IgnoreClientCertificateExpiry != nil { f5.IgnoreClientCertificateExpiry = elem.MutualAuthentication.IgnoreClientCertificateExpiry } @@ -305,17 +296,21 @@ func (rm *resourceManager) sdkFind( if elem.MutualAuthentication.TrustStoreArn != nil { f5.TrustStoreARN = elem.MutualAuthentication.TrustStoreArn } + if elem.MutualAuthentication.TrustStoreAssociationStatus != "" { + f5.TrustStoreAssociationStatus = aws.String(string(elem.MutualAuthentication.TrustStoreAssociationStatus)) + } ko.Spec.MutualAuthentication = f5 } else { ko.Spec.MutualAuthentication = nil } if elem.Port != nil { - ko.Spec.Port = elem.Port + portCopy := int64(*elem.Port) + ko.Spec.Port = &portCopy } else { ko.Spec.Port = nil } - if elem.Protocol != nil { - ko.Spec.Protocol = elem.Protocol + if elem.Protocol != "" { + ko.Spec.Protocol = aws.String(string(elem.Protocol)) } else { ko.Spec.Protocol = nil } @@ -352,7 +347,7 @@ func (rm *resourceManager) newListRequestPayload( res := &svcsdk.DescribeListenersInput{} if r.ko.Spec.LoadBalancerARN != nil { - res.SetLoadBalancerArn(*r.ko.Spec.LoadBalancerARN) + res.LoadBalancerArn = r.ko.Spec.LoadBalancerARN } return res, nil @@ -377,7 +372,7 @@ func (rm *resourceManager) sdkCreate( var resp *svcsdk.CreateListenerOutput _ = resp - resp, err = rm.sdkapi.CreateListenerWithContext(ctx, input) + resp, err = rm.sdkapi.CreateListener(ctx, input) rm.metrics.RecordAPICall("CREATE", "CreateListener", err) if err != nil { return nil, err @@ -389,13 +384,7 @@ func (rm *resourceManager) sdkCreate( found := false for _, elem := range resp.Listeners { if elem.AlpnPolicy != nil { - f0 := []*string{} - for _, f0iter := range elem.AlpnPolicy { - var f0elem string - f0elem = *f0iter - f0 = append(f0, &f0elem) - } - ko.Spec.AlpnPolicy = f0 + ko.Spec.AlpnPolicy = aws.StringSlice(elem.AlpnPolicy) } else { ko.Spec.AlpnPolicy = nil } @@ -422,16 +411,10 @@ func (rm *resourceManager) sdkCreate( if f2iter.AuthenticateCognitoConfig != nil { f2elemf0 := &svcapitypes.AuthenticateCognitoActionConfig{} if f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f2elemf0f0 := map[string]*string{} - for f2elemf0f0key, f2elemf0f0valiter := range f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f2elemf0f0val string - f2elemf0f0val = *f2elemf0f0valiter - f2elemf0f0[f2elemf0f0key] = &f2elemf0f0val - } - f2elemf0.AuthenticationRequestExtraParams = f2elemf0f0 + f2elemf0.AuthenticationRequestExtraParams = aws.StringMap(f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } - if f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f2elemf0.OnUnauthenticatedRequest = f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest + if f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != "" { + f2elemf0.OnUnauthenticatedRequest = aws.String(string(f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest)) } if f2iter.AuthenticateCognitoConfig.Scope != nil { f2elemf0.Scope = f2iter.AuthenticateCognitoConfig.Scope @@ -456,13 +439,7 @@ func (rm *resourceManager) sdkCreate( if f2iter.AuthenticateOidcConfig != nil { f2elemf1 := &svcapitypes.AuthenticateOIDCActionConfig{} if f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams != nil { - f2elemf1f0 := map[string]*string{} - for f2elemf1f0key, f2elemf1f0valiter := range f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams { - var f2elemf1f0val string - f2elemf1f0val = *f2elemf1f0valiter - f2elemf1f0[f2elemf1f0key] = &f2elemf1f0val - } - f2elemf1.AuthenticationRequestExtraParams = f2elemf1f0 + f2elemf1.AuthenticationRequestExtraParams = aws.StringMap(f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams) } if f2iter.AuthenticateOidcConfig.AuthorizationEndpoint != nil { f2elemf1.AuthorizationEndpoint = f2iter.AuthenticateOidcConfig.AuthorizationEndpoint @@ -476,8 +453,8 @@ func (rm *resourceManager) sdkCreate( if f2iter.AuthenticateOidcConfig.Issuer != nil { f2elemf1.Issuer = f2iter.AuthenticateOidcConfig.Issuer } - if f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != nil { - f2elemf1.OnUnauthenticatedRequest = f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest + if f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != "" { + f2elemf1.OnUnauthenticatedRequest = aws.String(string(f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest)) } if f2iter.AuthenticateOidcConfig.Scope != nil { f2elemf1.Scope = f2iter.AuthenticateOidcConfig.Scope @@ -517,7 +494,8 @@ func (rm *resourceManager) sdkCreate( if f2iter.ForwardConfig.TargetGroupStickinessConfig != nil { f2elemf3f0 := &svcapitypes.TargetGroupStickinessConfig{} if f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f2elemf3f0.DurationSeconds = f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds + durationSecondsCopy := int64(*f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f2elemf3f0.DurationSeconds = &durationSecondsCopy } if f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { f2elemf3f0.Enabled = f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled @@ -532,7 +510,8 @@ func (rm *resourceManager) sdkCreate( f2elemf3f1elem.TargetGroupARN = f2elemf3f1iter.TargetGroupArn } if f2elemf3f1iter.Weight != nil { - f2elemf3f1elem.Weight = f2elemf3f1iter.Weight + weightCopy := int64(*f2elemf3f1iter.Weight) + f2elemf3f1elem.Weight = &weightCopy } f2elemf3f1 = append(f2elemf3f1, f2elemf3f1elem) } @@ -541,7 +520,8 @@ func (rm *resourceManager) sdkCreate( f2elem.ForwardConfig = f2elemf3 } if f2iter.Order != nil { - f2elem.Order = f2iter.Order + orderCopy := int64(*f2iter.Order) + f2elem.Order = &orderCopy } if f2iter.RedirectConfig != nil { f2elemf5 := &svcapitypes.RedirectActionConfig{} @@ -560,16 +540,16 @@ func (rm *resourceManager) sdkCreate( if f2iter.RedirectConfig.Query != nil { f2elemf5.Query = f2iter.RedirectConfig.Query } - if f2iter.RedirectConfig.StatusCode != nil { - f2elemf5.StatusCode = f2iter.RedirectConfig.StatusCode + if f2iter.RedirectConfig.StatusCode != "" { + f2elemf5.StatusCode = aws.String(string(f2iter.RedirectConfig.StatusCode)) } f2elem.RedirectConfig = f2elemf5 } if f2iter.TargetGroupArn != nil { f2elem.TargetGroupARN = f2iter.TargetGroupArn } - if f2iter.Type != nil { - f2elem.Type = f2iter.Type + if f2iter.Type != "" { + f2elem.Type = aws.String(string(f2iter.Type)) } f2 = append(f2, f2elem) } @@ -591,6 +571,9 @@ func (rm *resourceManager) sdkCreate( } if elem.MutualAuthentication != nil { f5 := &svcapitypes.MutualAuthenticationAttributes{} + if elem.MutualAuthentication.AdvertiseTrustStoreCaNames != "" { + f5.AdvertiseTrustStoreCaNames = aws.String(string(elem.MutualAuthentication.AdvertiseTrustStoreCaNames)) + } if elem.MutualAuthentication.IgnoreClientCertificateExpiry != nil { f5.IgnoreClientCertificateExpiry = elem.MutualAuthentication.IgnoreClientCertificateExpiry } @@ -600,17 +583,21 @@ func (rm *resourceManager) sdkCreate( if elem.MutualAuthentication.TrustStoreArn != nil { f5.TrustStoreARN = elem.MutualAuthentication.TrustStoreArn } + if elem.MutualAuthentication.TrustStoreAssociationStatus != "" { + f5.TrustStoreAssociationStatus = aws.String(string(elem.MutualAuthentication.TrustStoreAssociationStatus)) + } ko.Spec.MutualAuthentication = f5 } else { ko.Spec.MutualAuthentication = nil } if elem.Port != nil { - ko.Spec.Port = elem.Port + portCopy := int64(*elem.Port) + ko.Spec.Port = &portCopy } else { ko.Spec.Port = nil } - if elem.Protocol != nil { - ko.Spec.Protocol = elem.Protocol + if elem.Protocol != "" { + ko.Spec.Protocol = aws.String(string(elem.Protocol)) } else { ko.Spec.Protocol = nil } @@ -639,226 +626,230 @@ func (rm *resourceManager) newCreateRequestPayload( res := &svcsdk.CreateListenerInput{} if r.ko.Spec.AlpnPolicy != nil { - f0 := []*string{} - for _, f0iter := range r.ko.Spec.AlpnPolicy { - var f0elem string - f0elem = *f0iter - f0 = append(f0, &f0elem) - } - res.SetAlpnPolicy(f0) + res.AlpnPolicy = aws.ToStringSlice(r.ko.Spec.AlpnPolicy) } if r.ko.Spec.Certificates != nil { - f1 := []*svcsdk.Certificate{} + f1 := []svcsdktypes.Certificate{} for _, f1iter := range r.ko.Spec.Certificates { - f1elem := &svcsdk.Certificate{} + f1elem := &svcsdktypes.Certificate{} if f1iter.CertificateARN != nil { - f1elem.SetCertificateArn(*f1iter.CertificateARN) + f1elem.CertificateArn = f1iter.CertificateARN } if f1iter.IsDefault != nil { - f1elem.SetIsDefault(*f1iter.IsDefault) + f1elem.IsDefault = f1iter.IsDefault } - f1 = append(f1, f1elem) + f1 = append(f1, *f1elem) } - res.SetCertificates(f1) + res.Certificates = f1 } if r.ko.Spec.DefaultActions != nil { - f2 := []*svcsdk.Action{} + f2 := []svcsdktypes.Action{} for _, f2iter := range r.ko.Spec.DefaultActions { - f2elem := &svcsdk.Action{} + f2elem := &svcsdktypes.Action{} if f2iter.AuthenticateCognitoConfig != nil { - f2elemf0 := &svcsdk.AuthenticateCognitoActionConfig{} + f2elemf0 := &svcsdktypes.AuthenticateCognitoActionConfig{} if f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f2elemf0f0 := map[string]*string{} - for f2elemf0f0key, f2elemf0f0valiter := range f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f2elemf0f0val string - f2elemf0f0val = *f2elemf0f0valiter - f2elemf0f0[f2elemf0f0key] = &f2elemf0f0val - } - f2elemf0.SetAuthenticationRequestExtraParams(f2elemf0f0) + f2elemf0.AuthenticationRequestExtraParams = aws.ToStringMap(f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } if f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f2elemf0.SetOnUnauthenticatedRequest(*f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest) + f2elemf0.OnUnauthenticatedRequest = svcsdktypes.AuthenticateCognitoActionConditionalBehaviorEnum(*f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest) } if f2iter.AuthenticateCognitoConfig.Scope != nil { - f2elemf0.SetScope(*f2iter.AuthenticateCognitoConfig.Scope) + f2elemf0.Scope = f2iter.AuthenticateCognitoConfig.Scope } if f2iter.AuthenticateCognitoConfig.SessionCookieName != nil { - f2elemf0.SetSessionCookieName(*f2iter.AuthenticateCognitoConfig.SessionCookieName) + f2elemf0.SessionCookieName = f2iter.AuthenticateCognitoConfig.SessionCookieName } if f2iter.AuthenticateCognitoConfig.SessionTimeout != nil { - f2elemf0.SetSessionTimeout(*f2iter.AuthenticateCognitoConfig.SessionTimeout) + f2elemf0.SessionTimeout = f2iter.AuthenticateCognitoConfig.SessionTimeout } if f2iter.AuthenticateCognitoConfig.UserPoolARN != nil { - f2elemf0.SetUserPoolArn(*f2iter.AuthenticateCognitoConfig.UserPoolARN) + f2elemf0.UserPoolArn = f2iter.AuthenticateCognitoConfig.UserPoolARN } if f2iter.AuthenticateCognitoConfig.UserPoolClientID != nil { - f2elemf0.SetUserPoolClientId(*f2iter.AuthenticateCognitoConfig.UserPoolClientID) + f2elemf0.UserPoolClientId = f2iter.AuthenticateCognitoConfig.UserPoolClientID } if f2iter.AuthenticateCognitoConfig.UserPoolDomain != nil { - f2elemf0.SetUserPoolDomain(*f2iter.AuthenticateCognitoConfig.UserPoolDomain) + f2elemf0.UserPoolDomain = f2iter.AuthenticateCognitoConfig.UserPoolDomain } - f2elem.SetAuthenticateCognitoConfig(f2elemf0) + f2elem.AuthenticateCognitoConfig = f2elemf0 } if f2iter.AuthenticateOIDCConfig != nil { - f2elemf1 := &svcsdk.AuthenticateOidcActionConfig{} + f2elemf1 := &svcsdktypes.AuthenticateOidcActionConfig{} if f2iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams != nil { - f2elemf1f0 := map[string]*string{} - for f2elemf1f0key, f2elemf1f0valiter := range f2iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams { - var f2elemf1f0val string - f2elemf1f0val = *f2elemf1f0valiter - f2elemf1f0[f2elemf1f0key] = &f2elemf1f0val - } - f2elemf1.SetAuthenticationRequestExtraParams(f2elemf1f0) + f2elemf1.AuthenticationRequestExtraParams = aws.ToStringMap(f2iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams) } if f2iter.AuthenticateOIDCConfig.AuthorizationEndpoint != nil { - f2elemf1.SetAuthorizationEndpoint(*f2iter.AuthenticateOIDCConfig.AuthorizationEndpoint) + f2elemf1.AuthorizationEndpoint = f2iter.AuthenticateOIDCConfig.AuthorizationEndpoint } if f2iter.AuthenticateOIDCConfig.ClientID != nil { - f2elemf1.SetClientId(*f2iter.AuthenticateOIDCConfig.ClientID) + f2elemf1.ClientId = f2iter.AuthenticateOIDCConfig.ClientID } if f2iter.AuthenticateOIDCConfig.ClientSecret != nil { - f2elemf1.SetClientSecret(*f2iter.AuthenticateOIDCConfig.ClientSecret) + f2elemf1.ClientSecret = f2iter.AuthenticateOIDCConfig.ClientSecret } if f2iter.AuthenticateOIDCConfig.Issuer != nil { - f2elemf1.SetIssuer(*f2iter.AuthenticateOIDCConfig.Issuer) + f2elemf1.Issuer = f2iter.AuthenticateOIDCConfig.Issuer } if f2iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest != nil { - f2elemf1.SetOnUnauthenticatedRequest(*f2iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest) + f2elemf1.OnUnauthenticatedRequest = svcsdktypes.AuthenticateOidcActionConditionalBehaviorEnum(*f2iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest) } if f2iter.AuthenticateOIDCConfig.Scope != nil { - f2elemf1.SetScope(*f2iter.AuthenticateOIDCConfig.Scope) + f2elemf1.Scope = f2iter.AuthenticateOIDCConfig.Scope } if f2iter.AuthenticateOIDCConfig.SessionCookieName != nil { - f2elemf1.SetSessionCookieName(*f2iter.AuthenticateOIDCConfig.SessionCookieName) + f2elemf1.SessionCookieName = f2iter.AuthenticateOIDCConfig.SessionCookieName } if f2iter.AuthenticateOIDCConfig.SessionTimeout != nil { - f2elemf1.SetSessionTimeout(*f2iter.AuthenticateOIDCConfig.SessionTimeout) + f2elemf1.SessionTimeout = f2iter.AuthenticateOIDCConfig.SessionTimeout } if f2iter.AuthenticateOIDCConfig.TokenEndpoint != nil { - f2elemf1.SetTokenEndpoint(*f2iter.AuthenticateOIDCConfig.TokenEndpoint) + f2elemf1.TokenEndpoint = f2iter.AuthenticateOIDCConfig.TokenEndpoint } if f2iter.AuthenticateOIDCConfig.UseExistingClientSecret != nil { - f2elemf1.SetUseExistingClientSecret(*f2iter.AuthenticateOIDCConfig.UseExistingClientSecret) + f2elemf1.UseExistingClientSecret = f2iter.AuthenticateOIDCConfig.UseExistingClientSecret } if f2iter.AuthenticateOIDCConfig.UserInfoEndpoint != nil { - f2elemf1.SetUserInfoEndpoint(*f2iter.AuthenticateOIDCConfig.UserInfoEndpoint) + f2elemf1.UserInfoEndpoint = f2iter.AuthenticateOIDCConfig.UserInfoEndpoint } - f2elem.SetAuthenticateOidcConfig(f2elemf1) + f2elem.AuthenticateOidcConfig = f2elemf1 } if f2iter.FixedResponseConfig != nil { - f2elemf2 := &svcsdk.FixedResponseActionConfig{} + f2elemf2 := &svcsdktypes.FixedResponseActionConfig{} if f2iter.FixedResponseConfig.ContentType != nil { - f2elemf2.SetContentType(*f2iter.FixedResponseConfig.ContentType) + f2elemf2.ContentType = f2iter.FixedResponseConfig.ContentType } if f2iter.FixedResponseConfig.MessageBody != nil { - f2elemf2.SetMessageBody(*f2iter.FixedResponseConfig.MessageBody) + f2elemf2.MessageBody = f2iter.FixedResponseConfig.MessageBody } if f2iter.FixedResponseConfig.StatusCode != nil { - f2elemf2.SetStatusCode(*f2iter.FixedResponseConfig.StatusCode) + f2elemf2.StatusCode = f2iter.FixedResponseConfig.StatusCode } - f2elem.SetFixedResponseConfig(f2elemf2) + f2elem.FixedResponseConfig = f2elemf2 } if f2iter.ForwardConfig != nil { - f2elemf3 := &svcsdk.ForwardActionConfig{} + f2elemf3 := &svcsdktypes.ForwardActionConfig{} if f2iter.ForwardConfig.TargetGroupStickinessConfig != nil { - f2elemf3f0 := &svcsdk.TargetGroupStickinessConfig{} + f2elemf3f0 := &svcsdktypes.TargetGroupStickinessConfig{} if f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f2elemf3f0.SetDurationSeconds(*f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + if *f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds > math.MaxInt32 || *f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds < math.MinInt32 { + return nil, fmt.Errorf("error: field DurationSeconds is of type int32") + } + durationSecondsCopy := int32(*f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f2elemf3f0.DurationSeconds = &durationSecondsCopy } if f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { - f2elemf3f0.SetEnabled(*f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled) + f2elemf3f0.Enabled = f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled } - f2elemf3.SetTargetGroupStickinessConfig(f2elemf3f0) + f2elemf3.TargetGroupStickinessConfig = f2elemf3f0 } if f2iter.ForwardConfig.TargetGroups != nil { - f2elemf3f1 := []*svcsdk.TargetGroupTuple{} + f2elemf3f1 := []svcsdktypes.TargetGroupTuple{} for _, f2elemf3f1iter := range f2iter.ForwardConfig.TargetGroups { - f2elemf3f1elem := &svcsdk.TargetGroupTuple{} + f2elemf3f1elem := &svcsdktypes.TargetGroupTuple{} if f2elemf3f1iter.TargetGroupARN != nil { - f2elemf3f1elem.SetTargetGroupArn(*f2elemf3f1iter.TargetGroupARN) + f2elemf3f1elem.TargetGroupArn = f2elemf3f1iter.TargetGroupARN } if f2elemf3f1iter.Weight != nil { - f2elemf3f1elem.SetWeight(*f2elemf3f1iter.Weight) + if *f2elemf3f1iter.Weight > math.MaxInt32 || *f2elemf3f1iter.Weight < math.MinInt32 { + return nil, fmt.Errorf("error: field Weight is of type int32") + } + weightCopy := int32(*f2elemf3f1iter.Weight) + f2elemf3f1elem.Weight = &weightCopy } - f2elemf3f1 = append(f2elemf3f1, f2elemf3f1elem) + f2elemf3f1 = append(f2elemf3f1, *f2elemf3f1elem) } - f2elemf3.SetTargetGroups(f2elemf3f1) + f2elemf3.TargetGroups = f2elemf3f1 } - f2elem.SetForwardConfig(f2elemf3) + f2elem.ForwardConfig = f2elemf3 } if f2iter.Order != nil { - f2elem.SetOrder(*f2iter.Order) + if *f2iter.Order > math.MaxInt32 || *f2iter.Order < math.MinInt32 { + return nil, fmt.Errorf("error: field Order is of type int32") + } + orderCopy := int32(*f2iter.Order) + f2elem.Order = &orderCopy } if f2iter.RedirectConfig != nil { - f2elemf5 := &svcsdk.RedirectActionConfig{} + f2elemf5 := &svcsdktypes.RedirectActionConfig{} if f2iter.RedirectConfig.Host != nil { - f2elemf5.SetHost(*f2iter.RedirectConfig.Host) + f2elemf5.Host = f2iter.RedirectConfig.Host } if f2iter.RedirectConfig.Path != nil { - f2elemf5.SetPath(*f2iter.RedirectConfig.Path) + f2elemf5.Path = f2iter.RedirectConfig.Path } if f2iter.RedirectConfig.Port != nil { - f2elemf5.SetPort(*f2iter.RedirectConfig.Port) + f2elemf5.Port = f2iter.RedirectConfig.Port } if f2iter.RedirectConfig.Protocol != nil { - f2elemf5.SetProtocol(*f2iter.RedirectConfig.Protocol) + f2elemf5.Protocol = f2iter.RedirectConfig.Protocol } if f2iter.RedirectConfig.Query != nil { - f2elemf5.SetQuery(*f2iter.RedirectConfig.Query) + f2elemf5.Query = f2iter.RedirectConfig.Query } if f2iter.RedirectConfig.StatusCode != nil { - f2elemf5.SetStatusCode(*f2iter.RedirectConfig.StatusCode) + f2elemf5.StatusCode = svcsdktypes.RedirectActionStatusCodeEnum(*f2iter.RedirectConfig.StatusCode) } - f2elem.SetRedirectConfig(f2elemf5) + f2elem.RedirectConfig = f2elemf5 } if f2iter.TargetGroupARN != nil { - f2elem.SetTargetGroupArn(*f2iter.TargetGroupARN) + f2elem.TargetGroupArn = f2iter.TargetGroupARN } if f2iter.Type != nil { - f2elem.SetType(*f2iter.Type) + f2elem.Type = svcsdktypes.ActionTypeEnum(*f2iter.Type) } - f2 = append(f2, f2elem) + f2 = append(f2, *f2elem) } - res.SetDefaultActions(f2) + res.DefaultActions = f2 } if r.ko.Spec.LoadBalancerARN != nil { - res.SetLoadBalancerArn(*r.ko.Spec.LoadBalancerARN) + res.LoadBalancerArn = r.ko.Spec.LoadBalancerARN } if r.ko.Spec.MutualAuthentication != nil { - f4 := &svcsdk.MutualAuthenticationAttributes{} + f4 := &svcsdktypes.MutualAuthenticationAttributes{} + if r.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames != nil { + f4.AdvertiseTrustStoreCaNames = svcsdktypes.AdvertiseTrustStoreCaNamesEnum(*r.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames) + } if r.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry != nil { - f4.SetIgnoreClientCertificateExpiry(*r.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry) + f4.IgnoreClientCertificateExpiry = r.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry } if r.ko.Spec.MutualAuthentication.Mode != nil { - f4.SetMode(*r.ko.Spec.MutualAuthentication.Mode) + f4.Mode = r.ko.Spec.MutualAuthentication.Mode } if r.ko.Spec.MutualAuthentication.TrustStoreARN != nil { - f4.SetTrustStoreArn(*r.ko.Spec.MutualAuthentication.TrustStoreARN) + f4.TrustStoreArn = r.ko.Spec.MutualAuthentication.TrustStoreARN + } + if r.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus != nil { + f4.TrustStoreAssociationStatus = svcsdktypes.TrustStoreAssociationStatusEnum(*r.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus) } - res.SetMutualAuthentication(f4) + res.MutualAuthentication = f4 } if r.ko.Spec.Port != nil { - res.SetPort(*r.ko.Spec.Port) + if *r.ko.Spec.Port > math.MaxInt32 || *r.ko.Spec.Port < math.MinInt32 { + return nil, fmt.Errorf("error: field Port is of type int32") + } + portCopy := int32(*r.ko.Spec.Port) + res.Port = &portCopy } if r.ko.Spec.Protocol != nil { - res.SetProtocol(*r.ko.Spec.Protocol) + res.Protocol = svcsdktypes.ProtocolEnum(*r.ko.Spec.Protocol) } if r.ko.Spec.SSLPolicy != nil { - res.SetSslPolicy(*r.ko.Spec.SSLPolicy) + res.SslPolicy = r.ko.Spec.SSLPolicy } if r.ko.Spec.Tags != nil { - f8 := []*svcsdk.Tag{} + f8 := []svcsdktypes.Tag{} for _, f8iter := range r.ko.Spec.Tags { - f8elem := &svcsdk.Tag{} + f8elem := &svcsdktypes.Tag{} if f8iter.Key != nil { - f8elem.SetKey(*f8iter.Key) + f8elem.Key = f8iter.Key } if f8iter.Value != nil { - f8elem.SetValue(*f8iter.Value) + f8elem.Value = f8iter.Value } - f8 = append(f8, f8elem) + f8 = append(f8, *f8elem) } - res.SetTags(f8) + res.Tags = f8 } return res, nil @@ -884,7 +875,7 @@ func (rm *resourceManager) sdkUpdate( var resp *svcsdk.ModifyListenerOutput _ = resp - resp, err = rm.sdkapi.ModifyListenerWithContext(ctx, input) + resp, err = rm.sdkapi.ModifyListener(ctx, input) rm.metrics.RecordAPICall("UPDATE", "ModifyListener", err) if err != nil { return nil, err @@ -896,13 +887,7 @@ func (rm *resourceManager) sdkUpdate( found := false for _, elem := range resp.Listeners { if elem.AlpnPolicy != nil { - f0 := []*string{} - for _, f0iter := range elem.AlpnPolicy { - var f0elem string - f0elem = *f0iter - f0 = append(f0, &f0elem) - } - ko.Spec.AlpnPolicy = f0 + ko.Spec.AlpnPolicy = aws.StringSlice(elem.AlpnPolicy) } else { ko.Spec.AlpnPolicy = nil } @@ -929,16 +914,10 @@ func (rm *resourceManager) sdkUpdate( if f2iter.AuthenticateCognitoConfig != nil { f2elemf0 := &svcapitypes.AuthenticateCognitoActionConfig{} if f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f2elemf0f0 := map[string]*string{} - for f2elemf0f0key, f2elemf0f0valiter := range f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f2elemf0f0val string - f2elemf0f0val = *f2elemf0f0valiter - f2elemf0f0[f2elemf0f0key] = &f2elemf0f0val - } - f2elemf0.AuthenticationRequestExtraParams = f2elemf0f0 + f2elemf0.AuthenticationRequestExtraParams = aws.StringMap(f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } - if f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f2elemf0.OnUnauthenticatedRequest = f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest + if f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != "" { + f2elemf0.OnUnauthenticatedRequest = aws.String(string(f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest)) } if f2iter.AuthenticateCognitoConfig.Scope != nil { f2elemf0.Scope = f2iter.AuthenticateCognitoConfig.Scope @@ -963,13 +942,7 @@ func (rm *resourceManager) sdkUpdate( if f2iter.AuthenticateOidcConfig != nil { f2elemf1 := &svcapitypes.AuthenticateOIDCActionConfig{} if f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams != nil { - f2elemf1f0 := map[string]*string{} - for f2elemf1f0key, f2elemf1f0valiter := range f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams { - var f2elemf1f0val string - f2elemf1f0val = *f2elemf1f0valiter - f2elemf1f0[f2elemf1f0key] = &f2elemf1f0val - } - f2elemf1.AuthenticationRequestExtraParams = f2elemf1f0 + f2elemf1.AuthenticationRequestExtraParams = aws.StringMap(f2iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams) } if f2iter.AuthenticateOidcConfig.AuthorizationEndpoint != nil { f2elemf1.AuthorizationEndpoint = f2iter.AuthenticateOidcConfig.AuthorizationEndpoint @@ -983,8 +956,8 @@ func (rm *resourceManager) sdkUpdate( if f2iter.AuthenticateOidcConfig.Issuer != nil { f2elemf1.Issuer = f2iter.AuthenticateOidcConfig.Issuer } - if f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != nil { - f2elemf1.OnUnauthenticatedRequest = f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest + if f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != "" { + f2elemf1.OnUnauthenticatedRequest = aws.String(string(f2iter.AuthenticateOidcConfig.OnUnauthenticatedRequest)) } if f2iter.AuthenticateOidcConfig.Scope != nil { f2elemf1.Scope = f2iter.AuthenticateOidcConfig.Scope @@ -1024,7 +997,8 @@ func (rm *resourceManager) sdkUpdate( if f2iter.ForwardConfig.TargetGroupStickinessConfig != nil { f2elemf3f0 := &svcapitypes.TargetGroupStickinessConfig{} if f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f2elemf3f0.DurationSeconds = f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds + durationSecondsCopy := int64(*f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f2elemf3f0.DurationSeconds = &durationSecondsCopy } if f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { f2elemf3f0.Enabled = f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled @@ -1039,7 +1013,8 @@ func (rm *resourceManager) sdkUpdate( f2elemf3f1elem.TargetGroupARN = f2elemf3f1iter.TargetGroupArn } if f2elemf3f1iter.Weight != nil { - f2elemf3f1elem.Weight = f2elemf3f1iter.Weight + weightCopy := int64(*f2elemf3f1iter.Weight) + f2elemf3f1elem.Weight = &weightCopy } f2elemf3f1 = append(f2elemf3f1, f2elemf3f1elem) } @@ -1048,7 +1023,8 @@ func (rm *resourceManager) sdkUpdate( f2elem.ForwardConfig = f2elemf3 } if f2iter.Order != nil { - f2elem.Order = f2iter.Order + orderCopy := int64(*f2iter.Order) + f2elem.Order = &orderCopy } if f2iter.RedirectConfig != nil { f2elemf5 := &svcapitypes.RedirectActionConfig{} @@ -1067,16 +1043,16 @@ func (rm *resourceManager) sdkUpdate( if f2iter.RedirectConfig.Query != nil { f2elemf5.Query = f2iter.RedirectConfig.Query } - if f2iter.RedirectConfig.StatusCode != nil { - f2elemf5.StatusCode = f2iter.RedirectConfig.StatusCode + if f2iter.RedirectConfig.StatusCode != "" { + f2elemf5.StatusCode = aws.String(string(f2iter.RedirectConfig.StatusCode)) } f2elem.RedirectConfig = f2elemf5 } if f2iter.TargetGroupArn != nil { f2elem.TargetGroupARN = f2iter.TargetGroupArn } - if f2iter.Type != nil { - f2elem.Type = f2iter.Type + if f2iter.Type != "" { + f2elem.Type = aws.String(string(f2iter.Type)) } f2 = append(f2, f2elem) } @@ -1098,6 +1074,9 @@ func (rm *resourceManager) sdkUpdate( } if elem.MutualAuthentication != nil { f5 := &svcapitypes.MutualAuthenticationAttributes{} + if elem.MutualAuthentication.AdvertiseTrustStoreCaNames != "" { + f5.AdvertiseTrustStoreCaNames = aws.String(string(elem.MutualAuthentication.AdvertiseTrustStoreCaNames)) + } if elem.MutualAuthentication.IgnoreClientCertificateExpiry != nil { f5.IgnoreClientCertificateExpiry = elem.MutualAuthentication.IgnoreClientCertificateExpiry } @@ -1107,17 +1086,21 @@ func (rm *resourceManager) sdkUpdate( if elem.MutualAuthentication.TrustStoreArn != nil { f5.TrustStoreARN = elem.MutualAuthentication.TrustStoreArn } + if elem.MutualAuthentication.TrustStoreAssociationStatus != "" { + f5.TrustStoreAssociationStatus = aws.String(string(elem.MutualAuthentication.TrustStoreAssociationStatus)) + } ko.Spec.MutualAuthentication = f5 } else { ko.Spec.MutualAuthentication = nil } if elem.Port != nil { - ko.Spec.Port = elem.Port + portCopy := int64(*elem.Port) + ko.Spec.Port = &portCopy } else { ko.Spec.Port = nil } - if elem.Protocol != nil { - ko.Spec.Protocol = elem.Protocol + if elem.Protocol != "" { + ko.Spec.Protocol = aws.String(string(elem.Protocol)) } else { ko.Spec.Protocol = nil } @@ -1147,212 +1130,216 @@ func (rm *resourceManager) newUpdateRequestPayload( res := &svcsdk.ModifyListenerInput{} if r.ko.Spec.AlpnPolicy != nil { - f0 := []*string{} - for _, f0iter := range r.ko.Spec.AlpnPolicy { - var f0elem string - f0elem = *f0iter - f0 = append(f0, &f0elem) - } - res.SetAlpnPolicy(f0) + res.AlpnPolicy = aws.ToStringSlice(r.ko.Spec.AlpnPolicy) } if r.ko.Spec.Certificates != nil { - f1 := []*svcsdk.Certificate{} + f1 := []svcsdktypes.Certificate{} for _, f1iter := range r.ko.Spec.Certificates { - f1elem := &svcsdk.Certificate{} + f1elem := &svcsdktypes.Certificate{} if f1iter.CertificateARN != nil { - f1elem.SetCertificateArn(*f1iter.CertificateARN) + f1elem.CertificateArn = f1iter.CertificateARN } if f1iter.IsDefault != nil { - f1elem.SetIsDefault(*f1iter.IsDefault) + f1elem.IsDefault = f1iter.IsDefault } - f1 = append(f1, f1elem) + f1 = append(f1, *f1elem) } - res.SetCertificates(f1) + res.Certificates = f1 } if r.ko.Spec.DefaultActions != nil { - f2 := []*svcsdk.Action{} + f2 := []svcsdktypes.Action{} for _, f2iter := range r.ko.Spec.DefaultActions { - f2elem := &svcsdk.Action{} + f2elem := &svcsdktypes.Action{} if f2iter.AuthenticateCognitoConfig != nil { - f2elemf0 := &svcsdk.AuthenticateCognitoActionConfig{} + f2elemf0 := &svcsdktypes.AuthenticateCognitoActionConfig{} if f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f2elemf0f0 := map[string]*string{} - for f2elemf0f0key, f2elemf0f0valiter := range f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f2elemf0f0val string - f2elemf0f0val = *f2elemf0f0valiter - f2elemf0f0[f2elemf0f0key] = &f2elemf0f0val - } - f2elemf0.SetAuthenticationRequestExtraParams(f2elemf0f0) + f2elemf0.AuthenticationRequestExtraParams = aws.ToStringMap(f2iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } if f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f2elemf0.SetOnUnauthenticatedRequest(*f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest) + f2elemf0.OnUnauthenticatedRequest = svcsdktypes.AuthenticateCognitoActionConditionalBehaviorEnum(*f2iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest) } if f2iter.AuthenticateCognitoConfig.Scope != nil { - f2elemf0.SetScope(*f2iter.AuthenticateCognitoConfig.Scope) + f2elemf0.Scope = f2iter.AuthenticateCognitoConfig.Scope } if f2iter.AuthenticateCognitoConfig.SessionCookieName != nil { - f2elemf0.SetSessionCookieName(*f2iter.AuthenticateCognitoConfig.SessionCookieName) + f2elemf0.SessionCookieName = f2iter.AuthenticateCognitoConfig.SessionCookieName } if f2iter.AuthenticateCognitoConfig.SessionTimeout != nil { - f2elemf0.SetSessionTimeout(*f2iter.AuthenticateCognitoConfig.SessionTimeout) + f2elemf0.SessionTimeout = f2iter.AuthenticateCognitoConfig.SessionTimeout } if f2iter.AuthenticateCognitoConfig.UserPoolARN != nil { - f2elemf0.SetUserPoolArn(*f2iter.AuthenticateCognitoConfig.UserPoolARN) + f2elemf0.UserPoolArn = f2iter.AuthenticateCognitoConfig.UserPoolARN } if f2iter.AuthenticateCognitoConfig.UserPoolClientID != nil { - f2elemf0.SetUserPoolClientId(*f2iter.AuthenticateCognitoConfig.UserPoolClientID) + f2elemf0.UserPoolClientId = f2iter.AuthenticateCognitoConfig.UserPoolClientID } if f2iter.AuthenticateCognitoConfig.UserPoolDomain != nil { - f2elemf0.SetUserPoolDomain(*f2iter.AuthenticateCognitoConfig.UserPoolDomain) + f2elemf0.UserPoolDomain = f2iter.AuthenticateCognitoConfig.UserPoolDomain } - f2elem.SetAuthenticateCognitoConfig(f2elemf0) + f2elem.AuthenticateCognitoConfig = f2elemf0 } if f2iter.AuthenticateOIDCConfig != nil { - f2elemf1 := &svcsdk.AuthenticateOidcActionConfig{} + f2elemf1 := &svcsdktypes.AuthenticateOidcActionConfig{} if f2iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams != nil { - f2elemf1f0 := map[string]*string{} - for f2elemf1f0key, f2elemf1f0valiter := range f2iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams { - var f2elemf1f0val string - f2elemf1f0val = *f2elemf1f0valiter - f2elemf1f0[f2elemf1f0key] = &f2elemf1f0val - } - f2elemf1.SetAuthenticationRequestExtraParams(f2elemf1f0) + f2elemf1.AuthenticationRequestExtraParams = aws.ToStringMap(f2iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams) } if f2iter.AuthenticateOIDCConfig.AuthorizationEndpoint != nil { - f2elemf1.SetAuthorizationEndpoint(*f2iter.AuthenticateOIDCConfig.AuthorizationEndpoint) + f2elemf1.AuthorizationEndpoint = f2iter.AuthenticateOIDCConfig.AuthorizationEndpoint } if f2iter.AuthenticateOIDCConfig.ClientID != nil { - f2elemf1.SetClientId(*f2iter.AuthenticateOIDCConfig.ClientID) + f2elemf1.ClientId = f2iter.AuthenticateOIDCConfig.ClientID } if f2iter.AuthenticateOIDCConfig.ClientSecret != nil { - f2elemf1.SetClientSecret(*f2iter.AuthenticateOIDCConfig.ClientSecret) + f2elemf1.ClientSecret = f2iter.AuthenticateOIDCConfig.ClientSecret } if f2iter.AuthenticateOIDCConfig.Issuer != nil { - f2elemf1.SetIssuer(*f2iter.AuthenticateOIDCConfig.Issuer) + f2elemf1.Issuer = f2iter.AuthenticateOIDCConfig.Issuer } if f2iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest != nil { - f2elemf1.SetOnUnauthenticatedRequest(*f2iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest) + f2elemf1.OnUnauthenticatedRequest = svcsdktypes.AuthenticateOidcActionConditionalBehaviorEnum(*f2iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest) } if f2iter.AuthenticateOIDCConfig.Scope != nil { - f2elemf1.SetScope(*f2iter.AuthenticateOIDCConfig.Scope) + f2elemf1.Scope = f2iter.AuthenticateOIDCConfig.Scope } if f2iter.AuthenticateOIDCConfig.SessionCookieName != nil { - f2elemf1.SetSessionCookieName(*f2iter.AuthenticateOIDCConfig.SessionCookieName) + f2elemf1.SessionCookieName = f2iter.AuthenticateOIDCConfig.SessionCookieName } if f2iter.AuthenticateOIDCConfig.SessionTimeout != nil { - f2elemf1.SetSessionTimeout(*f2iter.AuthenticateOIDCConfig.SessionTimeout) + f2elemf1.SessionTimeout = f2iter.AuthenticateOIDCConfig.SessionTimeout } if f2iter.AuthenticateOIDCConfig.TokenEndpoint != nil { - f2elemf1.SetTokenEndpoint(*f2iter.AuthenticateOIDCConfig.TokenEndpoint) + f2elemf1.TokenEndpoint = f2iter.AuthenticateOIDCConfig.TokenEndpoint } if f2iter.AuthenticateOIDCConfig.UseExistingClientSecret != nil { - f2elemf1.SetUseExistingClientSecret(*f2iter.AuthenticateOIDCConfig.UseExistingClientSecret) + f2elemf1.UseExistingClientSecret = f2iter.AuthenticateOIDCConfig.UseExistingClientSecret } if f2iter.AuthenticateOIDCConfig.UserInfoEndpoint != nil { - f2elemf1.SetUserInfoEndpoint(*f2iter.AuthenticateOIDCConfig.UserInfoEndpoint) + f2elemf1.UserInfoEndpoint = f2iter.AuthenticateOIDCConfig.UserInfoEndpoint } - f2elem.SetAuthenticateOidcConfig(f2elemf1) + f2elem.AuthenticateOidcConfig = f2elemf1 } if f2iter.FixedResponseConfig != nil { - f2elemf2 := &svcsdk.FixedResponseActionConfig{} + f2elemf2 := &svcsdktypes.FixedResponseActionConfig{} if f2iter.FixedResponseConfig.ContentType != nil { - f2elemf2.SetContentType(*f2iter.FixedResponseConfig.ContentType) + f2elemf2.ContentType = f2iter.FixedResponseConfig.ContentType } if f2iter.FixedResponseConfig.MessageBody != nil { - f2elemf2.SetMessageBody(*f2iter.FixedResponseConfig.MessageBody) + f2elemf2.MessageBody = f2iter.FixedResponseConfig.MessageBody } if f2iter.FixedResponseConfig.StatusCode != nil { - f2elemf2.SetStatusCode(*f2iter.FixedResponseConfig.StatusCode) + f2elemf2.StatusCode = f2iter.FixedResponseConfig.StatusCode } - f2elem.SetFixedResponseConfig(f2elemf2) + f2elem.FixedResponseConfig = f2elemf2 } if f2iter.ForwardConfig != nil { - f2elemf3 := &svcsdk.ForwardActionConfig{} + f2elemf3 := &svcsdktypes.ForwardActionConfig{} if f2iter.ForwardConfig.TargetGroupStickinessConfig != nil { - f2elemf3f0 := &svcsdk.TargetGroupStickinessConfig{} + f2elemf3f0 := &svcsdktypes.TargetGroupStickinessConfig{} if f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f2elemf3f0.SetDurationSeconds(*f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + if *f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds > math.MaxInt32 || *f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds < math.MinInt32 { + return nil, fmt.Errorf("error: field DurationSeconds is of type int32") + } + durationSecondsCopy := int32(*f2iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f2elemf3f0.DurationSeconds = &durationSecondsCopy } if f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { - f2elemf3f0.SetEnabled(*f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled) + f2elemf3f0.Enabled = f2iter.ForwardConfig.TargetGroupStickinessConfig.Enabled } - f2elemf3.SetTargetGroupStickinessConfig(f2elemf3f0) + f2elemf3.TargetGroupStickinessConfig = f2elemf3f0 } if f2iter.ForwardConfig.TargetGroups != nil { - f2elemf3f1 := []*svcsdk.TargetGroupTuple{} + f2elemf3f1 := []svcsdktypes.TargetGroupTuple{} for _, f2elemf3f1iter := range f2iter.ForwardConfig.TargetGroups { - f2elemf3f1elem := &svcsdk.TargetGroupTuple{} + f2elemf3f1elem := &svcsdktypes.TargetGroupTuple{} if f2elemf3f1iter.TargetGroupARN != nil { - f2elemf3f1elem.SetTargetGroupArn(*f2elemf3f1iter.TargetGroupARN) + f2elemf3f1elem.TargetGroupArn = f2elemf3f1iter.TargetGroupARN } if f2elemf3f1iter.Weight != nil { - f2elemf3f1elem.SetWeight(*f2elemf3f1iter.Weight) + if *f2elemf3f1iter.Weight > math.MaxInt32 || *f2elemf3f1iter.Weight < math.MinInt32 { + return nil, fmt.Errorf("error: field Weight is of type int32") + } + weightCopy := int32(*f2elemf3f1iter.Weight) + f2elemf3f1elem.Weight = &weightCopy } - f2elemf3f1 = append(f2elemf3f1, f2elemf3f1elem) + f2elemf3f1 = append(f2elemf3f1, *f2elemf3f1elem) } - f2elemf3.SetTargetGroups(f2elemf3f1) + f2elemf3.TargetGroups = f2elemf3f1 } - f2elem.SetForwardConfig(f2elemf3) + f2elem.ForwardConfig = f2elemf3 } if f2iter.Order != nil { - f2elem.SetOrder(*f2iter.Order) + if *f2iter.Order > math.MaxInt32 || *f2iter.Order < math.MinInt32 { + return nil, fmt.Errorf("error: field Order is of type int32") + } + orderCopy := int32(*f2iter.Order) + f2elem.Order = &orderCopy } if f2iter.RedirectConfig != nil { - f2elemf5 := &svcsdk.RedirectActionConfig{} + f2elemf5 := &svcsdktypes.RedirectActionConfig{} if f2iter.RedirectConfig.Host != nil { - f2elemf5.SetHost(*f2iter.RedirectConfig.Host) + f2elemf5.Host = f2iter.RedirectConfig.Host } if f2iter.RedirectConfig.Path != nil { - f2elemf5.SetPath(*f2iter.RedirectConfig.Path) + f2elemf5.Path = f2iter.RedirectConfig.Path } if f2iter.RedirectConfig.Port != nil { - f2elemf5.SetPort(*f2iter.RedirectConfig.Port) + f2elemf5.Port = f2iter.RedirectConfig.Port } if f2iter.RedirectConfig.Protocol != nil { - f2elemf5.SetProtocol(*f2iter.RedirectConfig.Protocol) + f2elemf5.Protocol = f2iter.RedirectConfig.Protocol } if f2iter.RedirectConfig.Query != nil { - f2elemf5.SetQuery(*f2iter.RedirectConfig.Query) + f2elemf5.Query = f2iter.RedirectConfig.Query } if f2iter.RedirectConfig.StatusCode != nil { - f2elemf5.SetStatusCode(*f2iter.RedirectConfig.StatusCode) + f2elemf5.StatusCode = svcsdktypes.RedirectActionStatusCodeEnum(*f2iter.RedirectConfig.StatusCode) } - f2elem.SetRedirectConfig(f2elemf5) + f2elem.RedirectConfig = f2elemf5 } if f2iter.TargetGroupARN != nil { - f2elem.SetTargetGroupArn(*f2iter.TargetGroupARN) + f2elem.TargetGroupArn = f2iter.TargetGroupARN } if f2iter.Type != nil { - f2elem.SetType(*f2iter.Type) + f2elem.Type = svcsdktypes.ActionTypeEnum(*f2iter.Type) } - f2 = append(f2, f2elem) + f2 = append(f2, *f2elem) } - res.SetDefaultActions(f2) + res.DefaultActions = f2 } if r.ko.Status.ACKResourceMetadata != nil && r.ko.Status.ACKResourceMetadata.ARN != nil { - res.SetListenerArn(string(*r.ko.Status.ACKResourceMetadata.ARN)) + res.ListenerArn = (*string)(r.ko.Status.ACKResourceMetadata.ARN) } if r.ko.Spec.MutualAuthentication != nil { - f4 := &svcsdk.MutualAuthenticationAttributes{} + f4 := &svcsdktypes.MutualAuthenticationAttributes{} + if r.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames != nil { + f4.AdvertiseTrustStoreCaNames = svcsdktypes.AdvertiseTrustStoreCaNamesEnum(*r.ko.Spec.MutualAuthentication.AdvertiseTrustStoreCaNames) + } if r.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry != nil { - f4.SetIgnoreClientCertificateExpiry(*r.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry) + f4.IgnoreClientCertificateExpiry = r.ko.Spec.MutualAuthentication.IgnoreClientCertificateExpiry } if r.ko.Spec.MutualAuthentication.Mode != nil { - f4.SetMode(*r.ko.Spec.MutualAuthentication.Mode) + f4.Mode = r.ko.Spec.MutualAuthentication.Mode } if r.ko.Spec.MutualAuthentication.TrustStoreARN != nil { - f4.SetTrustStoreArn(*r.ko.Spec.MutualAuthentication.TrustStoreARN) + f4.TrustStoreArn = r.ko.Spec.MutualAuthentication.TrustStoreARN } - res.SetMutualAuthentication(f4) + if r.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus != nil { + f4.TrustStoreAssociationStatus = svcsdktypes.TrustStoreAssociationStatusEnum(*r.ko.Spec.MutualAuthentication.TrustStoreAssociationStatus) + } + res.MutualAuthentication = f4 } if r.ko.Spec.Port != nil { - res.SetPort(*r.ko.Spec.Port) + if *r.ko.Spec.Port > math.MaxInt32 || *r.ko.Spec.Port < math.MinInt32 { + return nil, fmt.Errorf("error: field Port is of type int32") + } + portCopy := int32(*r.ko.Spec.Port) + res.Port = &portCopy } if r.ko.Spec.Protocol != nil { - res.SetProtocol(*r.ko.Spec.Protocol) + res.Protocol = svcsdktypes.ProtocolEnum(*r.ko.Spec.Protocol) } if r.ko.Spec.SSLPolicy != nil { - res.SetSslPolicy(*r.ko.Spec.SSLPolicy) + res.SslPolicy = r.ko.Spec.SSLPolicy } return res, nil @@ -1374,7 +1361,7 @@ func (rm *resourceManager) sdkDelete( } var resp *svcsdk.DeleteListenerOutput _ = resp - resp, err = rm.sdkapi.DeleteListenerWithContext(ctx, input) + resp, err = rm.sdkapi.DeleteListener(ctx, input) rm.metrics.RecordAPICall("DELETE", "DeleteListener", err) return nil, err } @@ -1387,7 +1374,7 @@ func (rm *resourceManager) newDeleteRequestPayload( res := &svcsdk.DeleteListenerInput{} if r.ko.Status.ACKResourceMetadata != nil && r.ko.Status.ACKResourceMetadata.ARN != nil { - res.SetListenerArn(string(*r.ko.Status.ACKResourceMetadata.ARN)) + res.ListenerArn = (*string)(r.ko.Status.ACKResourceMetadata.ARN) } return res, nil @@ -1495,20 +1482,14 @@ func (rm *resourceManager) terminalAWSError(err error) bool { if err == nil { return false } - awsErr, ok := ackerr.AWSError(err) - if !ok { - return false - } - switch awsErr.Code() { - case "ValidationError", - "ALPNPolicyNotFound", - "DuplicateListener", - "IncompatibleProtocols", - "InvalidConfigurationRequest", - "InvalidLoadBalancerAction", - "SSLPolicyNotFound", - "UnsupportedProtocol", - "InvalidParameter": + switch err.(type) { + case *svcsdktypes.ALPNPolicyNotSupportedException, + *svcsdktypes.DuplicateListenerException, + *svcsdktypes.IncompatibleProtocolsException, + *svcsdktypes.InvalidConfigurationRequestException, + *svcsdktypes.InvalidLoadBalancerActionException, + *svcsdktypes.SSLPolicyNotFoundException, + *svcsdktypes.UnsupportedProtocolException: return true default: return false diff --git a/pkg/resource/load_balancer/delta.go b/pkg/resource/load_balancer/delta.go index 7fe74c0..bfec2bb 100644 --- a/pkg/resource/load_balancer/delta.go +++ b/pkg/resource/load_balancer/delta.go @@ -51,6 +51,13 @@ func newResourceDelta( delta.Add("Spec.CustomerOwnedIPv4Pool", a.ko.Spec.CustomerOwnedIPv4Pool, b.ko.Spec.CustomerOwnedIPv4Pool) } } + if ackcompare.HasNilDifference(a.ko.Spec.EnablePrefixForIPv6SourceNAT, b.ko.Spec.EnablePrefixForIPv6SourceNAT) { + delta.Add("Spec.EnablePrefixForIPv6SourceNAT", a.ko.Spec.EnablePrefixForIPv6SourceNAT, b.ko.Spec.EnablePrefixForIPv6SourceNAT) + } else if a.ko.Spec.EnablePrefixForIPv6SourceNAT != nil && b.ko.Spec.EnablePrefixForIPv6SourceNAT != nil { + if *a.ko.Spec.EnablePrefixForIPv6SourceNAT != *b.ko.Spec.EnablePrefixForIPv6SourceNAT { + delta.Add("Spec.EnablePrefixForIPv6SourceNAT", a.ko.Spec.EnablePrefixForIPv6SourceNAT, b.ko.Spec.EnablePrefixForIPv6SourceNAT) + } + } if ackcompare.HasNilDifference(a.ko.Spec.IPAddressType, b.ko.Spec.IPAddressType) { delta.Add("Spec.IPAddressType", a.ko.Spec.IPAddressType, b.ko.Spec.IPAddressType) } else if a.ko.Spec.IPAddressType != nil && b.ko.Spec.IPAddressType != nil { diff --git a/pkg/resource/load_balancer/hooks.go b/pkg/resource/load_balancer/hooks.go index 56922bd..fc1ed18 100644 --- a/pkg/resource/load_balancer/hooks.go +++ b/pkg/resource/load_balancer/hooks.go @@ -19,8 +19,9 @@ import ( svcapitypes "github.com/aws-controllers-k8s/elbv2-controller/apis/v1alpha1" ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" 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/elbv2" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" + svcsdktypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" ) // setResourceAdditionalFields will describe the fields that are not return by the @@ -53,7 +54,7 @@ func (rm *resourceManager) getLoadBalancerAttributes( attributes := []*svcapitypes.LoadBalancerAttribute{} var resp *svcsdk.DescribeLoadBalancerAttributesOutput - resp, err = rm.sdkapi.DescribeLoadBalancerAttributesWithContext(ctx, &svcsdk.DescribeLoadBalancerAttributesInput{ + resp, err = rm.sdkapi.DescribeLoadBalancerAttributes(ctx, &svcsdk.DescribeLoadBalancerAttributesInput{ LoadBalancerArn: (*string)(ko.Status.ACKResourceMetadata.ARN), }) rm.metrics.RecordAPICall("READ_ONE", "DescribeLoadBalancerAttributes", err) @@ -141,13 +142,13 @@ func (rm *resourceManager) updateLoadBalancerAttributes( var err error defer func() { exit(err) }() - sdkAttributes := []*svcsdk.LoadBalancerAttribute{} + sdkAttributes := []*svcsdktypes.LoadBalancerAttribute{} for _, attr := range desired.ko.Spec.Attributes { // Only set non-empty attributes if attr.Key == nil || attr.Value == nil || *attr.Key == "" || *attr.Value == "" { continue } - sdkAttribute := &svcsdk.LoadBalancerAttribute{ + sdkAttribute := &svcsdktypes.LoadBalancerAttribute{ Key: aws.String(*attr.Key), Value: aws.String(*attr.Value), } @@ -156,9 +157,12 @@ func (rm *resourceManager) updateLoadBalancerAttributes( input := &svcsdk.ModifyLoadBalancerAttributesInput{ LoadBalancerArn: (*string)(desired.ko.Status.ACKResourceMetadata.ARN), - Attributes: sdkAttributes, + Attributes: []svcsdktypes.LoadBalancerAttribute{}, } - _, err = rm.sdkapi.ModifyLoadBalancerAttributesWithContext(ctx, input) + for _, attr := range sdkAttributes { + input.Attributes = append(input.Attributes, *attr) + } + _, err = rm.sdkapi.ModifyLoadBalancerAttributes(ctx, input) rm.metrics.RecordAPICall("UPDATE", "ModifyLoadBalancerAttributes", err) if err != nil { return err diff --git a/pkg/resource/load_balancer/manager.go b/pkg/resource/load_balancer/manager.go index 3a7d33c..cdd0ba3 100644 --- a/pkg/resource/load_balancer/manager.go +++ b/pkg/resource/load_balancer/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/elbv2" - svcsdkapi "github.com/aws/aws-sdk-go/service/elbv2/elbv2iface" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" "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.ELBV2API + // 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/load_balancer/manager_factory.go b/pkg/resource/load_balancer/manager_factory.go index a69f024..e6cdfe7 100644 --- a/pkg/resource/load_balancer/manager_factory.go +++ b/pkg/resource/load_balancer/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/elbv2-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/load_balancer/sdk.go b/pkg/resource/load_balancer/sdk.go index e190d15..15e7b22 100644 --- a/pkg/resource/load_balancer/sdk.go +++ b/pkg/resource/load_balancer/sdk.go @@ -28,8 +28,9 @@ 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/elbv2" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" + svcsdktypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,8 +41,7 @@ import ( var ( _ = &metav1.Time{} _ = strings.ToLower("") - _ = &aws.JSONValue{} - _ = &svcsdk.ELBV2{} + _ = &svcsdk.Client{} _ = &svcapitypes.LoadBalancer{} _ = ackv1alpha1.AWSAccountID("") _ = &ackerr.NotFound @@ -49,6 +49,7 @@ var ( _ = &reflect.Value{} _ = fmt.Sprintf("") _ = &ackrequeue.NoRequeue{} + _ = &aws.Config{} ) // sdkFind returns SDK-specific information about a supplied resource @@ -73,10 +74,11 @@ func (rm *resourceManager) sdkFind( return nil, err } var resp *svcsdk.DescribeLoadBalancersOutput - resp, err = rm.sdkapi.DescribeLoadBalancersWithContext(ctx, input) + resp, err = rm.sdkapi.DescribeLoadBalancers(ctx, input) rm.metrics.RecordAPICall("READ_MANY", "DescribeLoadBalancers", err) if err != nil { - if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "LoadBalancerNotFound" { + var notFound *svcsdktypes.LoadBalancerNotFoundException + if errors.As(err, ¬Found) { return nil, ackerr.NotFound } return nil, err @@ -115,6 +117,9 @@ func (rm *resourceManager) sdkFind( if f0iter.OutpostId != nil { f0elem.OutpostID = f0iter.OutpostId } + if f0iter.SourceNatIpv6Prefixes != nil { + f0elem.SourceNATIPv6Prefixes = aws.StringSlice(f0iter.SourceNatIpv6Prefixes) + } if f0iter.SubnetId != nil { f0elem.SubnetID = f0iter.SubnetId } @@ -147,13 +152,18 @@ func (rm *resourceManager) sdkFind( } else { ko.Status.DNSName = nil } + if elem.EnablePrefixForIpv6SourceNat != "" { + ko.Spec.EnablePrefixForIPv6SourceNAT = aws.String(string(elem.EnablePrefixForIpv6SourceNat)) + } else { + ko.Spec.EnablePrefixForIPv6SourceNAT = nil + } if elem.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic != nil { ko.Status.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic = elem.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic } else { ko.Status.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic = nil } - if elem.IpAddressType != nil { - ko.Spec.IPAddressType = elem.IpAddressType + if elem.IpAddressType != "" { + ko.Spec.IPAddressType = aws.String(string(elem.IpAddressType)) } else { ko.Spec.IPAddressType = nil } @@ -169,36 +179,30 @@ func (rm *resourceManager) sdkFind( } else { ko.Spec.Name = nil } - if elem.Scheme != nil { - ko.Spec.Scheme = elem.Scheme + if elem.Scheme != "" { + ko.Spec.Scheme = aws.String(string(elem.Scheme)) } else { ko.Spec.Scheme = nil } if elem.SecurityGroups != nil { - f10 := []*string{} - for _, f10iter := range elem.SecurityGroups { - var f10elem string - f10elem = *f10iter - f10 = append(f10, &f10elem) - } - ko.Spec.SecurityGroups = f10 + ko.Spec.SecurityGroups = aws.StringSlice(elem.SecurityGroups) } else { ko.Spec.SecurityGroups = nil } if elem.State != nil { - f11 := &svcapitypes.LoadBalancerState{} - if elem.State.Code != nil { - f11.Code = elem.State.Code + f12 := &svcapitypes.LoadBalancerState{} + if elem.State.Code != "" { + f12.Code = aws.String(string(elem.State.Code)) } if elem.State.Reason != nil { - f11.Reason = elem.State.Reason + f12.Reason = elem.State.Reason } - ko.Status.State = f11 + ko.Status.State = f12 } else { ko.Status.State = nil } - if elem.Type != nil { - ko.Spec.Type = elem.Type + if elem.Type != "" { + ko.Spec.Type = aws.String(string(elem.Type)) } else { ko.Spec.Type = nil } @@ -240,9 +244,9 @@ func (rm *resourceManager) newListRequestPayload( res := &svcsdk.DescribeLoadBalancersInput{} if r.ko.Spec.Name != nil { - f2 := []*string{} - f2 = append(f2, r.ko.Spec.Name) - res.SetNames(f2) + f2 := []string{} + f2 = append(f2, *r.ko.Spec.Name) + res.Names = f2 } return res, nil @@ -267,7 +271,7 @@ func (rm *resourceManager) sdkCreate( var resp *svcsdk.CreateLoadBalancerOutput _ = resp - resp, err = rm.sdkapi.CreateLoadBalancerWithContext(ctx, input) + resp, err = rm.sdkapi.CreateLoadBalancer(ctx, input) rm.metrics.RecordAPICall("CREATE", "CreateLoadBalancer", err) if err != nil { return nil, err @@ -305,6 +309,9 @@ func (rm *resourceManager) sdkCreate( if f0iter.OutpostId != nil { f0elem.OutpostID = f0iter.OutpostId } + if f0iter.SourceNatIpv6Prefixes != nil { + f0elem.SourceNATIPv6Prefixes = aws.StringSlice(f0iter.SourceNatIpv6Prefixes) + } if f0iter.SubnetId != nil { f0elem.SubnetID = f0iter.SubnetId } @@ -337,13 +344,18 @@ func (rm *resourceManager) sdkCreate( } else { ko.Status.DNSName = nil } + if elem.EnablePrefixForIpv6SourceNat != "" { + ko.Spec.EnablePrefixForIPv6SourceNAT = aws.String(string(elem.EnablePrefixForIpv6SourceNat)) + } else { + ko.Spec.EnablePrefixForIPv6SourceNAT = nil + } if elem.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic != nil { ko.Status.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic = elem.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic } else { ko.Status.EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic = nil } - if elem.IpAddressType != nil { - ko.Spec.IPAddressType = elem.IpAddressType + if elem.IpAddressType != "" { + ko.Spec.IPAddressType = aws.String(string(elem.IpAddressType)) } else { ko.Spec.IPAddressType = nil } @@ -359,36 +371,30 @@ func (rm *resourceManager) sdkCreate( } else { ko.Spec.Name = nil } - if elem.Scheme != nil { - ko.Spec.Scheme = elem.Scheme + if elem.Scheme != "" { + ko.Spec.Scheme = aws.String(string(elem.Scheme)) } else { ko.Spec.Scheme = nil } if elem.SecurityGroups != nil { - f10 := []*string{} - for _, f10iter := range elem.SecurityGroups { - var f10elem string - f10elem = *f10iter - f10 = append(f10, &f10elem) - } - ko.Spec.SecurityGroups = f10 + ko.Spec.SecurityGroups = aws.StringSlice(elem.SecurityGroups) } else { ko.Spec.SecurityGroups = nil } if elem.State != nil { - f11 := &svcapitypes.LoadBalancerState{} - if elem.State.Code != nil { - f11.Code = elem.State.Code + f12 := &svcapitypes.LoadBalancerState{} + if elem.State.Code != "" { + f12.Code = aws.String(string(elem.State.Code)) } if elem.State.Reason != nil { - f11.Reason = elem.State.Reason + f12.Reason = elem.State.Reason } - ko.Status.State = f11 + ko.Status.State = f12 } else { ko.Status.State = nil } - if elem.Type != nil { - ko.Spec.Type = elem.Type + if elem.Type != "" { + ko.Spec.Type = aws.String(string(elem.Type)) } else { ko.Spec.Type = nil } @@ -417,71 +423,65 @@ func (rm *resourceManager) newCreateRequestPayload( res := &svcsdk.CreateLoadBalancerInput{} if r.ko.Spec.CustomerOwnedIPv4Pool != nil { - res.SetCustomerOwnedIpv4Pool(*r.ko.Spec.CustomerOwnedIPv4Pool) + res.CustomerOwnedIpv4Pool = r.ko.Spec.CustomerOwnedIPv4Pool + } + if r.ko.Spec.EnablePrefixForIPv6SourceNAT != nil { + res.EnablePrefixForIpv6SourceNat = svcsdktypes.EnablePrefixForIpv6SourceNatEnum(*r.ko.Spec.EnablePrefixForIPv6SourceNAT) } if r.ko.Spec.IPAddressType != nil { - res.SetIpAddressType(*r.ko.Spec.IPAddressType) + res.IpAddressType = svcsdktypes.IpAddressType(*r.ko.Spec.IPAddressType) } if r.ko.Spec.Name != nil { - res.SetName(*r.ko.Spec.Name) + res.Name = r.ko.Spec.Name } if r.ko.Spec.Scheme != nil { - res.SetScheme(*r.ko.Spec.Scheme) + res.Scheme = svcsdktypes.LoadBalancerSchemeEnum(*r.ko.Spec.Scheme) } if r.ko.Spec.SecurityGroups != nil { - f4 := []*string{} - for _, f4iter := range r.ko.Spec.SecurityGroups { - var f4elem string - f4elem = *f4iter - f4 = append(f4, &f4elem) - } - res.SetSecurityGroups(f4) + res.SecurityGroups = aws.ToStringSlice(r.ko.Spec.SecurityGroups) } if r.ko.Spec.SubnetMappings != nil { - f5 := []*svcsdk.SubnetMapping{} - for _, f5iter := range r.ko.Spec.SubnetMappings { - f5elem := &svcsdk.SubnetMapping{} - if f5iter.AllocationID != nil { - f5elem.SetAllocationId(*f5iter.AllocationID) + f6 := []svcsdktypes.SubnetMapping{} + for _, f6iter := range r.ko.Spec.SubnetMappings { + f6elem := &svcsdktypes.SubnetMapping{} + if f6iter.AllocationID != nil { + f6elem.AllocationId = f6iter.AllocationID + } + if f6iter.IPv6Address != nil { + f6elem.IPv6Address = f6iter.IPv6Address } - if f5iter.IPv6Address != nil { - f5elem.SetIPv6Address(*f5iter.IPv6Address) + if f6iter.PrivateIPv4Address != nil { + f6elem.PrivateIPv4Address = f6iter.PrivateIPv4Address } - if f5iter.PrivateIPv4Address != nil { - f5elem.SetPrivateIPv4Address(*f5iter.PrivateIPv4Address) + if f6iter.SourceNATIPv6Prefix != nil { + f6elem.SourceNatIpv6Prefix = f6iter.SourceNATIPv6Prefix } - if f5iter.SubnetID != nil { - f5elem.SetSubnetId(*f5iter.SubnetID) + if f6iter.SubnetID != nil { + f6elem.SubnetId = f6iter.SubnetID } - f5 = append(f5, f5elem) + f6 = append(f6, *f6elem) } - res.SetSubnetMappings(f5) + res.SubnetMappings = f6 } if r.ko.Spec.Subnets != nil { - f6 := []*string{} - for _, f6iter := range r.ko.Spec.Subnets { - var f6elem string - f6elem = *f6iter - f6 = append(f6, &f6elem) - } - res.SetSubnets(f6) + res.Subnets = aws.ToStringSlice(r.ko.Spec.Subnets) } if r.ko.Spec.Tags != nil { - f7 := []*svcsdk.Tag{} - for _, f7iter := range r.ko.Spec.Tags { - f7elem := &svcsdk.Tag{} - if f7iter.Key != nil { - f7elem.SetKey(*f7iter.Key) + f8 := []svcsdktypes.Tag{} + for _, f8iter := range r.ko.Spec.Tags { + f8elem := &svcsdktypes.Tag{} + if f8iter.Key != nil { + f8elem.Key = f8iter.Key } - if f7iter.Value != nil { - f7elem.SetValue(*f7iter.Value) + if f8iter.Value != nil { + f8elem.Value = f8iter.Value } - f7 = append(f7, f7elem) + f8 = append(f8, *f8elem) } - res.SetTags(f7) + res.Tags = f8 } if r.ko.Spec.Type != nil { - res.SetType(*r.ko.Spec.Type) + res.Type = svcsdktypes.LoadBalancerTypeEnum(*r.ko.Spec.Type) } return res, nil @@ -514,7 +514,7 @@ func (rm *resourceManager) sdkDelete( } var resp *svcsdk.DeleteLoadBalancerOutput _ = resp - resp, err = rm.sdkapi.DeleteLoadBalancerWithContext(ctx, input) + resp, err = rm.sdkapi.DeleteLoadBalancer(ctx, input) rm.metrics.RecordAPICall("DELETE", "DeleteLoadBalancer", err) return nil, err } @@ -527,7 +527,7 @@ func (rm *resourceManager) newDeleteRequestPayload( res := &svcsdk.DeleteLoadBalancerInput{} if r.ko.Status.ACKResourceMetadata != nil && r.ko.Status.ACKResourceMetadata.ARN != nil { - res.SetLoadBalancerArn(string(*r.ko.Status.ACKResourceMetadata.ARN)) + res.LoadBalancerArn = (*string)(r.ko.Status.ACKResourceMetadata.ARN) } return res, nil @@ -635,14 +635,9 @@ func (rm *resourceManager) terminalAWSError(err error) bool { if err == nil { return false } - awsErr, ok := ackerr.AWSError(err) - if !ok { - return false - } - switch awsErr.Code() { - case "ValidationError", - "InvalidConfigurationRequest", - "InvalidScheme": + switch err.(type) { + case *svcsdktypes.InvalidConfigurationRequestException, + *svcsdktypes.InvalidSchemeException: return true default: return false diff --git a/pkg/resource/rule/hooks.go b/pkg/resource/rule/hooks.go index 79ec3f0..c89128b 100644 --- a/pkg/resource/rule/hooks.go +++ b/pkg/resource/rule/hooks.go @@ -19,7 +19,9 @@ import ( "strconv" ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" - svcsdk "github.com/aws/aws-sdk-go/service/elbv2" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" + svcsdktypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" ) var ( @@ -37,14 +39,14 @@ func (rm *resourceManager) setRulePriority( defer func() { exit(err) }() input := &svcsdk.SetRulePrioritiesInput{ - RulePriorities: []*svcsdk.RulePriorityPair{ + RulePriorities: []svcsdktypes.RulePriorityPair{ { - Priority: res.ko.Spec.Priority, + Priority: aws.Int32(int32(*res.ko.Spec.Priority)), RuleArn: (*string)(res.ko.Status.ACKResourceMetadata.ARN), }, }, } - _, err = rm.sdkapi.SetRulePrioritiesWithContext(ctx, input) + _, err = rm.sdkapi.SetRulePriorities(ctx, input) rm.metrics.RecordAPICall("UPDATE", "UpdateRule", err) if err != nil { return err diff --git a/pkg/resource/rule/manager.go b/pkg/resource/rule/manager.go index 8e60a30..a6f9f71 100644 --- a/pkg/resource/rule/manager.go +++ b/pkg/resource/rule/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/elbv2" - svcsdkapi "github.com/aws/aws-sdk-go/service/elbv2/elbv2iface" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" "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.ELBV2API + // 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 @@ -289,24 +288,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/rule/manager_factory.go b/pkg/resource/rule/manager_factory.go index 02de2d3..03a0810 100644 --- a/pkg/resource/rule/manager_factory.go +++ b/pkg/resource/rule/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/elbv2-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/rule/references.go b/pkg/resource/rule/references.go index e41a23e..a96bf56 100644 --- a/pkg/resource/rule/references.go +++ b/pkg/resource/rule/references.go @@ -30,6 +30,12 @@ import ( svcapitypes "github.com/aws-controllers-k8s/elbv2-controller/apis/v1alpha1" ) +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=targetgroups,verbs=get;list +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=targetgroups/status,verbs=get;list + +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=listeners,verbs=get;list +// +kubebuilder:rbac:groups=elbv2.services.k8s.aws,resources=listeners/status,verbs=get;list + // ClearResolvedReferences removes any reference values that were made // concrete in the spec. It returns a copy of the input AWSResource which // contains the original *Ref values, but none of their respective concrete diff --git a/pkg/resource/rule/sdk.go b/pkg/resource/rule/sdk.go index b9a4cdd..7ad6129 100644 --- a/pkg/resource/rule/sdk.go +++ b/pkg/resource/rule/sdk.go @@ -19,6 +19,7 @@ import ( "context" "errors" "fmt" + "math" "reflect" "strings" @@ -28,8 +29,9 @@ 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/elbv2" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" + svcsdktypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,8 +42,7 @@ import ( var ( _ = &metav1.Time{} _ = strings.ToLower("") - _ = &aws.JSONValue{} - _ = &svcsdk.ELBV2{} + _ = &svcsdk.Client{} _ = &svcapitypes.Rule{} _ = ackv1alpha1.AWSAccountID("") _ = &ackerr.NotFound @@ -49,6 +50,7 @@ var ( _ = &reflect.Value{} _ = fmt.Sprintf("") _ = &ackrequeue.NoRequeue{} + _ = &aws.Config{} ) // sdkFind returns SDK-specific information about a supplied resource @@ -73,15 +75,16 @@ func (rm *resourceManager) sdkFind( return nil, err } // The ARN is guaranteed to be checked by the sdkFind method. We can safely cast it here. - input.SetRuleArns([]*string{(*string)(r.ko.Status.ACKResourceMetadata.ARN)}) + input.RuleArns = []string{(string)(*r.ko.Status.ACKResourceMetadata.ARN)} // Unset the LoadBalancerArn field since we can't set both ListenerArn and LoadBalancerArn // Probably needs to be done in the code-generator. @a-hilaly. input.ListenerArn = nil var resp *svcsdk.DescribeRulesOutput - resp, err = rm.sdkapi.DescribeRulesWithContext(ctx, input) + resp, err = rm.sdkapi.DescribeRules(ctx, input) rm.metrics.RecordAPICall("READ_MANY", "DescribeRules", err) if err != nil { - if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "RuleNotFound" { + var notFound *svcsdktypes.RuleNotFoundException + if errors.As(err, ¬Found) { return nil, ackerr.NotFound } return nil, err @@ -100,16 +103,10 @@ func (rm *resourceManager) sdkFind( if f0iter.AuthenticateCognitoConfig != nil { f0elemf0 := &svcapitypes.AuthenticateCognitoActionConfig{} if f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f0elemf0f0 := map[string]*string{} - for f0elemf0f0key, f0elemf0f0valiter := range f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f0elemf0f0val string - f0elemf0f0val = *f0elemf0f0valiter - f0elemf0f0[f0elemf0f0key] = &f0elemf0f0val - } - f0elemf0.AuthenticationRequestExtraParams = f0elemf0f0 + f0elemf0.AuthenticationRequestExtraParams = aws.StringMap(f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } - if f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f0elemf0.OnUnauthenticatedRequest = f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest + if f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != "" { + f0elemf0.OnUnauthenticatedRequest = aws.String(string(f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest)) } if f0iter.AuthenticateCognitoConfig.Scope != nil { f0elemf0.Scope = f0iter.AuthenticateCognitoConfig.Scope @@ -134,13 +131,7 @@ func (rm *resourceManager) sdkFind( if f0iter.AuthenticateOidcConfig != nil { f0elemf1 := &svcapitypes.AuthenticateOIDCActionConfig{} if f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams != nil { - f0elemf1f0 := map[string]*string{} - for f0elemf1f0key, f0elemf1f0valiter := range f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams { - var f0elemf1f0val string - f0elemf1f0val = *f0elemf1f0valiter - f0elemf1f0[f0elemf1f0key] = &f0elemf1f0val - } - f0elemf1.AuthenticationRequestExtraParams = f0elemf1f0 + f0elemf1.AuthenticationRequestExtraParams = aws.StringMap(f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams) } if f0iter.AuthenticateOidcConfig.AuthorizationEndpoint != nil { f0elemf1.AuthorizationEndpoint = f0iter.AuthenticateOidcConfig.AuthorizationEndpoint @@ -154,8 +145,8 @@ func (rm *resourceManager) sdkFind( if f0iter.AuthenticateOidcConfig.Issuer != nil { f0elemf1.Issuer = f0iter.AuthenticateOidcConfig.Issuer } - if f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != nil { - f0elemf1.OnUnauthenticatedRequest = f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest + if f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != "" { + f0elemf1.OnUnauthenticatedRequest = aws.String(string(f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest)) } if f0iter.AuthenticateOidcConfig.Scope != nil { f0elemf1.Scope = f0iter.AuthenticateOidcConfig.Scope @@ -195,7 +186,8 @@ func (rm *resourceManager) sdkFind( if f0iter.ForwardConfig.TargetGroupStickinessConfig != nil { f0elemf3f0 := &svcapitypes.TargetGroupStickinessConfig{} if f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f0elemf3f0.DurationSeconds = f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds + durationSecondsCopy := int64(*f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f0elemf3f0.DurationSeconds = &durationSecondsCopy } if f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { f0elemf3f0.Enabled = f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled @@ -210,7 +202,8 @@ func (rm *resourceManager) sdkFind( f0elemf3f1elem.TargetGroupARN = f0elemf3f1iter.TargetGroupArn } if f0elemf3f1iter.Weight != nil { - f0elemf3f1elem.Weight = f0elemf3f1iter.Weight + weightCopy := int64(*f0elemf3f1iter.Weight) + f0elemf3f1elem.Weight = &weightCopy } f0elemf3f1 = append(f0elemf3f1, f0elemf3f1elem) } @@ -219,7 +212,8 @@ func (rm *resourceManager) sdkFind( f0elem.ForwardConfig = f0elemf3 } if f0iter.Order != nil { - f0elem.Order = f0iter.Order + orderCopy := int64(*f0iter.Order) + f0elem.Order = &orderCopy } if f0iter.RedirectConfig != nil { f0elemf5 := &svcapitypes.RedirectActionConfig{} @@ -238,16 +232,16 @@ func (rm *resourceManager) sdkFind( if f0iter.RedirectConfig.Query != nil { f0elemf5.Query = f0iter.RedirectConfig.Query } - if f0iter.RedirectConfig.StatusCode != nil { - f0elemf5.StatusCode = f0iter.RedirectConfig.StatusCode + if f0iter.RedirectConfig.StatusCode != "" { + f0elemf5.StatusCode = aws.String(string(f0iter.RedirectConfig.StatusCode)) } f0elem.RedirectConfig = f0elemf5 } if f0iter.TargetGroupArn != nil { f0elem.TargetGroupARN = f0iter.TargetGroupArn } - if f0iter.Type != nil { - f0elem.Type = f0iter.Type + if f0iter.Type != "" { + f0elem.Type = aws.String(string(f0iter.Type)) } f0 = append(f0, f0elem) } @@ -265,13 +259,7 @@ func (rm *resourceManager) sdkFind( if f1iter.HostHeaderConfig != nil { f1elemf1 := &svcapitypes.HostHeaderConditionConfig{} if f1iter.HostHeaderConfig.Values != nil { - f1elemf1f0 := []*string{} - for _, f1elemf1f0iter := range f1iter.HostHeaderConfig.Values { - var f1elemf1f0elem string - f1elemf1f0elem = *f1elemf1f0iter - f1elemf1f0 = append(f1elemf1f0, &f1elemf1f0elem) - } - f1elemf1.Values = f1elemf1f0 + f1elemf1.Values = aws.StringSlice(f1iter.HostHeaderConfig.Values) } f1elem.HostHeaderConfig = f1elemf1 } @@ -281,39 +269,21 @@ func (rm *resourceManager) sdkFind( f1elemf2.HTTPHeaderName = f1iter.HttpHeaderConfig.HttpHeaderName } if f1iter.HttpHeaderConfig.Values != nil { - f1elemf2f1 := []*string{} - for _, f1elemf2f1iter := range f1iter.HttpHeaderConfig.Values { - var f1elemf2f1elem string - f1elemf2f1elem = *f1elemf2f1iter - f1elemf2f1 = append(f1elemf2f1, &f1elemf2f1elem) - } - f1elemf2.Values = f1elemf2f1 + f1elemf2.Values = aws.StringSlice(f1iter.HttpHeaderConfig.Values) } f1elem.HTTPHeaderConfig = f1elemf2 } if f1iter.HttpRequestMethodConfig != nil { f1elemf3 := &svcapitypes.HTTPRequestMethodConditionConfig{} if f1iter.HttpRequestMethodConfig.Values != nil { - f1elemf3f0 := []*string{} - for _, f1elemf3f0iter := range f1iter.HttpRequestMethodConfig.Values { - var f1elemf3f0elem string - f1elemf3f0elem = *f1elemf3f0iter - f1elemf3f0 = append(f1elemf3f0, &f1elemf3f0elem) - } - f1elemf3.Values = f1elemf3f0 + f1elemf3.Values = aws.StringSlice(f1iter.HttpRequestMethodConfig.Values) } f1elem.HTTPRequestMethodConfig = f1elemf3 } if f1iter.PathPatternConfig != nil { f1elemf4 := &svcapitypes.PathPatternConditionConfig{} if f1iter.PathPatternConfig.Values != nil { - f1elemf4f0 := []*string{} - for _, f1elemf4f0iter := range f1iter.PathPatternConfig.Values { - var f1elemf4f0elem string - f1elemf4f0elem = *f1elemf4f0iter - f1elemf4f0 = append(f1elemf4f0, &f1elemf4f0elem) - } - f1elemf4.Values = f1elemf4f0 + f1elemf4.Values = aws.StringSlice(f1iter.PathPatternConfig.Values) } f1elem.PathPatternConfig = f1elemf4 } @@ -338,24 +308,12 @@ func (rm *resourceManager) sdkFind( if f1iter.SourceIpConfig != nil { f1elemf6 := &svcapitypes.SourceIPConditionConfig{} if f1iter.SourceIpConfig.Values != nil { - f1elemf6f0 := []*string{} - for _, f1elemf6f0iter := range f1iter.SourceIpConfig.Values { - var f1elemf6f0elem string - f1elemf6f0elem = *f1elemf6f0iter - f1elemf6f0 = append(f1elemf6f0, &f1elemf6f0elem) - } - f1elemf6.Values = f1elemf6f0 + f1elemf6.Values = aws.StringSlice(f1iter.SourceIpConfig.Values) } f1elem.SourceIPConfig = f1elemf6 } if f1iter.Values != nil { - f1elemf7 := []*string{} - for _, f1elemf7iter := range f1iter.Values { - var f1elemf7elem string - f1elemf7elem = *f1elemf7iter - f1elemf7 = append(f1elemf7, &f1elemf7elem) - } - f1elem.Values = f1elemf7 + f1elem.Values = aws.StringSlice(f1iter.Values) } f1 = append(f1, f1elem) } @@ -405,7 +363,7 @@ func (rm *resourceManager) newListRequestPayload( res := &svcsdk.DescribeRulesInput{} if r.ko.Spec.ListenerARN != nil { - res.SetListenerArn(*r.ko.Spec.ListenerARN) + res.ListenerArn = r.ko.Spec.ListenerARN } return res, nil @@ -430,7 +388,7 @@ func (rm *resourceManager) sdkCreate( var resp *svcsdk.CreateRuleOutput _ = resp - resp, err = rm.sdkapi.CreateRuleWithContext(ctx, input) + resp, err = rm.sdkapi.CreateRule(ctx, input) rm.metrics.RecordAPICall("CREATE", "CreateRule", err) if err != nil { return nil, err @@ -448,16 +406,10 @@ func (rm *resourceManager) sdkCreate( if f0iter.AuthenticateCognitoConfig != nil { f0elemf0 := &svcapitypes.AuthenticateCognitoActionConfig{} if f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f0elemf0f0 := map[string]*string{} - for f0elemf0f0key, f0elemf0f0valiter := range f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f0elemf0f0val string - f0elemf0f0val = *f0elemf0f0valiter - f0elemf0f0[f0elemf0f0key] = &f0elemf0f0val - } - f0elemf0.AuthenticationRequestExtraParams = f0elemf0f0 + f0elemf0.AuthenticationRequestExtraParams = aws.StringMap(f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } - if f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f0elemf0.OnUnauthenticatedRequest = f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest + if f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != "" { + f0elemf0.OnUnauthenticatedRequest = aws.String(string(f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest)) } if f0iter.AuthenticateCognitoConfig.Scope != nil { f0elemf0.Scope = f0iter.AuthenticateCognitoConfig.Scope @@ -482,13 +434,7 @@ func (rm *resourceManager) sdkCreate( if f0iter.AuthenticateOidcConfig != nil { f0elemf1 := &svcapitypes.AuthenticateOIDCActionConfig{} if f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams != nil { - f0elemf1f0 := map[string]*string{} - for f0elemf1f0key, f0elemf1f0valiter := range f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams { - var f0elemf1f0val string - f0elemf1f0val = *f0elemf1f0valiter - f0elemf1f0[f0elemf1f0key] = &f0elemf1f0val - } - f0elemf1.AuthenticationRequestExtraParams = f0elemf1f0 + f0elemf1.AuthenticationRequestExtraParams = aws.StringMap(f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams) } if f0iter.AuthenticateOidcConfig.AuthorizationEndpoint != nil { f0elemf1.AuthorizationEndpoint = f0iter.AuthenticateOidcConfig.AuthorizationEndpoint @@ -502,8 +448,8 @@ func (rm *resourceManager) sdkCreate( if f0iter.AuthenticateOidcConfig.Issuer != nil { f0elemf1.Issuer = f0iter.AuthenticateOidcConfig.Issuer } - if f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != nil { - f0elemf1.OnUnauthenticatedRequest = f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest + if f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != "" { + f0elemf1.OnUnauthenticatedRequest = aws.String(string(f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest)) } if f0iter.AuthenticateOidcConfig.Scope != nil { f0elemf1.Scope = f0iter.AuthenticateOidcConfig.Scope @@ -543,7 +489,8 @@ func (rm *resourceManager) sdkCreate( if f0iter.ForwardConfig.TargetGroupStickinessConfig != nil { f0elemf3f0 := &svcapitypes.TargetGroupStickinessConfig{} if f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f0elemf3f0.DurationSeconds = f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds + durationSecondsCopy := int64(*f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f0elemf3f0.DurationSeconds = &durationSecondsCopy } if f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { f0elemf3f0.Enabled = f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled @@ -558,7 +505,8 @@ func (rm *resourceManager) sdkCreate( f0elemf3f1elem.TargetGroupARN = f0elemf3f1iter.TargetGroupArn } if f0elemf3f1iter.Weight != nil { - f0elemf3f1elem.Weight = f0elemf3f1iter.Weight + weightCopy := int64(*f0elemf3f1iter.Weight) + f0elemf3f1elem.Weight = &weightCopy } f0elemf3f1 = append(f0elemf3f1, f0elemf3f1elem) } @@ -567,7 +515,8 @@ func (rm *resourceManager) sdkCreate( f0elem.ForwardConfig = f0elemf3 } if f0iter.Order != nil { - f0elem.Order = f0iter.Order + orderCopy := int64(*f0iter.Order) + f0elem.Order = &orderCopy } if f0iter.RedirectConfig != nil { f0elemf5 := &svcapitypes.RedirectActionConfig{} @@ -586,16 +535,16 @@ func (rm *resourceManager) sdkCreate( if f0iter.RedirectConfig.Query != nil { f0elemf5.Query = f0iter.RedirectConfig.Query } - if f0iter.RedirectConfig.StatusCode != nil { - f0elemf5.StatusCode = f0iter.RedirectConfig.StatusCode + if f0iter.RedirectConfig.StatusCode != "" { + f0elemf5.StatusCode = aws.String(string(f0iter.RedirectConfig.StatusCode)) } f0elem.RedirectConfig = f0elemf5 } if f0iter.TargetGroupArn != nil { f0elem.TargetGroupARN = f0iter.TargetGroupArn } - if f0iter.Type != nil { - f0elem.Type = f0iter.Type + if f0iter.Type != "" { + f0elem.Type = aws.String(string(f0iter.Type)) } f0 = append(f0, f0elem) } @@ -613,13 +562,7 @@ func (rm *resourceManager) sdkCreate( if f1iter.HostHeaderConfig != nil { f1elemf1 := &svcapitypes.HostHeaderConditionConfig{} if f1iter.HostHeaderConfig.Values != nil { - f1elemf1f0 := []*string{} - for _, f1elemf1f0iter := range f1iter.HostHeaderConfig.Values { - var f1elemf1f0elem string - f1elemf1f0elem = *f1elemf1f0iter - f1elemf1f0 = append(f1elemf1f0, &f1elemf1f0elem) - } - f1elemf1.Values = f1elemf1f0 + f1elemf1.Values = aws.StringSlice(f1iter.HostHeaderConfig.Values) } f1elem.HostHeaderConfig = f1elemf1 } @@ -629,39 +572,21 @@ func (rm *resourceManager) sdkCreate( f1elemf2.HTTPHeaderName = f1iter.HttpHeaderConfig.HttpHeaderName } if f1iter.HttpHeaderConfig.Values != nil { - f1elemf2f1 := []*string{} - for _, f1elemf2f1iter := range f1iter.HttpHeaderConfig.Values { - var f1elemf2f1elem string - f1elemf2f1elem = *f1elemf2f1iter - f1elemf2f1 = append(f1elemf2f1, &f1elemf2f1elem) - } - f1elemf2.Values = f1elemf2f1 + f1elemf2.Values = aws.StringSlice(f1iter.HttpHeaderConfig.Values) } f1elem.HTTPHeaderConfig = f1elemf2 } if f1iter.HttpRequestMethodConfig != nil { f1elemf3 := &svcapitypes.HTTPRequestMethodConditionConfig{} if f1iter.HttpRequestMethodConfig.Values != nil { - f1elemf3f0 := []*string{} - for _, f1elemf3f0iter := range f1iter.HttpRequestMethodConfig.Values { - var f1elemf3f0elem string - f1elemf3f0elem = *f1elemf3f0iter - f1elemf3f0 = append(f1elemf3f0, &f1elemf3f0elem) - } - f1elemf3.Values = f1elemf3f0 + f1elemf3.Values = aws.StringSlice(f1iter.HttpRequestMethodConfig.Values) } f1elem.HTTPRequestMethodConfig = f1elemf3 } if f1iter.PathPatternConfig != nil { f1elemf4 := &svcapitypes.PathPatternConditionConfig{} if f1iter.PathPatternConfig.Values != nil { - f1elemf4f0 := []*string{} - for _, f1elemf4f0iter := range f1iter.PathPatternConfig.Values { - var f1elemf4f0elem string - f1elemf4f0elem = *f1elemf4f0iter - f1elemf4f0 = append(f1elemf4f0, &f1elemf4f0elem) - } - f1elemf4.Values = f1elemf4f0 + f1elemf4.Values = aws.StringSlice(f1iter.PathPatternConfig.Values) } f1elem.PathPatternConfig = f1elemf4 } @@ -686,24 +611,12 @@ func (rm *resourceManager) sdkCreate( if f1iter.SourceIpConfig != nil { f1elemf6 := &svcapitypes.SourceIPConditionConfig{} if f1iter.SourceIpConfig.Values != nil { - f1elemf6f0 := []*string{} - for _, f1elemf6f0iter := range f1iter.SourceIpConfig.Values { - var f1elemf6f0elem string - f1elemf6f0elem = *f1elemf6f0iter - f1elemf6f0 = append(f1elemf6f0, &f1elemf6f0elem) - } - f1elemf6.Values = f1elemf6f0 + f1elemf6.Values = aws.StringSlice(f1iter.SourceIpConfig.Values) } f1elem.SourceIPConfig = f1elemf6 } if f1iter.Values != nil { - f1elemf7 := []*string{} - for _, f1elemf7iter := range f1iter.Values { - var f1elemf7elem string - f1elemf7elem = *f1elemf7iter - f1elemf7 = append(f1elemf7, &f1elemf7elem) - } - f1elem.Values = f1elemf7 + f1elem.Values = aws.StringSlice(f1iter.Values) } f1 = append(f1, f1elem) } @@ -743,290 +656,258 @@ func (rm *resourceManager) newCreateRequestPayload( res := &svcsdk.CreateRuleInput{} if r.ko.Spec.Actions != nil { - f0 := []*svcsdk.Action{} + f0 := []svcsdktypes.Action{} for _, f0iter := range r.ko.Spec.Actions { - f0elem := &svcsdk.Action{} + f0elem := &svcsdktypes.Action{} if f0iter.AuthenticateCognitoConfig != nil { - f0elemf0 := &svcsdk.AuthenticateCognitoActionConfig{} + f0elemf0 := &svcsdktypes.AuthenticateCognitoActionConfig{} if f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f0elemf0f0 := map[string]*string{} - for f0elemf0f0key, f0elemf0f0valiter := range f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f0elemf0f0val string - f0elemf0f0val = *f0elemf0f0valiter - f0elemf0f0[f0elemf0f0key] = &f0elemf0f0val - } - f0elemf0.SetAuthenticationRequestExtraParams(f0elemf0f0) + f0elemf0.AuthenticationRequestExtraParams = aws.ToStringMap(f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } if f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f0elemf0.SetOnUnauthenticatedRequest(*f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest) + f0elemf0.OnUnauthenticatedRequest = svcsdktypes.AuthenticateCognitoActionConditionalBehaviorEnum(*f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest) } if f0iter.AuthenticateCognitoConfig.Scope != nil { - f0elemf0.SetScope(*f0iter.AuthenticateCognitoConfig.Scope) + f0elemf0.Scope = f0iter.AuthenticateCognitoConfig.Scope } if f0iter.AuthenticateCognitoConfig.SessionCookieName != nil { - f0elemf0.SetSessionCookieName(*f0iter.AuthenticateCognitoConfig.SessionCookieName) + f0elemf0.SessionCookieName = f0iter.AuthenticateCognitoConfig.SessionCookieName } if f0iter.AuthenticateCognitoConfig.SessionTimeout != nil { - f0elemf0.SetSessionTimeout(*f0iter.AuthenticateCognitoConfig.SessionTimeout) + f0elemf0.SessionTimeout = f0iter.AuthenticateCognitoConfig.SessionTimeout } if f0iter.AuthenticateCognitoConfig.UserPoolARN != nil { - f0elemf0.SetUserPoolArn(*f0iter.AuthenticateCognitoConfig.UserPoolARN) + f0elemf0.UserPoolArn = f0iter.AuthenticateCognitoConfig.UserPoolARN } if f0iter.AuthenticateCognitoConfig.UserPoolClientID != nil { - f0elemf0.SetUserPoolClientId(*f0iter.AuthenticateCognitoConfig.UserPoolClientID) + f0elemf0.UserPoolClientId = f0iter.AuthenticateCognitoConfig.UserPoolClientID } if f0iter.AuthenticateCognitoConfig.UserPoolDomain != nil { - f0elemf0.SetUserPoolDomain(*f0iter.AuthenticateCognitoConfig.UserPoolDomain) + f0elemf0.UserPoolDomain = f0iter.AuthenticateCognitoConfig.UserPoolDomain } - f0elem.SetAuthenticateCognitoConfig(f0elemf0) + f0elem.AuthenticateCognitoConfig = f0elemf0 } if f0iter.AuthenticateOIDCConfig != nil { - f0elemf1 := &svcsdk.AuthenticateOidcActionConfig{} + f0elemf1 := &svcsdktypes.AuthenticateOidcActionConfig{} if f0iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams != nil { - f0elemf1f0 := map[string]*string{} - for f0elemf1f0key, f0elemf1f0valiter := range f0iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams { - var f0elemf1f0val string - f0elemf1f0val = *f0elemf1f0valiter - f0elemf1f0[f0elemf1f0key] = &f0elemf1f0val - } - f0elemf1.SetAuthenticationRequestExtraParams(f0elemf1f0) + f0elemf1.AuthenticationRequestExtraParams = aws.ToStringMap(f0iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams) } if f0iter.AuthenticateOIDCConfig.AuthorizationEndpoint != nil { - f0elemf1.SetAuthorizationEndpoint(*f0iter.AuthenticateOIDCConfig.AuthorizationEndpoint) + f0elemf1.AuthorizationEndpoint = f0iter.AuthenticateOIDCConfig.AuthorizationEndpoint } if f0iter.AuthenticateOIDCConfig.ClientID != nil { - f0elemf1.SetClientId(*f0iter.AuthenticateOIDCConfig.ClientID) + f0elemf1.ClientId = f0iter.AuthenticateOIDCConfig.ClientID } if f0iter.AuthenticateOIDCConfig.ClientSecret != nil { - f0elemf1.SetClientSecret(*f0iter.AuthenticateOIDCConfig.ClientSecret) + f0elemf1.ClientSecret = f0iter.AuthenticateOIDCConfig.ClientSecret } if f0iter.AuthenticateOIDCConfig.Issuer != nil { - f0elemf1.SetIssuer(*f0iter.AuthenticateOIDCConfig.Issuer) + f0elemf1.Issuer = f0iter.AuthenticateOIDCConfig.Issuer } if f0iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest != nil { - f0elemf1.SetOnUnauthenticatedRequest(*f0iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest) + f0elemf1.OnUnauthenticatedRequest = svcsdktypes.AuthenticateOidcActionConditionalBehaviorEnum(*f0iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest) } if f0iter.AuthenticateOIDCConfig.Scope != nil { - f0elemf1.SetScope(*f0iter.AuthenticateOIDCConfig.Scope) + f0elemf1.Scope = f0iter.AuthenticateOIDCConfig.Scope } if f0iter.AuthenticateOIDCConfig.SessionCookieName != nil { - f0elemf1.SetSessionCookieName(*f0iter.AuthenticateOIDCConfig.SessionCookieName) + f0elemf1.SessionCookieName = f0iter.AuthenticateOIDCConfig.SessionCookieName } if f0iter.AuthenticateOIDCConfig.SessionTimeout != nil { - f0elemf1.SetSessionTimeout(*f0iter.AuthenticateOIDCConfig.SessionTimeout) + f0elemf1.SessionTimeout = f0iter.AuthenticateOIDCConfig.SessionTimeout } if f0iter.AuthenticateOIDCConfig.TokenEndpoint != nil { - f0elemf1.SetTokenEndpoint(*f0iter.AuthenticateOIDCConfig.TokenEndpoint) + f0elemf1.TokenEndpoint = f0iter.AuthenticateOIDCConfig.TokenEndpoint } if f0iter.AuthenticateOIDCConfig.UseExistingClientSecret != nil { - f0elemf1.SetUseExistingClientSecret(*f0iter.AuthenticateOIDCConfig.UseExistingClientSecret) + f0elemf1.UseExistingClientSecret = f0iter.AuthenticateOIDCConfig.UseExistingClientSecret } if f0iter.AuthenticateOIDCConfig.UserInfoEndpoint != nil { - f0elemf1.SetUserInfoEndpoint(*f0iter.AuthenticateOIDCConfig.UserInfoEndpoint) + f0elemf1.UserInfoEndpoint = f0iter.AuthenticateOIDCConfig.UserInfoEndpoint } - f0elem.SetAuthenticateOidcConfig(f0elemf1) + f0elem.AuthenticateOidcConfig = f0elemf1 } if f0iter.FixedResponseConfig != nil { - f0elemf2 := &svcsdk.FixedResponseActionConfig{} + f0elemf2 := &svcsdktypes.FixedResponseActionConfig{} if f0iter.FixedResponseConfig.ContentType != nil { - f0elemf2.SetContentType(*f0iter.FixedResponseConfig.ContentType) + f0elemf2.ContentType = f0iter.FixedResponseConfig.ContentType } if f0iter.FixedResponseConfig.MessageBody != nil { - f0elemf2.SetMessageBody(*f0iter.FixedResponseConfig.MessageBody) + f0elemf2.MessageBody = f0iter.FixedResponseConfig.MessageBody } if f0iter.FixedResponseConfig.StatusCode != nil { - f0elemf2.SetStatusCode(*f0iter.FixedResponseConfig.StatusCode) + f0elemf2.StatusCode = f0iter.FixedResponseConfig.StatusCode } - f0elem.SetFixedResponseConfig(f0elemf2) + f0elem.FixedResponseConfig = f0elemf2 } if f0iter.ForwardConfig != nil { - f0elemf3 := &svcsdk.ForwardActionConfig{} + f0elemf3 := &svcsdktypes.ForwardActionConfig{} if f0iter.ForwardConfig.TargetGroupStickinessConfig != nil { - f0elemf3f0 := &svcsdk.TargetGroupStickinessConfig{} + f0elemf3f0 := &svcsdktypes.TargetGroupStickinessConfig{} if f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f0elemf3f0.SetDurationSeconds(*f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + if *f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds > math.MaxInt32 || *f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds < math.MinInt32 { + return nil, fmt.Errorf("error: field DurationSeconds is of type int32") + } + durationSecondsCopy := int32(*f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f0elemf3f0.DurationSeconds = &durationSecondsCopy } if f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { - f0elemf3f0.SetEnabled(*f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled) + f0elemf3f0.Enabled = f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled } - f0elemf3.SetTargetGroupStickinessConfig(f0elemf3f0) + f0elemf3.TargetGroupStickinessConfig = f0elemf3f0 } if f0iter.ForwardConfig.TargetGroups != nil { - f0elemf3f1 := []*svcsdk.TargetGroupTuple{} + f0elemf3f1 := []svcsdktypes.TargetGroupTuple{} for _, f0elemf3f1iter := range f0iter.ForwardConfig.TargetGroups { - f0elemf3f1elem := &svcsdk.TargetGroupTuple{} + f0elemf3f1elem := &svcsdktypes.TargetGroupTuple{} if f0elemf3f1iter.TargetGroupARN != nil { - f0elemf3f1elem.SetTargetGroupArn(*f0elemf3f1iter.TargetGroupARN) + f0elemf3f1elem.TargetGroupArn = f0elemf3f1iter.TargetGroupARN } if f0elemf3f1iter.Weight != nil { - f0elemf3f1elem.SetWeight(*f0elemf3f1iter.Weight) + if *f0elemf3f1iter.Weight > math.MaxInt32 || *f0elemf3f1iter.Weight < math.MinInt32 { + return nil, fmt.Errorf("error: field Weight is of type int32") + } + weightCopy := int32(*f0elemf3f1iter.Weight) + f0elemf3f1elem.Weight = &weightCopy } - f0elemf3f1 = append(f0elemf3f1, f0elemf3f1elem) + f0elemf3f1 = append(f0elemf3f1, *f0elemf3f1elem) } - f0elemf3.SetTargetGroups(f0elemf3f1) + f0elemf3.TargetGroups = f0elemf3f1 } - f0elem.SetForwardConfig(f0elemf3) + f0elem.ForwardConfig = f0elemf3 } if f0iter.Order != nil { - f0elem.SetOrder(*f0iter.Order) + if *f0iter.Order > math.MaxInt32 || *f0iter.Order < math.MinInt32 { + return nil, fmt.Errorf("error: field Order is of type int32") + } + orderCopy := int32(*f0iter.Order) + f0elem.Order = &orderCopy } if f0iter.RedirectConfig != nil { - f0elemf5 := &svcsdk.RedirectActionConfig{} + f0elemf5 := &svcsdktypes.RedirectActionConfig{} if f0iter.RedirectConfig.Host != nil { - f0elemf5.SetHost(*f0iter.RedirectConfig.Host) + f0elemf5.Host = f0iter.RedirectConfig.Host } if f0iter.RedirectConfig.Path != nil { - f0elemf5.SetPath(*f0iter.RedirectConfig.Path) + f0elemf5.Path = f0iter.RedirectConfig.Path } if f0iter.RedirectConfig.Port != nil { - f0elemf5.SetPort(*f0iter.RedirectConfig.Port) + f0elemf5.Port = f0iter.RedirectConfig.Port } if f0iter.RedirectConfig.Protocol != nil { - f0elemf5.SetProtocol(*f0iter.RedirectConfig.Protocol) + f0elemf5.Protocol = f0iter.RedirectConfig.Protocol } if f0iter.RedirectConfig.Query != nil { - f0elemf5.SetQuery(*f0iter.RedirectConfig.Query) + f0elemf5.Query = f0iter.RedirectConfig.Query } if f0iter.RedirectConfig.StatusCode != nil { - f0elemf5.SetStatusCode(*f0iter.RedirectConfig.StatusCode) + f0elemf5.StatusCode = svcsdktypes.RedirectActionStatusCodeEnum(*f0iter.RedirectConfig.StatusCode) } - f0elem.SetRedirectConfig(f0elemf5) + f0elem.RedirectConfig = f0elemf5 } if f0iter.TargetGroupARN != nil { - f0elem.SetTargetGroupArn(*f0iter.TargetGroupARN) + f0elem.TargetGroupArn = f0iter.TargetGroupARN } if f0iter.Type != nil { - f0elem.SetType(*f0iter.Type) + f0elem.Type = svcsdktypes.ActionTypeEnum(*f0iter.Type) } - f0 = append(f0, f0elem) + f0 = append(f0, *f0elem) } - res.SetActions(f0) + res.Actions = f0 } if r.ko.Spec.Conditions != nil { - f1 := []*svcsdk.RuleCondition{} + f1 := []svcsdktypes.RuleCondition{} for _, f1iter := range r.ko.Spec.Conditions { - f1elem := &svcsdk.RuleCondition{} + f1elem := &svcsdktypes.RuleCondition{} if f1iter.Field != nil { - f1elem.SetField(*f1iter.Field) + f1elem.Field = f1iter.Field } if f1iter.HostHeaderConfig != nil { - f1elemf1 := &svcsdk.HostHeaderConditionConfig{} + f1elemf1 := &svcsdktypes.HostHeaderConditionConfig{} if f1iter.HostHeaderConfig.Values != nil { - f1elemf1f0 := []*string{} - for _, f1elemf1f0iter := range f1iter.HostHeaderConfig.Values { - var f1elemf1f0elem string - f1elemf1f0elem = *f1elemf1f0iter - f1elemf1f0 = append(f1elemf1f0, &f1elemf1f0elem) - } - f1elemf1.SetValues(f1elemf1f0) + f1elemf1.Values = aws.ToStringSlice(f1iter.HostHeaderConfig.Values) } - f1elem.SetHostHeaderConfig(f1elemf1) + f1elem.HostHeaderConfig = f1elemf1 } if f1iter.HTTPHeaderConfig != nil { - f1elemf2 := &svcsdk.HttpHeaderConditionConfig{} + f1elemf2 := &svcsdktypes.HttpHeaderConditionConfig{} if f1iter.HTTPHeaderConfig.HTTPHeaderName != nil { - f1elemf2.SetHttpHeaderName(*f1iter.HTTPHeaderConfig.HTTPHeaderName) + f1elemf2.HttpHeaderName = f1iter.HTTPHeaderConfig.HTTPHeaderName } if f1iter.HTTPHeaderConfig.Values != nil { - f1elemf2f1 := []*string{} - for _, f1elemf2f1iter := range f1iter.HTTPHeaderConfig.Values { - var f1elemf2f1elem string - f1elemf2f1elem = *f1elemf2f1iter - f1elemf2f1 = append(f1elemf2f1, &f1elemf2f1elem) - } - f1elemf2.SetValues(f1elemf2f1) + f1elemf2.Values = aws.ToStringSlice(f1iter.HTTPHeaderConfig.Values) } - f1elem.SetHttpHeaderConfig(f1elemf2) + f1elem.HttpHeaderConfig = f1elemf2 } if f1iter.HTTPRequestMethodConfig != nil { - f1elemf3 := &svcsdk.HttpRequestMethodConditionConfig{} + f1elemf3 := &svcsdktypes.HttpRequestMethodConditionConfig{} if f1iter.HTTPRequestMethodConfig.Values != nil { - f1elemf3f0 := []*string{} - for _, f1elemf3f0iter := range f1iter.HTTPRequestMethodConfig.Values { - var f1elemf3f0elem string - f1elemf3f0elem = *f1elemf3f0iter - f1elemf3f0 = append(f1elemf3f0, &f1elemf3f0elem) - } - f1elemf3.SetValues(f1elemf3f0) + f1elemf3.Values = aws.ToStringSlice(f1iter.HTTPRequestMethodConfig.Values) } - f1elem.SetHttpRequestMethodConfig(f1elemf3) + f1elem.HttpRequestMethodConfig = f1elemf3 } if f1iter.PathPatternConfig != nil { - f1elemf4 := &svcsdk.PathPatternConditionConfig{} + f1elemf4 := &svcsdktypes.PathPatternConditionConfig{} if f1iter.PathPatternConfig.Values != nil { - f1elemf4f0 := []*string{} - for _, f1elemf4f0iter := range f1iter.PathPatternConfig.Values { - var f1elemf4f0elem string - f1elemf4f0elem = *f1elemf4f0iter - f1elemf4f0 = append(f1elemf4f0, &f1elemf4f0elem) - } - f1elemf4.SetValues(f1elemf4f0) + f1elemf4.Values = aws.ToStringSlice(f1iter.PathPatternConfig.Values) } - f1elem.SetPathPatternConfig(f1elemf4) + f1elem.PathPatternConfig = f1elemf4 } if f1iter.QueryStringConfig != nil { - f1elemf5 := &svcsdk.QueryStringConditionConfig{} + f1elemf5 := &svcsdktypes.QueryStringConditionConfig{} if f1iter.QueryStringConfig.Values != nil { - f1elemf5f0 := []*svcsdk.QueryStringKeyValuePair{} + f1elemf5f0 := []svcsdktypes.QueryStringKeyValuePair{} for _, f1elemf5f0iter := range f1iter.QueryStringConfig.Values { - f1elemf5f0elem := &svcsdk.QueryStringKeyValuePair{} + f1elemf5f0elem := &svcsdktypes.QueryStringKeyValuePair{} if f1elemf5f0iter.Key != nil { - f1elemf5f0elem.SetKey(*f1elemf5f0iter.Key) + f1elemf5f0elem.Key = f1elemf5f0iter.Key } if f1elemf5f0iter.Value != nil { - f1elemf5f0elem.SetValue(*f1elemf5f0iter.Value) + f1elemf5f0elem.Value = f1elemf5f0iter.Value } - f1elemf5f0 = append(f1elemf5f0, f1elemf5f0elem) + f1elemf5f0 = append(f1elemf5f0, *f1elemf5f0elem) } - f1elemf5.SetValues(f1elemf5f0) + f1elemf5.Values = f1elemf5f0 } - f1elem.SetQueryStringConfig(f1elemf5) + f1elem.QueryStringConfig = f1elemf5 } if f1iter.SourceIPConfig != nil { - f1elemf6 := &svcsdk.SourceIpConditionConfig{} + f1elemf6 := &svcsdktypes.SourceIpConditionConfig{} if f1iter.SourceIPConfig.Values != nil { - f1elemf6f0 := []*string{} - for _, f1elemf6f0iter := range f1iter.SourceIPConfig.Values { - var f1elemf6f0elem string - f1elemf6f0elem = *f1elemf6f0iter - f1elemf6f0 = append(f1elemf6f0, &f1elemf6f0elem) - } - f1elemf6.SetValues(f1elemf6f0) + f1elemf6.Values = aws.ToStringSlice(f1iter.SourceIPConfig.Values) } - f1elem.SetSourceIpConfig(f1elemf6) + f1elem.SourceIpConfig = f1elemf6 } if f1iter.Values != nil { - f1elemf7 := []*string{} - for _, f1elemf7iter := range f1iter.Values { - var f1elemf7elem string - f1elemf7elem = *f1elemf7iter - f1elemf7 = append(f1elemf7, &f1elemf7elem) - } - f1elem.SetValues(f1elemf7) + f1elem.Values = aws.ToStringSlice(f1iter.Values) } - f1 = append(f1, f1elem) + f1 = append(f1, *f1elem) } - res.SetConditions(f1) + res.Conditions = f1 } if r.ko.Spec.ListenerARN != nil { - res.SetListenerArn(*r.ko.Spec.ListenerARN) + res.ListenerArn = r.ko.Spec.ListenerARN } if r.ko.Spec.Priority != nil { - res.SetPriority(*r.ko.Spec.Priority) + if *r.ko.Spec.Priority > math.MaxInt32 || *r.ko.Spec.Priority < math.MinInt32 { + return nil, fmt.Errorf("error: field Priority is of type int32") + } + priorityCopy := int32(*r.ko.Spec.Priority) + res.Priority = &priorityCopy } if r.ko.Spec.Tags != nil { - f4 := []*svcsdk.Tag{} + f4 := []svcsdktypes.Tag{} for _, f4iter := range r.ko.Spec.Tags { - f4elem := &svcsdk.Tag{} + f4elem := &svcsdktypes.Tag{} if f4iter.Key != nil { - f4elem.SetKey(*f4iter.Key) + f4elem.Key = f4iter.Key } if f4iter.Value != nil { - f4elem.SetValue(*f4iter.Value) + f4elem.Value = f4iter.Value } - f4 = append(f4, f4elem) + f4 = append(f4, *f4elem) } - res.SetTags(f4) + res.Tags = f4 } return res, nil @@ -1060,7 +941,7 @@ func (rm *resourceManager) sdkUpdate( var resp *svcsdk.ModifyRuleOutput _ = resp - resp, err = rm.sdkapi.ModifyRuleWithContext(ctx, input) + resp, err = rm.sdkapi.ModifyRule(ctx, input) rm.metrics.RecordAPICall("UPDATE", "ModifyRule", err) if err != nil { return nil, err @@ -1078,16 +959,10 @@ func (rm *resourceManager) sdkUpdate( if f0iter.AuthenticateCognitoConfig != nil { f0elemf0 := &svcapitypes.AuthenticateCognitoActionConfig{} if f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f0elemf0f0 := map[string]*string{} - for f0elemf0f0key, f0elemf0f0valiter := range f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f0elemf0f0val string - f0elemf0f0val = *f0elemf0f0valiter - f0elemf0f0[f0elemf0f0key] = &f0elemf0f0val - } - f0elemf0.AuthenticationRequestExtraParams = f0elemf0f0 + f0elemf0.AuthenticationRequestExtraParams = aws.StringMap(f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } - if f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f0elemf0.OnUnauthenticatedRequest = f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest + if f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != "" { + f0elemf0.OnUnauthenticatedRequest = aws.String(string(f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest)) } if f0iter.AuthenticateCognitoConfig.Scope != nil { f0elemf0.Scope = f0iter.AuthenticateCognitoConfig.Scope @@ -1112,13 +987,7 @@ func (rm *resourceManager) sdkUpdate( if f0iter.AuthenticateOidcConfig != nil { f0elemf1 := &svcapitypes.AuthenticateOIDCActionConfig{} if f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams != nil { - f0elemf1f0 := map[string]*string{} - for f0elemf1f0key, f0elemf1f0valiter := range f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams { - var f0elemf1f0val string - f0elemf1f0val = *f0elemf1f0valiter - f0elemf1f0[f0elemf1f0key] = &f0elemf1f0val - } - f0elemf1.AuthenticationRequestExtraParams = f0elemf1f0 + f0elemf1.AuthenticationRequestExtraParams = aws.StringMap(f0iter.AuthenticateOidcConfig.AuthenticationRequestExtraParams) } if f0iter.AuthenticateOidcConfig.AuthorizationEndpoint != nil { f0elemf1.AuthorizationEndpoint = f0iter.AuthenticateOidcConfig.AuthorizationEndpoint @@ -1132,8 +1001,8 @@ func (rm *resourceManager) sdkUpdate( if f0iter.AuthenticateOidcConfig.Issuer != nil { f0elemf1.Issuer = f0iter.AuthenticateOidcConfig.Issuer } - if f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != nil { - f0elemf1.OnUnauthenticatedRequest = f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest + if f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest != "" { + f0elemf1.OnUnauthenticatedRequest = aws.String(string(f0iter.AuthenticateOidcConfig.OnUnauthenticatedRequest)) } if f0iter.AuthenticateOidcConfig.Scope != nil { f0elemf1.Scope = f0iter.AuthenticateOidcConfig.Scope @@ -1173,7 +1042,8 @@ func (rm *resourceManager) sdkUpdate( if f0iter.ForwardConfig.TargetGroupStickinessConfig != nil { f0elemf3f0 := &svcapitypes.TargetGroupStickinessConfig{} if f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f0elemf3f0.DurationSeconds = f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds + durationSecondsCopy := int64(*f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f0elemf3f0.DurationSeconds = &durationSecondsCopy } if f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { f0elemf3f0.Enabled = f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled @@ -1188,7 +1058,8 @@ func (rm *resourceManager) sdkUpdate( f0elemf3f1elem.TargetGroupARN = f0elemf3f1iter.TargetGroupArn } if f0elemf3f1iter.Weight != nil { - f0elemf3f1elem.Weight = f0elemf3f1iter.Weight + weightCopy := int64(*f0elemf3f1iter.Weight) + f0elemf3f1elem.Weight = &weightCopy } f0elemf3f1 = append(f0elemf3f1, f0elemf3f1elem) } @@ -1197,7 +1068,8 @@ func (rm *resourceManager) sdkUpdate( f0elem.ForwardConfig = f0elemf3 } if f0iter.Order != nil { - f0elem.Order = f0iter.Order + orderCopy := int64(*f0iter.Order) + f0elem.Order = &orderCopy } if f0iter.RedirectConfig != nil { f0elemf5 := &svcapitypes.RedirectActionConfig{} @@ -1216,16 +1088,16 @@ func (rm *resourceManager) sdkUpdate( if f0iter.RedirectConfig.Query != nil { f0elemf5.Query = f0iter.RedirectConfig.Query } - if f0iter.RedirectConfig.StatusCode != nil { - f0elemf5.StatusCode = f0iter.RedirectConfig.StatusCode + if f0iter.RedirectConfig.StatusCode != "" { + f0elemf5.StatusCode = aws.String(string(f0iter.RedirectConfig.StatusCode)) } f0elem.RedirectConfig = f0elemf5 } if f0iter.TargetGroupArn != nil { f0elem.TargetGroupARN = f0iter.TargetGroupArn } - if f0iter.Type != nil { - f0elem.Type = f0iter.Type + if f0iter.Type != "" { + f0elem.Type = aws.String(string(f0iter.Type)) } f0 = append(f0, f0elem) } @@ -1243,13 +1115,7 @@ func (rm *resourceManager) sdkUpdate( if f1iter.HostHeaderConfig != nil { f1elemf1 := &svcapitypes.HostHeaderConditionConfig{} if f1iter.HostHeaderConfig.Values != nil { - f1elemf1f0 := []*string{} - for _, f1elemf1f0iter := range f1iter.HostHeaderConfig.Values { - var f1elemf1f0elem string - f1elemf1f0elem = *f1elemf1f0iter - f1elemf1f0 = append(f1elemf1f0, &f1elemf1f0elem) - } - f1elemf1.Values = f1elemf1f0 + f1elemf1.Values = aws.StringSlice(f1iter.HostHeaderConfig.Values) } f1elem.HostHeaderConfig = f1elemf1 } @@ -1259,39 +1125,21 @@ func (rm *resourceManager) sdkUpdate( f1elemf2.HTTPHeaderName = f1iter.HttpHeaderConfig.HttpHeaderName } if f1iter.HttpHeaderConfig.Values != nil { - f1elemf2f1 := []*string{} - for _, f1elemf2f1iter := range f1iter.HttpHeaderConfig.Values { - var f1elemf2f1elem string - f1elemf2f1elem = *f1elemf2f1iter - f1elemf2f1 = append(f1elemf2f1, &f1elemf2f1elem) - } - f1elemf2.Values = f1elemf2f1 + f1elemf2.Values = aws.StringSlice(f1iter.HttpHeaderConfig.Values) } f1elem.HTTPHeaderConfig = f1elemf2 } if f1iter.HttpRequestMethodConfig != nil { f1elemf3 := &svcapitypes.HTTPRequestMethodConditionConfig{} if f1iter.HttpRequestMethodConfig.Values != nil { - f1elemf3f0 := []*string{} - for _, f1elemf3f0iter := range f1iter.HttpRequestMethodConfig.Values { - var f1elemf3f0elem string - f1elemf3f0elem = *f1elemf3f0iter - f1elemf3f0 = append(f1elemf3f0, &f1elemf3f0elem) - } - f1elemf3.Values = f1elemf3f0 + f1elemf3.Values = aws.StringSlice(f1iter.HttpRequestMethodConfig.Values) } f1elem.HTTPRequestMethodConfig = f1elemf3 } if f1iter.PathPatternConfig != nil { f1elemf4 := &svcapitypes.PathPatternConditionConfig{} if f1iter.PathPatternConfig.Values != nil { - f1elemf4f0 := []*string{} - for _, f1elemf4f0iter := range f1iter.PathPatternConfig.Values { - var f1elemf4f0elem string - f1elemf4f0elem = *f1elemf4f0iter - f1elemf4f0 = append(f1elemf4f0, &f1elemf4f0elem) - } - f1elemf4.Values = f1elemf4f0 + f1elemf4.Values = aws.StringSlice(f1iter.PathPatternConfig.Values) } f1elem.PathPatternConfig = f1elemf4 } @@ -1316,24 +1164,12 @@ func (rm *resourceManager) sdkUpdate( if f1iter.SourceIpConfig != nil { f1elemf6 := &svcapitypes.SourceIPConditionConfig{} if f1iter.SourceIpConfig.Values != nil { - f1elemf6f0 := []*string{} - for _, f1elemf6f0iter := range f1iter.SourceIpConfig.Values { - var f1elemf6f0elem string - f1elemf6f0elem = *f1elemf6f0iter - f1elemf6f0 = append(f1elemf6f0, &f1elemf6f0elem) - } - f1elemf6.Values = f1elemf6f0 + f1elemf6.Values = aws.StringSlice(f1iter.SourceIpConfig.Values) } f1elem.SourceIPConfig = f1elemf6 } if f1iter.Values != nil { - f1elemf7 := []*string{} - for _, f1elemf7iter := range f1iter.Values { - var f1elemf7elem string - f1elemf7elem = *f1elemf7iter - f1elemf7 = append(f1elemf7, &f1elemf7elem) - } - f1elem.Values = f1elemf7 + f1elem.Values = aws.StringSlice(f1iter.Values) } f1 = append(f1, f1elem) } @@ -1374,273 +1210,237 @@ func (rm *resourceManager) newUpdateRequestPayload( res := &svcsdk.ModifyRuleInput{} if r.ko.Spec.Actions != nil { - f0 := []*svcsdk.Action{} + f0 := []svcsdktypes.Action{} for _, f0iter := range r.ko.Spec.Actions { - f0elem := &svcsdk.Action{} + f0elem := &svcsdktypes.Action{} if f0iter.AuthenticateCognitoConfig != nil { - f0elemf0 := &svcsdk.AuthenticateCognitoActionConfig{} + f0elemf0 := &svcsdktypes.AuthenticateCognitoActionConfig{} if f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams != nil { - f0elemf0f0 := map[string]*string{} - for f0elemf0f0key, f0elemf0f0valiter := range f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams { - var f0elemf0f0val string - f0elemf0f0val = *f0elemf0f0valiter - f0elemf0f0[f0elemf0f0key] = &f0elemf0f0val - } - f0elemf0.SetAuthenticationRequestExtraParams(f0elemf0f0) + f0elemf0.AuthenticationRequestExtraParams = aws.ToStringMap(f0iter.AuthenticateCognitoConfig.AuthenticationRequestExtraParams) } if f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest != nil { - f0elemf0.SetOnUnauthenticatedRequest(*f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest) + f0elemf0.OnUnauthenticatedRequest = svcsdktypes.AuthenticateCognitoActionConditionalBehaviorEnum(*f0iter.AuthenticateCognitoConfig.OnUnauthenticatedRequest) } if f0iter.AuthenticateCognitoConfig.Scope != nil { - f0elemf0.SetScope(*f0iter.AuthenticateCognitoConfig.Scope) + f0elemf0.Scope = f0iter.AuthenticateCognitoConfig.Scope } if f0iter.AuthenticateCognitoConfig.SessionCookieName != nil { - f0elemf0.SetSessionCookieName(*f0iter.AuthenticateCognitoConfig.SessionCookieName) + f0elemf0.SessionCookieName = f0iter.AuthenticateCognitoConfig.SessionCookieName } if f0iter.AuthenticateCognitoConfig.SessionTimeout != nil { - f0elemf0.SetSessionTimeout(*f0iter.AuthenticateCognitoConfig.SessionTimeout) + f0elemf0.SessionTimeout = f0iter.AuthenticateCognitoConfig.SessionTimeout } if f0iter.AuthenticateCognitoConfig.UserPoolARN != nil { - f0elemf0.SetUserPoolArn(*f0iter.AuthenticateCognitoConfig.UserPoolARN) + f0elemf0.UserPoolArn = f0iter.AuthenticateCognitoConfig.UserPoolARN } if f0iter.AuthenticateCognitoConfig.UserPoolClientID != nil { - f0elemf0.SetUserPoolClientId(*f0iter.AuthenticateCognitoConfig.UserPoolClientID) + f0elemf0.UserPoolClientId = f0iter.AuthenticateCognitoConfig.UserPoolClientID } if f0iter.AuthenticateCognitoConfig.UserPoolDomain != nil { - f0elemf0.SetUserPoolDomain(*f0iter.AuthenticateCognitoConfig.UserPoolDomain) + f0elemf0.UserPoolDomain = f0iter.AuthenticateCognitoConfig.UserPoolDomain } - f0elem.SetAuthenticateCognitoConfig(f0elemf0) + f0elem.AuthenticateCognitoConfig = f0elemf0 } if f0iter.AuthenticateOIDCConfig != nil { - f0elemf1 := &svcsdk.AuthenticateOidcActionConfig{} + f0elemf1 := &svcsdktypes.AuthenticateOidcActionConfig{} if f0iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams != nil { - f0elemf1f0 := map[string]*string{} - for f0elemf1f0key, f0elemf1f0valiter := range f0iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams { - var f0elemf1f0val string - f0elemf1f0val = *f0elemf1f0valiter - f0elemf1f0[f0elemf1f0key] = &f0elemf1f0val - } - f0elemf1.SetAuthenticationRequestExtraParams(f0elemf1f0) + f0elemf1.AuthenticationRequestExtraParams = aws.ToStringMap(f0iter.AuthenticateOIDCConfig.AuthenticationRequestExtraParams) } if f0iter.AuthenticateOIDCConfig.AuthorizationEndpoint != nil { - f0elemf1.SetAuthorizationEndpoint(*f0iter.AuthenticateOIDCConfig.AuthorizationEndpoint) + f0elemf1.AuthorizationEndpoint = f0iter.AuthenticateOIDCConfig.AuthorizationEndpoint } if f0iter.AuthenticateOIDCConfig.ClientID != nil { - f0elemf1.SetClientId(*f0iter.AuthenticateOIDCConfig.ClientID) + f0elemf1.ClientId = f0iter.AuthenticateOIDCConfig.ClientID } if f0iter.AuthenticateOIDCConfig.ClientSecret != nil { - f0elemf1.SetClientSecret(*f0iter.AuthenticateOIDCConfig.ClientSecret) + f0elemf1.ClientSecret = f0iter.AuthenticateOIDCConfig.ClientSecret } if f0iter.AuthenticateOIDCConfig.Issuer != nil { - f0elemf1.SetIssuer(*f0iter.AuthenticateOIDCConfig.Issuer) + f0elemf1.Issuer = f0iter.AuthenticateOIDCConfig.Issuer } if f0iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest != nil { - f0elemf1.SetOnUnauthenticatedRequest(*f0iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest) + f0elemf1.OnUnauthenticatedRequest = svcsdktypes.AuthenticateOidcActionConditionalBehaviorEnum(*f0iter.AuthenticateOIDCConfig.OnUnauthenticatedRequest) } if f0iter.AuthenticateOIDCConfig.Scope != nil { - f0elemf1.SetScope(*f0iter.AuthenticateOIDCConfig.Scope) + f0elemf1.Scope = f0iter.AuthenticateOIDCConfig.Scope } if f0iter.AuthenticateOIDCConfig.SessionCookieName != nil { - f0elemf1.SetSessionCookieName(*f0iter.AuthenticateOIDCConfig.SessionCookieName) + f0elemf1.SessionCookieName = f0iter.AuthenticateOIDCConfig.SessionCookieName } if f0iter.AuthenticateOIDCConfig.SessionTimeout != nil { - f0elemf1.SetSessionTimeout(*f0iter.AuthenticateOIDCConfig.SessionTimeout) + f0elemf1.SessionTimeout = f0iter.AuthenticateOIDCConfig.SessionTimeout } if f0iter.AuthenticateOIDCConfig.TokenEndpoint != nil { - f0elemf1.SetTokenEndpoint(*f0iter.AuthenticateOIDCConfig.TokenEndpoint) + f0elemf1.TokenEndpoint = f0iter.AuthenticateOIDCConfig.TokenEndpoint } if f0iter.AuthenticateOIDCConfig.UseExistingClientSecret != nil { - f0elemf1.SetUseExistingClientSecret(*f0iter.AuthenticateOIDCConfig.UseExistingClientSecret) + f0elemf1.UseExistingClientSecret = f0iter.AuthenticateOIDCConfig.UseExistingClientSecret } if f0iter.AuthenticateOIDCConfig.UserInfoEndpoint != nil { - f0elemf1.SetUserInfoEndpoint(*f0iter.AuthenticateOIDCConfig.UserInfoEndpoint) + f0elemf1.UserInfoEndpoint = f0iter.AuthenticateOIDCConfig.UserInfoEndpoint } - f0elem.SetAuthenticateOidcConfig(f0elemf1) + f0elem.AuthenticateOidcConfig = f0elemf1 } if f0iter.FixedResponseConfig != nil { - f0elemf2 := &svcsdk.FixedResponseActionConfig{} + f0elemf2 := &svcsdktypes.FixedResponseActionConfig{} if f0iter.FixedResponseConfig.ContentType != nil { - f0elemf2.SetContentType(*f0iter.FixedResponseConfig.ContentType) + f0elemf2.ContentType = f0iter.FixedResponseConfig.ContentType } if f0iter.FixedResponseConfig.MessageBody != nil { - f0elemf2.SetMessageBody(*f0iter.FixedResponseConfig.MessageBody) + f0elemf2.MessageBody = f0iter.FixedResponseConfig.MessageBody } if f0iter.FixedResponseConfig.StatusCode != nil { - f0elemf2.SetStatusCode(*f0iter.FixedResponseConfig.StatusCode) + f0elemf2.StatusCode = f0iter.FixedResponseConfig.StatusCode } - f0elem.SetFixedResponseConfig(f0elemf2) + f0elem.FixedResponseConfig = f0elemf2 } if f0iter.ForwardConfig != nil { - f0elemf3 := &svcsdk.ForwardActionConfig{} + f0elemf3 := &svcsdktypes.ForwardActionConfig{} if f0iter.ForwardConfig.TargetGroupStickinessConfig != nil { - f0elemf3f0 := &svcsdk.TargetGroupStickinessConfig{} + f0elemf3f0 := &svcsdktypes.TargetGroupStickinessConfig{} if f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds != nil { - f0elemf3f0.SetDurationSeconds(*f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + if *f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds > math.MaxInt32 || *f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds < math.MinInt32 { + return nil, fmt.Errorf("error: field DurationSeconds is of type int32") + } + durationSecondsCopy := int32(*f0iter.ForwardConfig.TargetGroupStickinessConfig.DurationSeconds) + f0elemf3f0.DurationSeconds = &durationSecondsCopy } if f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled != nil { - f0elemf3f0.SetEnabled(*f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled) + f0elemf3f0.Enabled = f0iter.ForwardConfig.TargetGroupStickinessConfig.Enabled } - f0elemf3.SetTargetGroupStickinessConfig(f0elemf3f0) + f0elemf3.TargetGroupStickinessConfig = f0elemf3f0 } if f0iter.ForwardConfig.TargetGroups != nil { - f0elemf3f1 := []*svcsdk.TargetGroupTuple{} + f0elemf3f1 := []svcsdktypes.TargetGroupTuple{} for _, f0elemf3f1iter := range f0iter.ForwardConfig.TargetGroups { - f0elemf3f1elem := &svcsdk.TargetGroupTuple{} + f0elemf3f1elem := &svcsdktypes.TargetGroupTuple{} if f0elemf3f1iter.TargetGroupARN != nil { - f0elemf3f1elem.SetTargetGroupArn(*f0elemf3f1iter.TargetGroupARN) + f0elemf3f1elem.TargetGroupArn = f0elemf3f1iter.TargetGroupARN } if f0elemf3f1iter.Weight != nil { - f0elemf3f1elem.SetWeight(*f0elemf3f1iter.Weight) + if *f0elemf3f1iter.Weight > math.MaxInt32 || *f0elemf3f1iter.Weight < math.MinInt32 { + return nil, fmt.Errorf("error: field Weight is of type int32") + } + weightCopy := int32(*f0elemf3f1iter.Weight) + f0elemf3f1elem.Weight = &weightCopy } - f0elemf3f1 = append(f0elemf3f1, f0elemf3f1elem) + f0elemf3f1 = append(f0elemf3f1, *f0elemf3f1elem) } - f0elemf3.SetTargetGroups(f0elemf3f1) + f0elemf3.TargetGroups = f0elemf3f1 } - f0elem.SetForwardConfig(f0elemf3) + f0elem.ForwardConfig = f0elemf3 } if f0iter.Order != nil { - f0elem.SetOrder(*f0iter.Order) + if *f0iter.Order > math.MaxInt32 || *f0iter.Order < math.MinInt32 { + return nil, fmt.Errorf("error: field Order is of type int32") + } + orderCopy := int32(*f0iter.Order) + f0elem.Order = &orderCopy } if f0iter.RedirectConfig != nil { - f0elemf5 := &svcsdk.RedirectActionConfig{} + f0elemf5 := &svcsdktypes.RedirectActionConfig{} if f0iter.RedirectConfig.Host != nil { - f0elemf5.SetHost(*f0iter.RedirectConfig.Host) + f0elemf5.Host = f0iter.RedirectConfig.Host } if f0iter.RedirectConfig.Path != nil { - f0elemf5.SetPath(*f0iter.RedirectConfig.Path) + f0elemf5.Path = f0iter.RedirectConfig.Path } if f0iter.RedirectConfig.Port != nil { - f0elemf5.SetPort(*f0iter.RedirectConfig.Port) + f0elemf5.Port = f0iter.RedirectConfig.Port } if f0iter.RedirectConfig.Protocol != nil { - f0elemf5.SetProtocol(*f0iter.RedirectConfig.Protocol) + f0elemf5.Protocol = f0iter.RedirectConfig.Protocol } if f0iter.RedirectConfig.Query != nil { - f0elemf5.SetQuery(*f0iter.RedirectConfig.Query) + f0elemf5.Query = f0iter.RedirectConfig.Query } if f0iter.RedirectConfig.StatusCode != nil { - f0elemf5.SetStatusCode(*f0iter.RedirectConfig.StatusCode) + f0elemf5.StatusCode = svcsdktypes.RedirectActionStatusCodeEnum(*f0iter.RedirectConfig.StatusCode) } - f0elem.SetRedirectConfig(f0elemf5) + f0elem.RedirectConfig = f0elemf5 } if f0iter.TargetGroupARN != nil { - f0elem.SetTargetGroupArn(*f0iter.TargetGroupARN) + f0elem.TargetGroupArn = f0iter.TargetGroupARN } if f0iter.Type != nil { - f0elem.SetType(*f0iter.Type) + f0elem.Type = svcsdktypes.ActionTypeEnum(*f0iter.Type) } - f0 = append(f0, f0elem) + f0 = append(f0, *f0elem) } - res.SetActions(f0) + res.Actions = f0 } if r.ko.Spec.Conditions != nil { - f1 := []*svcsdk.RuleCondition{} + f1 := []svcsdktypes.RuleCondition{} for _, f1iter := range r.ko.Spec.Conditions { - f1elem := &svcsdk.RuleCondition{} + f1elem := &svcsdktypes.RuleCondition{} if f1iter.Field != nil { - f1elem.SetField(*f1iter.Field) + f1elem.Field = f1iter.Field } if f1iter.HostHeaderConfig != nil { - f1elemf1 := &svcsdk.HostHeaderConditionConfig{} + f1elemf1 := &svcsdktypes.HostHeaderConditionConfig{} if f1iter.HostHeaderConfig.Values != nil { - f1elemf1f0 := []*string{} - for _, f1elemf1f0iter := range f1iter.HostHeaderConfig.Values { - var f1elemf1f0elem string - f1elemf1f0elem = *f1elemf1f0iter - f1elemf1f0 = append(f1elemf1f0, &f1elemf1f0elem) - } - f1elemf1.SetValues(f1elemf1f0) + f1elemf1.Values = aws.ToStringSlice(f1iter.HostHeaderConfig.Values) } - f1elem.SetHostHeaderConfig(f1elemf1) + f1elem.HostHeaderConfig = f1elemf1 } if f1iter.HTTPHeaderConfig != nil { - f1elemf2 := &svcsdk.HttpHeaderConditionConfig{} + f1elemf2 := &svcsdktypes.HttpHeaderConditionConfig{} if f1iter.HTTPHeaderConfig.HTTPHeaderName != nil { - f1elemf2.SetHttpHeaderName(*f1iter.HTTPHeaderConfig.HTTPHeaderName) + f1elemf2.HttpHeaderName = f1iter.HTTPHeaderConfig.HTTPHeaderName } if f1iter.HTTPHeaderConfig.Values != nil { - f1elemf2f1 := []*string{} - for _, f1elemf2f1iter := range f1iter.HTTPHeaderConfig.Values { - var f1elemf2f1elem string - f1elemf2f1elem = *f1elemf2f1iter - f1elemf2f1 = append(f1elemf2f1, &f1elemf2f1elem) - } - f1elemf2.SetValues(f1elemf2f1) + f1elemf2.Values = aws.ToStringSlice(f1iter.HTTPHeaderConfig.Values) } - f1elem.SetHttpHeaderConfig(f1elemf2) + f1elem.HttpHeaderConfig = f1elemf2 } if f1iter.HTTPRequestMethodConfig != nil { - f1elemf3 := &svcsdk.HttpRequestMethodConditionConfig{} + f1elemf3 := &svcsdktypes.HttpRequestMethodConditionConfig{} if f1iter.HTTPRequestMethodConfig.Values != nil { - f1elemf3f0 := []*string{} - for _, f1elemf3f0iter := range f1iter.HTTPRequestMethodConfig.Values { - var f1elemf3f0elem string - f1elemf3f0elem = *f1elemf3f0iter - f1elemf3f0 = append(f1elemf3f0, &f1elemf3f0elem) - } - f1elemf3.SetValues(f1elemf3f0) + f1elemf3.Values = aws.ToStringSlice(f1iter.HTTPRequestMethodConfig.Values) } - f1elem.SetHttpRequestMethodConfig(f1elemf3) + f1elem.HttpRequestMethodConfig = f1elemf3 } if f1iter.PathPatternConfig != nil { - f1elemf4 := &svcsdk.PathPatternConditionConfig{} + f1elemf4 := &svcsdktypes.PathPatternConditionConfig{} if f1iter.PathPatternConfig.Values != nil { - f1elemf4f0 := []*string{} - for _, f1elemf4f0iter := range f1iter.PathPatternConfig.Values { - var f1elemf4f0elem string - f1elemf4f0elem = *f1elemf4f0iter - f1elemf4f0 = append(f1elemf4f0, &f1elemf4f0elem) - } - f1elemf4.SetValues(f1elemf4f0) + f1elemf4.Values = aws.ToStringSlice(f1iter.PathPatternConfig.Values) } - f1elem.SetPathPatternConfig(f1elemf4) + f1elem.PathPatternConfig = f1elemf4 } if f1iter.QueryStringConfig != nil { - f1elemf5 := &svcsdk.QueryStringConditionConfig{} + f1elemf5 := &svcsdktypes.QueryStringConditionConfig{} if f1iter.QueryStringConfig.Values != nil { - f1elemf5f0 := []*svcsdk.QueryStringKeyValuePair{} + f1elemf5f0 := []svcsdktypes.QueryStringKeyValuePair{} for _, f1elemf5f0iter := range f1iter.QueryStringConfig.Values { - f1elemf5f0elem := &svcsdk.QueryStringKeyValuePair{} + f1elemf5f0elem := &svcsdktypes.QueryStringKeyValuePair{} if f1elemf5f0iter.Key != nil { - f1elemf5f0elem.SetKey(*f1elemf5f0iter.Key) + f1elemf5f0elem.Key = f1elemf5f0iter.Key } if f1elemf5f0iter.Value != nil { - f1elemf5f0elem.SetValue(*f1elemf5f0iter.Value) + f1elemf5f0elem.Value = f1elemf5f0iter.Value } - f1elemf5f0 = append(f1elemf5f0, f1elemf5f0elem) + f1elemf5f0 = append(f1elemf5f0, *f1elemf5f0elem) } - f1elemf5.SetValues(f1elemf5f0) + f1elemf5.Values = f1elemf5f0 } - f1elem.SetQueryStringConfig(f1elemf5) + f1elem.QueryStringConfig = f1elemf5 } if f1iter.SourceIPConfig != nil { - f1elemf6 := &svcsdk.SourceIpConditionConfig{} + f1elemf6 := &svcsdktypes.SourceIpConditionConfig{} if f1iter.SourceIPConfig.Values != nil { - f1elemf6f0 := []*string{} - for _, f1elemf6f0iter := range f1iter.SourceIPConfig.Values { - var f1elemf6f0elem string - f1elemf6f0elem = *f1elemf6f0iter - f1elemf6f0 = append(f1elemf6f0, &f1elemf6f0elem) - } - f1elemf6.SetValues(f1elemf6f0) + f1elemf6.Values = aws.ToStringSlice(f1iter.SourceIPConfig.Values) } - f1elem.SetSourceIpConfig(f1elemf6) + f1elem.SourceIpConfig = f1elemf6 } if f1iter.Values != nil { - f1elemf7 := []*string{} - for _, f1elemf7iter := range f1iter.Values { - var f1elemf7elem string - f1elemf7elem = *f1elemf7iter - f1elemf7 = append(f1elemf7, &f1elemf7elem) - } - f1elem.SetValues(f1elemf7) + f1elem.Values = aws.ToStringSlice(f1iter.Values) } - f1 = append(f1, f1elem) + f1 = append(f1, *f1elem) } - res.SetConditions(f1) + res.Conditions = f1 } if r.ko.Status.ACKResourceMetadata != nil && r.ko.Status.ACKResourceMetadata.ARN != nil { - res.SetRuleArn(string(*r.ko.Status.ACKResourceMetadata.ARN)) + res.RuleArn = (*string)(r.ko.Status.ACKResourceMetadata.ARN) } return res, nil @@ -1662,7 +1462,7 @@ func (rm *resourceManager) sdkDelete( } var resp *svcsdk.DeleteRuleOutput _ = resp - resp, err = rm.sdkapi.DeleteRuleWithContext(ctx, input) + resp, err = rm.sdkapi.DeleteRule(ctx, input) rm.metrics.RecordAPICall("DELETE", "DeleteRule", err) return nil, err } @@ -1675,7 +1475,7 @@ func (rm *resourceManager) newDeleteRequestPayload( res := &svcsdk.DeleteRuleInput{} if r.ko.Status.ACKResourceMetadata != nil && r.ko.Status.ACKResourceMetadata.ARN != nil { - res.SetRuleArn(string(*r.ko.Status.ACKResourceMetadata.ARN)) + res.RuleArn = (*string)(r.ko.Status.ACKResourceMetadata.ARN) } return res, nil @@ -1783,15 +1583,11 @@ func (rm *resourceManager) terminalAWSError(err error) bool { if err == nil { return false } - awsErr, ok := ackerr.AWSError(err) - if !ok { - return false - } - switch awsErr.Code() { - case "InvalidConfigurationRequest", - "IncompatibleProtocols", - "UnsupportedProtocol", - "InvalidLoadBalancerAction": + switch err.(type) { + case *svcsdktypes.InvalidConfigurationRequestException, + *svcsdktypes.IncompatibleProtocolsException, + *svcsdktypes.UnsupportedProtocolException, + *svcsdktypes.InvalidLoadBalancerActionException: return true default: return false diff --git a/pkg/resource/target_group/hooks.go b/pkg/resource/target_group/hooks.go index d08f981..9c3fbfe 100644 --- a/pkg/resource/target_group/hooks.go +++ b/pkg/resource/target_group/hooks.go @@ -19,11 +19,12 @@ import ( "context" "time" + svcapitypes "github.com/aws-controllers-k8s/elbv2-controller/apis/v1alpha1" ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" ackrtlog "github.com/aws-controllers-k8s/runtime/pkg/runtime/log" - svcsdk "github.com/aws/aws-sdk-go/service/elbv2" - - svcapitypes "github.com/aws-controllers-k8s/elbv2-controller/apis/v1alpha1" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" + svcsdktypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" ) var ( @@ -126,7 +127,7 @@ func (rm *resourceManager) registerTargets( TargetGroupArn: &arn, Targets: apifyTargetDescription(targets), } - _, err = rm.sdkapi.RegisterTargetsWithContext(ctx, input) + _, err = rm.sdkapi.RegisterTargets(ctx, input) rm.metrics.RecordAPICall("UPDATE", "RegisterTargets", err) if err != nil { return err @@ -140,6 +141,10 @@ func (rm *resourceManager) deregisterTargets( arn string, targets []*svcapitypes.TargetDescription, ) (err error) { + if len(targets) == 0 { + return nil + } + rlog := ackrtlog.FromContext(ctx) exit := rlog.Trace("rm.deregisterTargets") defer func() { exit(err) }() @@ -148,7 +153,7 @@ func (rm *resourceManager) deregisterTargets( TargetGroupArn: &arn, Targets: apifyTargetDescription(targets), } - _, err = rm.sdkapi.DeregisterTargetsWithContext(ctx, input) + _, err = rm.sdkapi.DeregisterTargets(ctx, input) rm.metrics.RecordAPICall("UPDATE", "DeregisterTargets", err) if err != nil { return err @@ -168,36 +173,49 @@ func (rm *resourceManager) describeTargets( input := &svcsdk.DescribeTargetHealthInput{ TargetGroupArn: (*string)(res.ko.Status.ACKResourceMetadata.ARN), } - resp, err := rm.sdkapi.DescribeTargetHealthWithContext(ctx, input) + resp, err := rm.sdkapi.DescribeTargetHealth(ctx, input) rm.metrics.RecordAPICall("READ_MANY", "DescribeTargetHealth", err) if err != nil { return err } - res.ko.Spec.Targets = extractTargetDescription(resp.TargetHealthDescriptions) + targetHealthPtrs := make([]*svcsdktypes.TargetHealthDescription, len(resp.TargetHealthDescriptions)) + for i := range resp.TargetHealthDescriptions { + targetHealthPtrs[i] = &resp.TargetHealthDescriptions[i] + } + res.ko.Spec.Targets = extractTargetDescription(targetHealthPtrs) return nil } -func apifyTargetDescription(target []*svcapitypes.TargetDescription) []*svcsdk.TargetDescription { - convertedTarget := make([]*svcsdk.TargetDescription, 0, len(target)) - for _, t := range target { - convertedTarget = append(convertedTarget, &svcsdk.TargetDescription{ - Id: (*string)(t.ID), - AvailabilityZone: (*string)(t.AvailabilityZone), - Port: (*int64)(t.Port), - }) +func apifyTargetDescription(target []*svcapitypes.TargetDescription) []svcsdktypes.TargetDescription { + convertedTarget := make([]svcsdktypes.TargetDescription, len(target)) + for i, t := range target { + td := svcsdktypes.TargetDescription{ + Id: t.ID, + AvailabilityZone: t.AvailabilityZone, + } + if t.Port != nil { + td.Port = aws.Int32(int32(*t.Port)) + } + convertedTarget[i] = td } return convertedTarget } -func extractTargetDescription(targetHealth []*svcsdk.TargetHealthDescription) []*svcapitypes.TargetDescription { +func extractTargetDescription(targetHealth []*svcsdktypes.TargetHealthDescription) []*svcapitypes.TargetDescription { convertedTarget := make([]*svcapitypes.TargetDescription, 0, len(targetHealth)) for _, t := range targetHealth { - convertedTarget = append(convertedTarget, &svcapitypes.TargetDescription{ - ID: (*string)(t.Target.Id), - AvailabilityZone: (*string)(t.Target.AvailabilityZone), - Port: (*int64)(t.Target.Port), - }) + if t.Target == nil { + continue + } + td := &svcapitypes.TargetDescription{ + ID: t.Target.Id, + AvailabilityZone: t.Target.AvailabilityZone, + } + if t.Target.Port != nil { + td.Port = aws.Int64(int64(*t.Target.Port)) + } + convertedTarget = append(convertedTarget, td) } return convertedTarget } diff --git a/pkg/resource/target_group/manager.go b/pkg/resource/target_group/manager.go index 82442f6..713cea9 100644 --- a/pkg/resource/target_group/manager.go +++ b/pkg/resource/target_group/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/elbv2" - svcsdkapi "github.com/aws/aws-sdk-go/service/elbv2/elbv2iface" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" "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.ELBV2API + // 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 @@ -289,24 +288,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/target_group/manager_factory.go b/pkg/resource/target_group/manager_factory.go index e4c774c..c75c2d8 100644 --- a/pkg/resource/target_group/manager_factory.go +++ b/pkg/resource/target_group/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/elbv2-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/target_group/sdk.go b/pkg/resource/target_group/sdk.go index df15e51..8be3568 100644 --- a/pkg/resource/target_group/sdk.go +++ b/pkg/resource/target_group/sdk.go @@ -19,6 +19,7 @@ import ( "context" "errors" "fmt" + "math" "reflect" "strings" @@ -28,8 +29,9 @@ 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/elbv2" + "github.com/aws/aws-sdk-go-v2/aws" + svcsdk "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2" + svcsdktypes "github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2/types" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -40,8 +42,7 @@ import ( var ( _ = &metav1.Time{} _ = strings.ToLower("") - _ = &aws.JSONValue{} - _ = &svcsdk.ELBV2{} + _ = &svcsdk.Client{} _ = &svcapitypes.TargetGroup{} _ = ackv1alpha1.AWSAccountID("") _ = &ackerr.NotFound @@ -49,6 +50,7 @@ var ( _ = &reflect.Value{} _ = fmt.Sprintf("") _ = &ackrequeue.NoRequeue{} + _ = &aws.Config{} ) // sdkFind returns SDK-specific information about a supplied resource @@ -73,10 +75,11 @@ func (rm *resourceManager) sdkFind( return nil, err } var resp *svcsdk.DescribeTargetGroupsOutput - resp, err = rm.sdkapi.DescribeTargetGroupsWithContext(ctx, input) + resp, err = rm.sdkapi.DescribeTargetGroups(ctx, input) rm.metrics.RecordAPICall("READ_MANY", "DescribeTargetGroups", err) if err != nil { - if awsErr, ok := ackerr.AWSError(err); ok && awsErr.Code() == "TargetGroupNotFound" { + var notFound *svcsdktypes.TargetGroupNotFoundException + if errors.As(err, ¬Found) { return nil, ackerr.NotFound } return nil, err @@ -94,7 +97,8 @@ func (rm *resourceManager) sdkFind( ko.Spec.HealthCheckEnabled = nil } if elem.HealthCheckIntervalSeconds != nil { - ko.Spec.HealthCheckIntervalSeconds = elem.HealthCheckIntervalSeconds + healthCheckIntervalSecondsCopy := int64(*elem.HealthCheckIntervalSeconds) + ko.Spec.HealthCheckIntervalSeconds = &healthCheckIntervalSecondsCopy } else { ko.Spec.HealthCheckIntervalSeconds = nil } @@ -108,34 +112,30 @@ func (rm *resourceManager) sdkFind( } else { ko.Spec.HealthCheckPort = nil } - if elem.HealthCheckProtocol != nil { - ko.Spec.HealthCheckProtocol = elem.HealthCheckProtocol + if elem.HealthCheckProtocol != "" { + ko.Spec.HealthCheckProtocol = aws.String(string(elem.HealthCheckProtocol)) } else { ko.Spec.HealthCheckProtocol = nil } if elem.HealthCheckTimeoutSeconds != nil { - ko.Spec.HealthCheckTimeoutSeconds = elem.HealthCheckTimeoutSeconds + healthCheckTimeoutSecondsCopy := int64(*elem.HealthCheckTimeoutSeconds) + ko.Spec.HealthCheckTimeoutSeconds = &healthCheckTimeoutSecondsCopy } else { ko.Spec.HealthCheckTimeoutSeconds = nil } if elem.HealthyThresholdCount != nil { - ko.Spec.HealthyThresholdCount = elem.HealthyThresholdCount + healthyThresholdCountCopy := int64(*elem.HealthyThresholdCount) + ko.Spec.HealthyThresholdCount = &healthyThresholdCountCopy } else { ko.Spec.HealthyThresholdCount = nil } - if elem.IpAddressType != nil { - ko.Spec.IPAddressType = elem.IpAddressType + if elem.IpAddressType != "" { + ko.Spec.IPAddressType = aws.String(string(elem.IpAddressType)) } else { ko.Spec.IPAddressType = nil } if elem.LoadBalancerArns != nil { - f8 := []*string{} - for _, f8iter := range elem.LoadBalancerArns { - var f8elem string - f8elem = *f8iter - f8 = append(f8, &f8elem) - } - ko.Status.LoadBalancerARNs = f8 + ko.Status.LoadBalancerARNs = aws.StringSlice(elem.LoadBalancerArns) } else { ko.Status.LoadBalancerARNs = nil } @@ -152,12 +152,13 @@ func (rm *resourceManager) sdkFind( ko.Spec.Matcher = nil } if elem.Port != nil { - ko.Spec.Port = elem.Port + portCopy := int64(*elem.Port) + ko.Spec.Port = &portCopy } else { ko.Spec.Port = nil } - if elem.Protocol != nil { - ko.Spec.Protocol = elem.Protocol + if elem.Protocol != "" { + ko.Spec.Protocol = aws.String(string(elem.Protocol)) } else { ko.Spec.Protocol = nil } @@ -178,13 +179,14 @@ func (rm *resourceManager) sdkFind( } else { ko.Spec.Name = nil } - if elem.TargetType != nil { - ko.Spec.TargetType = elem.TargetType + if elem.TargetType != "" { + ko.Spec.TargetType = aws.String(string(elem.TargetType)) } else { ko.Spec.TargetType = nil } if elem.UnhealthyThresholdCount != nil { - ko.Spec.UnhealthyThresholdCount = elem.UnhealthyThresholdCount + unhealthyThresholdCountCopy := int64(*elem.UnhealthyThresholdCount) + ko.Spec.UnhealthyThresholdCount = &unhealthyThresholdCountCopy } else { ko.Spec.UnhealthyThresholdCount = nil } @@ -229,9 +231,9 @@ func (rm *resourceManager) newListRequestPayload( res := &svcsdk.DescribeTargetGroupsInput{} if r.ko.Spec.Name != nil { - f2 := []*string{} - f2 = append(f2, r.ko.Spec.Name) - res.SetNames(f2) + f2 := []string{} + f2 = append(f2, *r.ko.Spec.Name) + res.Names = f2 } return res, nil @@ -256,7 +258,7 @@ func (rm *resourceManager) sdkCreate( var resp *svcsdk.CreateTargetGroupOutput _ = resp - resp, err = rm.sdkapi.CreateTargetGroupWithContext(ctx, input) + resp, err = rm.sdkapi.CreateTargetGroup(ctx, input) rm.metrics.RecordAPICall("CREATE", "CreateTargetGroup", err) if err != nil { return nil, err @@ -273,7 +275,8 @@ func (rm *resourceManager) sdkCreate( ko.Spec.HealthCheckEnabled = nil } if elem.HealthCheckIntervalSeconds != nil { - ko.Spec.HealthCheckIntervalSeconds = elem.HealthCheckIntervalSeconds + healthCheckIntervalSecondsCopy := int64(*elem.HealthCheckIntervalSeconds) + ko.Spec.HealthCheckIntervalSeconds = &healthCheckIntervalSecondsCopy } else { ko.Spec.HealthCheckIntervalSeconds = nil } @@ -287,34 +290,30 @@ func (rm *resourceManager) sdkCreate( } else { ko.Spec.HealthCheckPort = nil } - if elem.HealthCheckProtocol != nil { - ko.Spec.HealthCheckProtocol = elem.HealthCheckProtocol + if elem.HealthCheckProtocol != "" { + ko.Spec.HealthCheckProtocol = aws.String(string(elem.HealthCheckProtocol)) } else { ko.Spec.HealthCheckProtocol = nil } if elem.HealthCheckTimeoutSeconds != nil { - ko.Spec.HealthCheckTimeoutSeconds = elem.HealthCheckTimeoutSeconds + healthCheckTimeoutSecondsCopy := int64(*elem.HealthCheckTimeoutSeconds) + ko.Spec.HealthCheckTimeoutSeconds = &healthCheckTimeoutSecondsCopy } else { ko.Spec.HealthCheckTimeoutSeconds = nil } if elem.HealthyThresholdCount != nil { - ko.Spec.HealthyThresholdCount = elem.HealthyThresholdCount + healthyThresholdCountCopy := int64(*elem.HealthyThresholdCount) + ko.Spec.HealthyThresholdCount = &healthyThresholdCountCopy } else { ko.Spec.HealthyThresholdCount = nil } - if elem.IpAddressType != nil { - ko.Spec.IPAddressType = elem.IpAddressType + if elem.IpAddressType != "" { + ko.Spec.IPAddressType = aws.String(string(elem.IpAddressType)) } else { ko.Spec.IPAddressType = nil } if elem.LoadBalancerArns != nil { - f8 := []*string{} - for _, f8iter := range elem.LoadBalancerArns { - var f8elem string - f8elem = *f8iter - f8 = append(f8, &f8elem) - } - ko.Status.LoadBalancerARNs = f8 + ko.Status.LoadBalancerARNs = aws.StringSlice(elem.LoadBalancerArns) } else { ko.Status.LoadBalancerARNs = nil } @@ -331,12 +330,13 @@ func (rm *resourceManager) sdkCreate( ko.Spec.Matcher = nil } if elem.Port != nil { - ko.Spec.Port = elem.Port + portCopy := int64(*elem.Port) + ko.Spec.Port = &portCopy } else { ko.Spec.Port = nil } - if elem.Protocol != nil { - ko.Spec.Protocol = elem.Protocol + if elem.Protocol != "" { + ko.Spec.Protocol = aws.String(string(elem.Protocol)) } else { ko.Spec.Protocol = nil } @@ -357,13 +357,14 @@ func (rm *resourceManager) sdkCreate( } else { ko.Spec.Name = nil } - if elem.TargetType != nil { - ko.Spec.TargetType = elem.TargetType + if elem.TargetType != "" { + ko.Spec.TargetType = aws.String(string(elem.TargetType)) } else { ko.Spec.TargetType = nil } if elem.UnhealthyThresholdCount != nil { - ko.Spec.UnhealthyThresholdCount = elem.UnhealthyThresholdCount + unhealthyThresholdCountCopy := int64(*elem.UnhealthyThresholdCount) + ko.Spec.UnhealthyThresholdCount = &unhealthyThresholdCountCopy } else { ko.Spec.UnhealthyThresholdCount = nil } @@ -396,73 +397,93 @@ func (rm *resourceManager) newCreateRequestPayload( res := &svcsdk.CreateTargetGroupInput{} if r.ko.Spec.HealthCheckEnabled != nil { - res.SetHealthCheckEnabled(*r.ko.Spec.HealthCheckEnabled) + res.HealthCheckEnabled = r.ko.Spec.HealthCheckEnabled } if r.ko.Spec.HealthCheckIntervalSeconds != nil { - res.SetHealthCheckIntervalSeconds(*r.ko.Spec.HealthCheckIntervalSeconds) + if *r.ko.Spec.HealthCheckIntervalSeconds > math.MaxInt32 || *r.ko.Spec.HealthCheckIntervalSeconds < math.MinInt32 { + return nil, fmt.Errorf("error: field HealthCheckIntervalSeconds is of type int32") + } + healthCheckIntervalSecondsCopy := int32(*r.ko.Spec.HealthCheckIntervalSeconds) + res.HealthCheckIntervalSeconds = &healthCheckIntervalSecondsCopy } if r.ko.Spec.HealthCheckPath != nil { - res.SetHealthCheckPath(*r.ko.Spec.HealthCheckPath) + res.HealthCheckPath = r.ko.Spec.HealthCheckPath } if r.ko.Spec.HealthCheckPort != nil { - res.SetHealthCheckPort(*r.ko.Spec.HealthCheckPort) + res.HealthCheckPort = r.ko.Spec.HealthCheckPort } if r.ko.Spec.HealthCheckProtocol != nil { - res.SetHealthCheckProtocol(*r.ko.Spec.HealthCheckProtocol) + res.HealthCheckProtocol = svcsdktypes.ProtocolEnum(*r.ko.Spec.HealthCheckProtocol) } if r.ko.Spec.HealthCheckTimeoutSeconds != nil { - res.SetHealthCheckTimeoutSeconds(*r.ko.Spec.HealthCheckTimeoutSeconds) + if *r.ko.Spec.HealthCheckTimeoutSeconds > math.MaxInt32 || *r.ko.Spec.HealthCheckTimeoutSeconds < math.MinInt32 { + return nil, fmt.Errorf("error: field HealthCheckTimeoutSeconds is of type int32") + } + healthCheckTimeoutSecondsCopy := int32(*r.ko.Spec.HealthCheckTimeoutSeconds) + res.HealthCheckTimeoutSeconds = &healthCheckTimeoutSecondsCopy } if r.ko.Spec.HealthyThresholdCount != nil { - res.SetHealthyThresholdCount(*r.ko.Spec.HealthyThresholdCount) + if *r.ko.Spec.HealthyThresholdCount > math.MaxInt32 || *r.ko.Spec.HealthyThresholdCount < math.MinInt32 { + return nil, fmt.Errorf("error: field HealthyThresholdCount is of type int32") + } + healthyThresholdCountCopy := int32(*r.ko.Spec.HealthyThresholdCount) + res.HealthyThresholdCount = &healthyThresholdCountCopy } if r.ko.Spec.IPAddressType != nil { - res.SetIpAddressType(*r.ko.Spec.IPAddressType) + res.IpAddressType = svcsdktypes.TargetGroupIpAddressTypeEnum(*r.ko.Spec.IPAddressType) } if r.ko.Spec.Matcher != nil { - f8 := &svcsdk.Matcher{} + f8 := &svcsdktypes.Matcher{} if r.ko.Spec.Matcher.GRPCCode != nil { - f8.SetGrpcCode(*r.ko.Spec.Matcher.GRPCCode) + f8.GrpcCode = r.ko.Spec.Matcher.GRPCCode } if r.ko.Spec.Matcher.HTTPCode != nil { - f8.SetHttpCode(*r.ko.Spec.Matcher.HTTPCode) + f8.HttpCode = r.ko.Spec.Matcher.HTTPCode } - res.SetMatcher(f8) + res.Matcher = f8 } if r.ko.Spec.Name != nil { - res.SetName(*r.ko.Spec.Name) + res.Name = r.ko.Spec.Name } if r.ko.Spec.Port != nil { - res.SetPort(*r.ko.Spec.Port) + if *r.ko.Spec.Port > math.MaxInt32 || *r.ko.Spec.Port < math.MinInt32 { + return nil, fmt.Errorf("error: field Port is of type int32") + } + portCopy := int32(*r.ko.Spec.Port) + res.Port = &portCopy } if r.ko.Spec.Protocol != nil { - res.SetProtocol(*r.ko.Spec.Protocol) + res.Protocol = svcsdktypes.ProtocolEnum(*r.ko.Spec.Protocol) } if r.ko.Spec.ProtocolVersion != nil { - res.SetProtocolVersion(*r.ko.Spec.ProtocolVersion) + res.ProtocolVersion = r.ko.Spec.ProtocolVersion } if r.ko.Spec.Tags != nil { - f13 := []*svcsdk.Tag{} + f13 := []svcsdktypes.Tag{} for _, f13iter := range r.ko.Spec.Tags { - f13elem := &svcsdk.Tag{} + f13elem := &svcsdktypes.Tag{} if f13iter.Key != nil { - f13elem.SetKey(*f13iter.Key) + f13elem.Key = f13iter.Key } if f13iter.Value != nil { - f13elem.SetValue(*f13iter.Value) + f13elem.Value = f13iter.Value } - f13 = append(f13, f13elem) + f13 = append(f13, *f13elem) } - res.SetTags(f13) + res.Tags = f13 } if r.ko.Spec.TargetType != nil { - res.SetTargetType(*r.ko.Spec.TargetType) + res.TargetType = svcsdktypes.TargetTypeEnum(*r.ko.Spec.TargetType) } if r.ko.Spec.UnhealthyThresholdCount != nil { - res.SetUnhealthyThresholdCount(*r.ko.Spec.UnhealthyThresholdCount) + if *r.ko.Spec.UnhealthyThresholdCount > math.MaxInt32 || *r.ko.Spec.UnhealthyThresholdCount < math.MinInt32 { + return nil, fmt.Errorf("error: field UnhealthyThresholdCount is of type int32") + } + unhealthyThresholdCountCopy := int32(*r.ko.Spec.UnhealthyThresholdCount) + res.UnhealthyThresholdCount = &unhealthyThresholdCountCopy } if r.ko.Spec.VPCID != nil { - res.SetVpcId(*r.ko.Spec.VPCID) + res.VpcId = r.ko.Spec.VPCID } return res, nil @@ -508,7 +529,7 @@ func (rm *resourceManager) sdkUpdate( var resp *svcsdk.ModifyTargetGroupOutput _ = resp - resp, err = rm.sdkapi.ModifyTargetGroupWithContext(ctx, input) + resp, err = rm.sdkapi.ModifyTargetGroup(ctx, input) rm.metrics.RecordAPICall("UPDATE", "ModifyTargetGroup", err) if err != nil { return nil, err @@ -525,7 +546,8 @@ func (rm *resourceManager) sdkUpdate( ko.Spec.HealthCheckEnabled = nil } if elem.HealthCheckIntervalSeconds != nil { - ko.Spec.HealthCheckIntervalSeconds = elem.HealthCheckIntervalSeconds + healthCheckIntervalSecondsCopy := int64(*elem.HealthCheckIntervalSeconds) + ko.Spec.HealthCheckIntervalSeconds = &healthCheckIntervalSecondsCopy } else { ko.Spec.HealthCheckIntervalSeconds = nil } @@ -539,34 +561,30 @@ func (rm *resourceManager) sdkUpdate( } else { ko.Spec.HealthCheckPort = nil } - if elem.HealthCheckProtocol != nil { - ko.Spec.HealthCheckProtocol = elem.HealthCheckProtocol + if elem.HealthCheckProtocol != "" { + ko.Spec.HealthCheckProtocol = aws.String(string(elem.HealthCheckProtocol)) } else { ko.Spec.HealthCheckProtocol = nil } if elem.HealthCheckTimeoutSeconds != nil { - ko.Spec.HealthCheckTimeoutSeconds = elem.HealthCheckTimeoutSeconds + healthCheckTimeoutSecondsCopy := int64(*elem.HealthCheckTimeoutSeconds) + ko.Spec.HealthCheckTimeoutSeconds = &healthCheckTimeoutSecondsCopy } else { ko.Spec.HealthCheckTimeoutSeconds = nil } if elem.HealthyThresholdCount != nil { - ko.Spec.HealthyThresholdCount = elem.HealthyThresholdCount + healthyThresholdCountCopy := int64(*elem.HealthyThresholdCount) + ko.Spec.HealthyThresholdCount = &healthyThresholdCountCopy } else { ko.Spec.HealthyThresholdCount = nil } - if elem.IpAddressType != nil { - ko.Spec.IPAddressType = elem.IpAddressType + if elem.IpAddressType != "" { + ko.Spec.IPAddressType = aws.String(string(elem.IpAddressType)) } else { ko.Spec.IPAddressType = nil } if elem.LoadBalancerArns != nil { - f8 := []*string{} - for _, f8iter := range elem.LoadBalancerArns { - var f8elem string - f8elem = *f8iter - f8 = append(f8, &f8elem) - } - ko.Status.LoadBalancerARNs = f8 + ko.Status.LoadBalancerARNs = aws.StringSlice(elem.LoadBalancerArns) } else { ko.Status.LoadBalancerARNs = nil } @@ -583,12 +601,13 @@ func (rm *resourceManager) sdkUpdate( ko.Spec.Matcher = nil } if elem.Port != nil { - ko.Spec.Port = elem.Port + portCopy := int64(*elem.Port) + ko.Spec.Port = &portCopy } else { ko.Spec.Port = nil } - if elem.Protocol != nil { - ko.Spec.Protocol = elem.Protocol + if elem.Protocol != "" { + ko.Spec.Protocol = aws.String(string(elem.Protocol)) } else { ko.Spec.Protocol = nil } @@ -604,13 +623,14 @@ func (rm *resourceManager) sdkUpdate( tmpARN := ackv1alpha1.AWSResourceName(*elem.TargetGroupArn) ko.Status.ACKResourceMetadata.ARN = &tmpARN } - if elem.TargetType != nil { - ko.Spec.TargetType = elem.TargetType + if elem.TargetType != "" { + ko.Spec.TargetType = aws.String(string(elem.TargetType)) } else { ko.Spec.TargetType = nil } if elem.UnhealthyThresholdCount != nil { - ko.Spec.UnhealthyThresholdCount = elem.UnhealthyThresholdCount + unhealthyThresholdCountCopy := int64(*elem.UnhealthyThresholdCount) + ko.Spec.UnhealthyThresholdCount = &unhealthyThresholdCountCopy } else { ko.Spec.UnhealthyThresholdCount = nil } @@ -640,41 +660,57 @@ func (rm *resourceManager) newUpdateRequestPayload( res := &svcsdk.ModifyTargetGroupInput{} if r.ko.Spec.HealthCheckEnabled != nil { - res.SetHealthCheckEnabled(*r.ko.Spec.HealthCheckEnabled) + res.HealthCheckEnabled = r.ko.Spec.HealthCheckEnabled } if r.ko.Spec.HealthCheckIntervalSeconds != nil { - res.SetHealthCheckIntervalSeconds(*r.ko.Spec.HealthCheckIntervalSeconds) + if *r.ko.Spec.HealthCheckIntervalSeconds > math.MaxInt32 || *r.ko.Spec.HealthCheckIntervalSeconds < math.MinInt32 { + return nil, fmt.Errorf("error: field HealthCheckIntervalSeconds is of type int32") + } + healthCheckIntervalSecondsCopy := int32(*r.ko.Spec.HealthCheckIntervalSeconds) + res.HealthCheckIntervalSeconds = &healthCheckIntervalSecondsCopy } if r.ko.Spec.HealthCheckPath != nil { - res.SetHealthCheckPath(*r.ko.Spec.HealthCheckPath) + res.HealthCheckPath = r.ko.Spec.HealthCheckPath } if r.ko.Spec.HealthCheckPort != nil { - res.SetHealthCheckPort(*r.ko.Spec.HealthCheckPort) + res.HealthCheckPort = r.ko.Spec.HealthCheckPort } if r.ko.Spec.HealthCheckProtocol != nil { - res.SetHealthCheckProtocol(*r.ko.Spec.HealthCheckProtocol) + res.HealthCheckProtocol = svcsdktypes.ProtocolEnum(*r.ko.Spec.HealthCheckProtocol) } if r.ko.Spec.HealthCheckTimeoutSeconds != nil { - res.SetHealthCheckTimeoutSeconds(*r.ko.Spec.HealthCheckTimeoutSeconds) + if *r.ko.Spec.HealthCheckTimeoutSeconds > math.MaxInt32 || *r.ko.Spec.HealthCheckTimeoutSeconds < math.MinInt32 { + return nil, fmt.Errorf("error: field HealthCheckTimeoutSeconds is of type int32") + } + healthCheckTimeoutSecondsCopy := int32(*r.ko.Spec.HealthCheckTimeoutSeconds) + res.HealthCheckTimeoutSeconds = &healthCheckTimeoutSecondsCopy } if r.ko.Spec.HealthyThresholdCount != nil { - res.SetHealthyThresholdCount(*r.ko.Spec.HealthyThresholdCount) + if *r.ko.Spec.HealthyThresholdCount > math.MaxInt32 || *r.ko.Spec.HealthyThresholdCount < math.MinInt32 { + return nil, fmt.Errorf("error: field HealthyThresholdCount is of type int32") + } + healthyThresholdCountCopy := int32(*r.ko.Spec.HealthyThresholdCount) + res.HealthyThresholdCount = &healthyThresholdCountCopy } if r.ko.Spec.Matcher != nil { - f7 := &svcsdk.Matcher{} + f7 := &svcsdktypes.Matcher{} if r.ko.Spec.Matcher.GRPCCode != nil { - f7.SetGrpcCode(*r.ko.Spec.Matcher.GRPCCode) + f7.GrpcCode = r.ko.Spec.Matcher.GRPCCode } if r.ko.Spec.Matcher.HTTPCode != nil { - f7.SetHttpCode(*r.ko.Spec.Matcher.HTTPCode) + f7.HttpCode = r.ko.Spec.Matcher.HTTPCode } - res.SetMatcher(f7) + res.Matcher = f7 } if r.ko.Status.ACKResourceMetadata != nil && r.ko.Status.ACKResourceMetadata.ARN != nil { - res.SetTargetGroupArn(string(*r.ko.Status.ACKResourceMetadata.ARN)) + res.TargetGroupArn = (*string)(r.ko.Status.ACKResourceMetadata.ARN) } if r.ko.Spec.UnhealthyThresholdCount != nil { - res.SetUnhealthyThresholdCount(*r.ko.Spec.UnhealthyThresholdCount) + if *r.ko.Spec.UnhealthyThresholdCount > math.MaxInt32 || *r.ko.Spec.UnhealthyThresholdCount < math.MinInt32 { + return nil, fmt.Errorf("error: field UnhealthyThresholdCount is of type int32") + } + unhealthyThresholdCountCopy := int32(*r.ko.Spec.UnhealthyThresholdCount) + res.UnhealthyThresholdCount = &unhealthyThresholdCountCopy } return res, nil @@ -696,7 +732,7 @@ func (rm *resourceManager) sdkDelete( } var resp *svcsdk.DeleteTargetGroupOutput _ = resp - resp, err = rm.sdkapi.DeleteTargetGroupWithContext(ctx, input) + resp, err = rm.sdkapi.DeleteTargetGroup(ctx, input) rm.metrics.RecordAPICall("DELETE", "DeleteTargetGroup", err) return nil, err } @@ -709,7 +745,7 @@ func (rm *resourceManager) newDeleteRequestPayload( res := &svcsdk.DeleteTargetGroupInput{} if r.ko.Status.ACKResourceMetadata != nil && r.ko.Status.ACKResourceMetadata.ARN != nil { - res.SetTargetGroupArn(string(*r.ko.Status.ACKResourceMetadata.ARN)) + res.TargetGroupArn = (*string)(r.ko.Status.ACKResourceMetadata.ARN) } return res, nil @@ -817,12 +853,8 @@ func (rm *resourceManager) terminalAWSError(err error) bool { if err == nil { return false } - awsErr, ok := ackerr.AWSError(err) - if !ok { - return false - } - switch awsErr.Code() { - case "InvalidConfigurationRequest": + switch err.(type) { + case *svcsdktypes.InvalidConfigurationRequestException: return true default: return false diff --git a/templates/hooks/listener/sdk_read_many_post_build_request.go.tpl b/templates/hooks/listener/sdk_read_many_post_build_request.go.tpl index d3b542c..d1f0b99 100644 --- a/templates/hooks/listener/sdk_read_many_post_build_request.go.tpl +++ b/templates/hooks/listener/sdk_read_many_post_build_request.go.tpl @@ -1,5 +1,5 @@ // The ARN is guaranteed to be checked by the sdkFind method. We can safely cast it here. - input.SetListenerArns([]*string{(*string)(r.ko.Status.ACKResourceMetadata.ARN)}) + input.ListenerArns = []string{(string)(*r.ko.Status.ACKResourceMetadata.ARN)} // Unset the LoadBalancerArn field since we can't set both ListenerArn and LoadBalancerArn // Probably needs to be done in the code-generator. @a-hilaly. input.LoadBalancerArn = nil \ No newline at end of file diff --git a/templates/hooks/rule/sdk_read_many_post_build_request.go.tpl b/templates/hooks/rule/sdk_read_many_post_build_request.go.tpl index 49e1840..8ebff60 100644 --- a/templates/hooks/rule/sdk_read_many_post_build_request.go.tpl +++ b/templates/hooks/rule/sdk_read_many_post_build_request.go.tpl @@ -1,5 +1,5 @@ // The ARN is guaranteed to be checked by the sdkFind method. We can safely cast it here. - input.SetRuleArns([]*string{(*string)(r.ko.Status.ACKResourceMetadata.ARN)}) + input.RuleArns = []string{(string)(*r.ko.Status.ACKResourceMetadata.ARN)} // Unset the LoadBalancerArn field since we can't set both ListenerArn and LoadBalancerArn // Probably needs to be done in the code-generator. @a-hilaly. input.ListenerArn = nil \ No newline at end of file