diff --git a/.changelog/0568079831514cce9c8241fdc7489634.json b/.changelog/0568079831514cce9c8241fdc7489634.json new file mode 100644 index 00000000000..f526769c697 --- /dev/null +++ b/.changelog/0568079831514cce9c8241fdc7489634.json @@ -0,0 +1,8 @@ +{ + "id": "05680798-3151-4cce-9c82-41fdc7489634", + "type": "feature", + "description": "Adds support for waiters that automatically poll for a deleted NAT Gateway until it reaches the deleted state.", + "modules": [ + "service/ec2" + ] +} \ No newline at end of file diff --git a/.changelog/616290584a764d3eb406d7d0f3040db1.json b/.changelog/616290584a764d3eb406d7d0f3040db1.json new file mode 100644 index 00000000000..b1e51f9263b --- /dev/null +++ b/.changelog/616290584a764d3eb406d7d0f3040db1.json @@ -0,0 +1,8 @@ +{ + "id": "61629058-4a76-4d3e-b406-d7d0f3040db1", + "type": "feature", + "description": "Include additional exceptions types.", + "modules": [ + "service/chimesdkmeetings" + ] +} \ No newline at end of file diff --git a/service/chimesdkmeetings/deserializers.go b/service/chimesdkmeetings/deserializers.go index e359393e0f7..d8cf43bce74 100644 --- a/service/chimesdkmeetings/deserializers.go +++ b/service/chimesdkmeetings/deserializers.go @@ -129,12 +129,21 @@ func awsRestjson1_deserializeOpErrorBatchCreateAttendee(response *smithyhttp.Res case strings.EqualFold("NotFoundException", errorCode): return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + case strings.EqualFold("ServiceUnavailableException", errorCode): return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + case strings.EqualFold("UnauthorizedException", errorCode): return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) + case strings.EqualFold("UnprocessableEntityException", errorCode): + return awsRestjson1_deserializeErrorUnprocessableEntityException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -296,9 +305,15 @@ func awsRestjson1_deserializeOpErrorCreateAttendee(response *smithyhttp.Response case strings.EqualFold("NotFoundException", errorCode): return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + case strings.EqualFold("ServiceUnavailableException", errorCode): return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + case strings.EqualFold("UnauthorizedException", errorCode): return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) @@ -452,12 +467,21 @@ func awsRestjson1_deserializeOpErrorCreateMeeting(response *smithyhttp.Response, case strings.EqualFold("BadRequestException", errorCode): return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + case strings.EqualFold("ForbiddenException", errorCode): + return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) + case strings.EqualFold("LimitExceededException", errorCode): return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + case strings.EqualFold("ServiceUnavailableException", errorCode): return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + case strings.EqualFold("UnauthorizedException", errorCode): return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) @@ -608,12 +632,21 @@ func awsRestjson1_deserializeOpErrorCreateMeetingWithAttendees(response *smithyh case strings.EqualFold("BadRequestException", errorCode): return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + case strings.EqualFold("ForbiddenException", errorCode): + return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) + case strings.EqualFold("LimitExceededException", errorCode): return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + case strings.EqualFold("ServiceUnavailableException", errorCode): return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + case strings.EqualFold("UnauthorizedException", errorCode): return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) @@ -749,12 +782,27 @@ func awsRestjson1_deserializeOpErrorDeleteAttendee(response *smithyhttp.Response } switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + case strings.EqualFold("ForbiddenException", errorCode): return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) case strings.EqualFold("NotFoundException", errorCode): return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + + case strings.EqualFold("ServiceUnavailableException", errorCode): + return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("UnauthorizedException", errorCode): + return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -847,6 +895,21 @@ func awsRestjson1_deserializeOpErrorDeleteMeeting(response *smithyhttp.Response, case strings.EqualFold("ForbiddenException", errorCode): return awsRestjson1_deserializeErrorForbiddenException(response, errorBody) + case strings.EqualFold("NotFoundException", errorCode): + return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + + case strings.EqualFold("ServiceUnavailableException", errorCode): + return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("UnauthorizedException", errorCode): + return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -964,6 +1027,18 @@ func awsRestjson1_deserializeOpErrorGetAttendee(response *smithyhttp.Response, m case strings.EqualFold("NotFoundException", errorCode): return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + + case strings.EqualFold("ServiceUnavailableException", errorCode): + return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("UnauthorizedException", errorCode): + return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -1117,6 +1192,18 @@ func awsRestjson1_deserializeOpErrorGetMeeting(response *smithyhttp.Response, me case strings.EqualFold("NotFoundException", errorCode): return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + + case strings.EqualFold("ServiceUnavailableException", errorCode): + return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("UnauthorizedException", errorCode): + return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -1270,6 +1357,18 @@ func awsRestjson1_deserializeOpErrorListAttendees(response *smithyhttp.Response, case strings.EqualFold("NotFoundException", errorCode): return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + + case strings.EqualFold("ServiceUnavailableException", errorCode): + return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("UnauthorizedException", errorCode): + return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -1413,9 +1512,15 @@ func awsRestjson1_deserializeOpErrorStartMeetingTranscription(response *smithyht case strings.EqualFold("NotFoundException", errorCode): return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + case strings.EqualFold("ServiceUnavailableException", errorCode): return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + case strings.EqualFold("UnauthorizedException", errorCode): return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) @@ -1517,9 +1622,15 @@ func awsRestjson1_deserializeOpErrorStopMeetingTranscription(response *smithyhtt case strings.EqualFold("NotFoundException", errorCode): return awsRestjson1_deserializeErrorNotFoundException(response, errorBody) + case strings.EqualFold("ServiceFailureException", errorCode): + return awsRestjson1_deserializeErrorServiceFailureException(response, errorBody) + case strings.EqualFold("ServiceUnavailableException", errorCode): return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + case strings.EqualFold("UnauthorizedException", errorCode): return awsRestjson1_deserializeErrorUnauthorizedException(response, errorBody) @@ -1692,6 +1803,42 @@ func awsRestjson1_deserializeErrorNotFoundException(response *smithyhttp.Respons return output } +func awsRestjson1_deserializeErrorServiceFailureException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ServiceFailureException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentServiceFailureException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + func awsRestjson1_deserializeErrorServiceUnavailableException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.ServiceUnavailableException{} var buff [1024]byte @@ -1732,6 +1879,42 @@ func awsRestjson1_deserializeErrorServiceUnavailableException(response *smithyht return output } +func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ThrottlingException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + func awsRestjson1_deserializeErrorUnauthorizedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.UnauthorizedException{} var buff [1024]byte @@ -2485,6 +2668,64 @@ func awsRestjson1_deserializeDocumentNotFoundException(v **types.NotFoundExcepti return nil } +func awsRestjson1_deserializeDocumentServiceFailureException(v **types.ServiceFailureException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ServiceFailureException + if *v == nil { + sv = &types.ServiceFailureException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "RequestId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.RequestId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentServiceUnavailableException(v **types.ServiceUnavailableException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -2552,6 +2793,64 @@ func awsRestjson1_deserializeDocumentServiceUnavailableException(v **types.Servi return nil } +func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ThrottlingException + if *v == nil { + sv = &types.ThrottlingException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "RequestId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.RequestId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentUnauthorizedException(v **types.UnauthorizedException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/chimesdkmeetings/types/errors.go b/service/chimesdkmeetings/types/errors.go index 2867a0a3e7e..ee0525513f0 100644 --- a/service/chimesdkmeetings/types/errors.go +++ b/service/chimesdkmeetings/types/errors.go @@ -95,6 +95,28 @@ func (e *NotFoundException) ErrorMessage() string { func (e *NotFoundException) ErrorCode() string { return "NotFoundException" } func (e *NotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } +// The service encountered an unexpected error. +type ServiceFailureException struct { + Message *string + + Code *string + RequestId *string + + noSmithyDocumentSerde +} + +func (e *ServiceFailureException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ServiceFailureException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ServiceFailureException) ErrorCode() string { return "ServiceFailureException" } +func (e *ServiceFailureException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + // The service is currently unavailable. type ServiceUnavailableException struct { Message *string @@ -118,6 +140,28 @@ func (e *ServiceUnavailableException) ErrorMessage() string { func (e *ServiceUnavailableException) ErrorCode() string { return "ServiceUnavailableException" } func (e *ServiceUnavailableException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } +// The number of customer requests exceeds the request rate limit. +type ThrottlingException struct { + Message *string + + Code *string + RequestId *string + + noSmithyDocumentSerde +} + +func (e *ThrottlingException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ThrottlingException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ThrottlingException) ErrorCode() string { return "ThrottlingException" } +func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + // The user isn't authorized to request a resource. type UnauthorizedException struct { Message *string diff --git a/service/ec2/api_op_CreateKeyPair.go b/service/ec2/api_op_CreateKeyPair.go index 2d524850e5f..41812c6d004 100644 --- a/service/ec2/api_op_CreateKeyPair.go +++ b/service/ec2/api_op_CreateKeyPair.go @@ -63,7 +63,11 @@ type CreateKeyPairInput struct { // Describes a key pair. type CreateKeyPairOutput struct { - // The SHA-1 digest of the DER encoded private key. + // * For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded + // private key. + // + // * For ED25519 key pairs, the key fingerprint is the base64-encoded + // SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8. KeyFingerprint *string // An unencrypted PEM encoded RSA or ED25519 private key. diff --git a/service/ec2/api_op_DescribeInstances.go b/service/ec2/api_op_DescribeInstances.go index 64ca8b3245d..7858516d936 100644 --- a/service/ec2/api_op_DescribeInstances.go +++ b/service/ec2/api_op_DescribeInstances.go @@ -85,45 +85,48 @@ type DescribeInstancesInput struct { // block-device-mapping.volume-id - The volume ID of the EBS volume. // // * - // client-token - The idempotency token you provided when you launched the - // instance. + // capacity-reservation-id - The ID of the Capacity Reservation into which the + // instance was launched. // - // * dns-name - The public DNS name of the instance. + // * client-token - The idempotency token you provided when + // you launched the instance. // - // * group-id - The - // ID of the security group for the instance. EC2-Classic only. + // * dns-name - The public DNS name of the instance. // - // * group-name - The - // name of the security group for the instance. EC2-Classic only. + // * + // group-id - The ID of the security group for the instance. EC2-Classic only. // // * - // hibernation-options.configured - A Boolean that indicates whether the instance - // is enabled for hibernation. A value of true means that the instance is enabled - // for hibernation. + // group-name - The name of the security group for the instance. EC2-Classic + // only. // - // * host-id - The ID of the Dedicated Host on which the instance - // is running, if applicable. + // * hibernation-options.configured - A Boolean that indicates whether the + // instance is enabled for hibernation. A value of true means that the instance is + // enabled for hibernation. // - // * hypervisor - The hypervisor type of the instance - // (ovm | xen). The value xen is used for both Xen and Nitro hypervisors. + // * host-id - The ID of the Dedicated Host on which the + // instance is running, if applicable. // - // * - // iam-instance-profile.arn - The instance profile associated with the instance. - // Specified as an ARN. + // * hypervisor - The hypervisor type of the + // instance (ovm | xen). The value xen is used for both Xen and Nitro + // hypervisors. // - // * image-id - The ID of the image used to launch the - // instance. + // * iam-instance-profile.arn - The instance profile associated with + // the instance. Specified as an ARN. + // + // * image-id - The ID of the image used to + // launch the instance. // // * instance-id - The ID of the instance. // - // * instance-lifecycle - - // Indicates whether this is a Spot Instance or a Scheduled Instance (spot | - // scheduled). + // * + // instance-lifecycle - Indicates whether this is a Spot Instance or a Scheduled + // Instance (spot | scheduled). // - // * instance-state-code - The state of the instance, as a 16-bit - // unsigned integer. The high byte is used for internal purposes and should be - // ignored. The low byte is set based on the state represented. The valid values - // are: 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 + // * instance-state-code - The state of the instance, + // as a 16-bit unsigned integer. The high byte is used for internal purposes and + // should be ignored. The low byte is set based on the state represented. The valid + // values are: 0 (pending), 16 (running), 32 (shutting-down), 48 (terminated), 64 // (stopping), and 80 (stopped). // // * instance-state-name - The state of the instance diff --git a/service/ec2/api_op_DescribeNatGateways.go b/service/ec2/api_op_DescribeNatGateways.go index 119e37a10e8..8f581b07082 100644 --- a/service/ec2/api_op_DescribeNatGateways.go +++ b/service/ec2/api_op_DescribeNatGateways.go @@ -506,6 +506,193 @@ func natGatewayAvailableStateRetryable(ctx context.Context, input *DescribeNatGa return true, nil } +// NatGatewayDeletedWaiterOptions are waiter options for NatGatewayDeletedWaiter +type NatGatewayDeletedWaiterOptions struct { + + // Set of options to modify how an operation is invoked. These apply to all + // operations invoked for this client. Use functional options on operation call to + // modify this list for per operation behavior. + APIOptions []func(*middleware.Stack) error + + // MinDelay is the minimum amount of time to delay between retries. If unset, + // NatGatewayDeletedWaiter will use default minimum delay of 15 seconds. Note that + // MinDelay must resolve to a value lesser than or equal to the MaxDelay. + MinDelay time.Duration + + // MaxDelay is the maximum amount of time to delay between retries. If unset or set + // to zero, NatGatewayDeletedWaiter will use default max delay of 120 seconds. Note + // that MaxDelay must resolve to value greater than or equal to the MinDelay. + MaxDelay time.Duration + + // LogWaitAttempts is used to enable logging for waiter retry attempts + LogWaitAttempts bool + + // Retryable is function that can be used to override the service defined + // waiter-behavior based on operation output, or returned error. This function is + // used by the waiter to decide if a state is retryable or a terminal state. By + // default service-modeled logic will populate this option. This option can thus be + // used to define a custom waiter state with fall-back to service-modeled waiter + // state mutators.The function returns an error in case of a failure state. In case + // of retry state, this function returns a bool value of true and nil error, while + // in case of success it returns a bool value of false and nil error. + Retryable func(context.Context, *DescribeNatGatewaysInput, *DescribeNatGatewaysOutput, error) (bool, error) +} + +// NatGatewayDeletedWaiter defines the waiters for NatGatewayDeleted +type NatGatewayDeletedWaiter struct { + client DescribeNatGatewaysAPIClient + + options NatGatewayDeletedWaiterOptions +} + +// NewNatGatewayDeletedWaiter constructs a NatGatewayDeletedWaiter. +func NewNatGatewayDeletedWaiter(client DescribeNatGatewaysAPIClient, optFns ...func(*NatGatewayDeletedWaiterOptions)) *NatGatewayDeletedWaiter { + options := NatGatewayDeletedWaiterOptions{} + options.MinDelay = 15 * time.Second + options.MaxDelay = 120 * time.Second + options.Retryable = natGatewayDeletedStateRetryable + + for _, fn := range optFns { + fn(&options) + } + return &NatGatewayDeletedWaiter{ + client: client, + options: options, + } +} + +// Wait calls the waiter function for NatGatewayDeleted waiter. The maxWaitDur is +// the maximum wait duration the waiter will wait. The maxWaitDur is required and +// must be greater than zero. +func (w *NatGatewayDeletedWaiter) Wait(ctx context.Context, params *DescribeNatGatewaysInput, maxWaitDur time.Duration, optFns ...func(*NatGatewayDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for NatGatewayDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *NatGatewayDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeNatGatewaysInput, maxWaitDur time.Duration, optFns ...func(*NatGatewayDeletedWaiterOptions)) (*DescribeNatGatewaysOutput, error) { + if maxWaitDur <= 0 { + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") + } + + options := w.options + for _, fn := range optFns { + fn(&options) + } + + if options.MaxDelay <= 0 { + options.MaxDelay = 120 * time.Second + } + + if options.MinDelay > options.MaxDelay { + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + } + + ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) + defer cancelFn() + + logger := smithywaiter.Logger{} + remainingTime := maxWaitDur + + var attempt int64 + for { + + attempt++ + apiOptions := options.APIOptions + start := time.Now() + + if options.LogWaitAttempts { + logger.Attempt = attempt + apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...) + apiOptions = append(apiOptions, logger.AddLogger) + } + + out, err := w.client.DescribeNatGateways(ctx, params, func(o *Options) { + o.APIOptions = append(o.APIOptions, apiOptions...) + }) + + retryable, err := options.Retryable(ctx, params, out, err) + if err != nil { + return nil, err + } + if !retryable { + return out, nil + } + + remainingTime -= time.Since(start) + if remainingTime < options.MinDelay || remainingTime <= 0 { + break + } + + // compute exponential backoff between waiter retries + delay, err := smithywaiter.ComputeDelay( + attempt, options.MinDelay, options.MaxDelay, remainingTime, + ) + if err != nil { + return nil, fmt.Errorf("error computing waiter delay, %w", err) + } + + remainingTime -= delay + // sleep for the delay amount before invoking a request + if err := smithytime.SleepWithContext(ctx, delay); err != nil { + return nil, fmt.Errorf("request cancelled while waiting, %w", err) + } + } + return nil, fmt.Errorf("exceeded max wait time for NatGatewayDeleted waiter") +} + +func natGatewayDeletedStateRetryable(ctx context.Context, input *DescribeNatGatewaysInput, output *DescribeNatGatewaysOutput, err error) (bool, error) { + + if err == nil { + pathValue, err := jmespath.Search("NatGateways[].State", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "deleted" + var match = true + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + if len(listOfValues) == 0 { + match = false + } + for _, v := range listOfValues { + value, ok := v.(types.NatGatewayState) + if !ok { + return false, fmt.Errorf("waiter comparator expected types.NatGatewayState value, got %T", pathValue) + } + + if string(value) != expectedValue { + match = false + } + } + + if match { + return false, nil + } + } + + if err != nil { + var apiErr smithy.APIError + ok := errors.As(err, &apiErr) + if !ok { + return false, fmt.Errorf("expected err to be of type smithy.APIError, got %w", err) + } + + if "NatGatewayNotFound" == apiErr.ErrorCode() { + return false, nil + } + } + + return true, nil +} + func newServiceMetadataMiddleware_opDescribeNatGateways(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, diff --git a/service/ec2/api_op_DescribeSpotInstanceRequests.go b/service/ec2/api_op_DescribeSpotInstanceRequests.go index 51cd6dda203..e02b2f68318 100644 --- a/service/ec2/api_op_DescribeSpotInstanceRequests.go +++ b/service/ec2/api_op_DescribeSpotInstanceRequests.go @@ -159,11 +159,11 @@ type DescribeSpotInstanceRequestsInput struct { // request (open | active | closed | cancelled | failed). Spot request status // information can help you track your Amazon EC2 Spot Instance requests. For more // information, see Spot request status - // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) in - // the Amazon EC2 User Guide for Linux Instances. + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html) + // in the Amazon EC2 User Guide for Linux Instances. // - // * status-code - The short code - // describing the most recent evaluation of your Spot Instance request. + // * status-code - The short + // code describing the most recent evaluation of your Spot Instance request. // // * // status-message - The message explaining the status of the Spot Instance diff --git a/service/ec2/api_op_ImportKeyPair.go b/service/ec2/api_op_ImportKeyPair.go index 1f062b9bf44..53a413a6a1b 100644 --- a/service/ec2/api_op_ImportKeyPair.go +++ b/service/ec2/api_op_ImportKeyPair.go @@ -62,7 +62,12 @@ type ImportKeyPairInput struct { type ImportKeyPairOutput struct { - // The MD5 public key fingerprint as specified in section 4 of RFC 4716. + // * For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as + // specified in section 4 of RFC 4716. + // + // * For ED25519 key pairs, the key + // fingerprint is the base64-encoded SHA-256 digest, which is the default for + // OpenSSH, starting with OpenSSH 6.8 (http://www.openssh.com/txt/release-6.8). KeyFingerprint *string // The key pair name that you provided. diff --git a/service/ec2/api_op_ModifySubnetAttribute.go b/service/ec2/api_op_ModifySubnetAttribute.go index 092c27dc024..01473bf6af4 100644 --- a/service/ec2/api_op_ModifySubnetAttribute.go +++ b/service/ec2/api_op_ModifySubnetAttribute.go @@ -97,11 +97,11 @@ type ModifySubnetAttributeInput struct { // in the specified subnet should be assigned a public IPv4 address. MapPublicIpOnLaunch *types.AttributeBooleanValue - // The type of hostnames to assign to instances in the subnet at launch. For IPv4 - // only subnets, an instance DNS name must be based on the instance IPv4 address. - // For IPv6 only subnets, an instance DNS name must be based on the instance ID. - // For dual-stack subnets, you can specify whether DNS names use the instance IPv4 - // address or the instance ID. + // The type of hostname to assign to instances in the subnet at launch. For + // IPv4-only and dual-stack (IPv4 and IPv6) subnets, an instance DNS name can be + // based on the instance IPv4 address (ip-name) or the instance ID (resource-name). + // For IPv6 only subnets, an instance DNS name must be based on the instance ID + // (resource-name). PrivateDnsHostnameTypeOnLaunch types.HostnameType noSmithyDocumentSerde diff --git a/service/ec2/api_op_RequestSpotFleet.go b/service/ec2/api_op_RequestSpotFleet.go index bad92599d76..90c6cb35c12 100644 --- a/service/ec2/api_op_RequestSpotFleet.go +++ b/service/ec2/api_op_RequestSpotFleet.go @@ -28,6 +28,11 @@ import ( // spot-fleet-request and instance resource types are supported. For more // information, see Spot Fleet requests // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet-requests.html) +// in the Amazon EC2 User Guide for Linux Instances. We strongly discourage using +// the RequestSpotFleet API because it is a legacy API with no planned investment. +// For options for requesting Spot Instances, see Which is the best Spot request +// method to use? +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-best-practices.html#which-spot-request-method-to-use) // in the Amazon EC2 User Guide for Linux Instances. func (c *Client) RequestSpotFleet(ctx context.Context, params *RequestSpotFleetInput, optFns ...func(*Options)) (*RequestSpotFleetOutput, error) { if params == nil { diff --git a/service/ec2/api_op_RequestSpotInstances.go b/service/ec2/api_op_RequestSpotInstances.go index 1c8fc86e7bd..0201b772aa3 100644 --- a/service/ec2/api_op_RequestSpotInstances.go +++ b/service/ec2/api_op_RequestSpotInstances.go @@ -15,7 +15,12 @@ import ( // Creates a Spot Instance request. For more information, see Spot Instance // requests // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html) in the -// Amazon EC2 User Guide for Linux Instances. +// Amazon EC2 User Guide for Linux Instances. We strongly discourage using the +// RequestSpotInstances API because it is a legacy API with no planned investment. +// For options for requesting Spot Instances, see Which is the best Spot request +// method to use? +// (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-best-practices.html#which-spot-request-method-to-use) +// in the Amazon EC2 User Guide for Linux Instances. func (c *Client) RequestSpotInstances(ctx context.Context, params *RequestSpotInstancesInput, optFns ...func(*Options)) (*RequestSpotInstancesOutput, error) { if params == nil { params = &RequestSpotInstancesInput{} diff --git a/service/ec2/types/types.go b/service/ec2/types/types.go index bf9b811f4f1..cece986d8c9 100644 --- a/service/ec2/types/types.go +++ b/service/ec2/types/types.go @@ -7294,7 +7294,7 @@ type LaunchSpecification struct { // The ID of the AMI. ImageId *string - // The instance type. + // The instance type. Only one instance type can be specified. InstanceType InstanceType // The ID of the kernel. @@ -10762,7 +10762,7 @@ type RequestSpotLaunchSpecification struct { // The ID of the AMI. ImageId *string - // The instance type. + // The instance type. Only one instance type can be specified. InstanceType InstanceType // The ID of the kernel. @@ -12906,10 +12906,10 @@ type SpotInstanceRequest struct { // The maximum price per hour that you are willing to pay for a Spot Instance. SpotPrice *string - // The state of the Spot Instance request. Spot status information helps track your - // Spot Instance requests. For more information, see Spot status - // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html) in - // the Amazon EC2 User Guide for Linux Instances. + // The state of the Spot Instance request. Spot request status information helps + // track your Spot Instance requests. For more information, see Spot request status + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html) + // in the Amazon EC2 User Guide for Linux Instances. State SpotInstanceState // The status code and status message describing the Spot Instance request. @@ -12955,8 +12955,8 @@ type SpotInstanceStateFault struct { // Describes the status of a Spot Instance request. type SpotInstanceStatus struct { - // The status code. For a list of status codes, see Spot status codes - // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-bid-status.html#spot-instance-bid-status-understand) + // The status code. For a list of status codes, see Spot request status codes + // (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-request-status.html#spot-instance-request-status-understand) // in the Amazon EC2 User Guide for Linux Instances. Code *string