diff --git a/.changelog/8d38094d80104d59889a8b422297f78d.json b/.changelog/8d38094d80104d59889a8b422297f78d.json new file mode 100644 index 00000000000..b45c88b9397 --- /dev/null +++ b/.changelog/8d38094d80104d59889a8b422297f78d.json @@ -0,0 +1,8 @@ +{ + "id": "8d38094d-8010-4d59-889a-8b422297f78d", + "type": "feature", + "description": "This release adds support for Multi-Region Replication with provisioned tables, and Keyspaces auto scaling APIs", + "modules": [ + "service/keyspaces" + ] +} \ No newline at end of file diff --git a/.changelog/ea815345a3bd450391365d21e53422c8.json b/.changelog/ea815345a3bd450391365d21e53422c8.json new file mode 100644 index 00000000000..48914ff6b6b --- /dev/null +++ b/.changelog/ea815345a3bd450391365d21e53422c8.json @@ -0,0 +1,8 @@ +{ + "id": "ea815345-a3bd-4503-9136-5d21e53422c8", + "type": "documentation", + "description": "Updating note for enabling streams for UpdateTable.", + "modules": [ + "service/dynamodb" + ] +} \ No newline at end of file diff --git a/service/dynamodb/api_op_UpdateTable.go b/service/dynamodb/api_op_UpdateTable.go index 5ff1bd9e917..190bd78d1b9 100644 --- a/service/dynamodb/api_op_UpdateTable.go +++ b/service/dynamodb/api_op_UpdateTable.go @@ -94,9 +94,8 @@ type UpdateTableInput struct { SSESpecification *types.SSESpecification // Represents the DynamoDB Streams configuration for the table. You receive a - // ResourceInUseException if you try to enable a stream on a table that already has - // a stream, or if you try to disable a stream on a table that doesn't have a - // stream. + // ValidationException if you try to enable a stream on a table that already has a + // stream, or if you try to disable a stream on a table that doesn't have a stream. StreamSpecification *types.StreamSpecification // The table class of the table to be updated. Valid values are STANDARD and diff --git a/service/keyspaces/api_op_CreateTable.go b/service/keyspaces/api_op_CreateTable.go index c9748e4bdbf..735bd3b949e 100644 --- a/service/keyspaces/api_op_CreateTable.go +++ b/service/keyspaces/api_op_CreateTable.go @@ -68,6 +68,17 @@ type CreateTableInput struct { // This member is required. TableName *string + // The optional auto scaling settings for a table in provisioned capacity mode. + // Specifies if the service can manage throughput capacity automatically on your + // behalf. Auto scaling helps you provision throughput capacity for variable + // workloads efficiently by increasing and decreasing your table's read and write + // capacity automatically in response to application traffic. For more information, + // see Managing throughput capacity automatically with Amazon Keyspaces auto + // scaling (https://docs.aws.amazon.com/keyspaces/latest/devguide/autoscaling.html) + // in the Amazon Keyspaces Developer Guide. By default, auto scaling is disabled + // for a table. + AutoScalingSpecification *types.AutoScalingSpecification + // Specifies the read/write throughput capacity mode for the table. The options // are: // - throughputMode:PAY_PER_REQUEST and @@ -114,6 +125,20 @@ type CreateTableInput struct { // in the Amazon Keyspaces Developer Guide. PointInTimeRecovery *types.PointInTimeRecovery + // The optional Amazon Web Services Region specific settings of a multi-Region + // table. These settings overwrite the general settings of the table for the + // specified Region. For a multi-Region table in provisioned capacity mode, you can + // configure the table's read capacity differently for each Region's replica. The + // write capacity, however, remains synchronized between all replicas to ensure + // that there's enough capacity to replicate writes across all Regions. To define + // the read capacity for a table replica in a specific Region, you can do so by + // configuring the following parameters. + // - region : The Region where these settings are applied. (Required) + // - readCapacityUnits : The provisioned read capacity units. (Optional) + // - readCapacityAutoScaling : The read capacity auto scaling settings for the + // table. (Optional) + ReplicaSpecifications []types.ReplicaSpecification + // A list of key-value pair tags to be attached to the resource. For more // information, see Adding tags and labels to Amazon Keyspaces resources (https://docs.aws.amazon.com/keyspaces/latest/devguide/tagging-keyspaces.html) // in the Amazon Keyspaces Developer Guide. diff --git a/service/keyspaces/api_op_GetTable.go b/service/keyspaces/api_op_GetTable.go index af6799ca8b9..e0b789a93f0 100644 --- a/service/keyspaces/api_op_GetTable.go +++ b/service/keyspaces/api_op_GetTable.go @@ -87,6 +87,10 @@ type GetTableOutput struct { // The point-in-time recovery status of the specified table. PointInTimeRecovery *types.PointInTimeRecoverySummary + // Returns the Amazon Web Services Region specific settings of all Regions a + // multi-Region table is replicated in. + ReplicaSpecifications []types.ReplicaSpecificationSummary + // The schema definition of the specified table. SchemaDefinition *types.SchemaDefinition diff --git a/service/keyspaces/api_op_GetTableAutoScalingSettings.go b/service/keyspaces/api_op_GetTableAutoScalingSettings.go new file mode 100644 index 00000000000..daf4d9cb35d --- /dev/null +++ b/service/keyspaces/api_op_GetTableAutoScalingSettings.go @@ -0,0 +1,168 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package keyspaces + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/keyspaces/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns auto scaling related settings of the specified table in JSON format. If +// the table is a multi-Region table, the Amazon Web Services Region specific auto +// scaling settings of the table are included. Amazon Keyspaces auto scaling helps +// you provision throughput capacity for variable workloads efficiently by +// increasing and decreasing your table's read and write capacity automatically in +// response to application traffic. For more information, see Managing throughput +// capacity automatically with Amazon Keyspaces auto scaling (https://docs.aws.amazon.com/keyspaces/latest/devguide/autoscaling.html) +// in the Amazon Keyspaces Developer Guide. +func (c *Client) GetTableAutoScalingSettings(ctx context.Context, params *GetTableAutoScalingSettingsInput, optFns ...func(*Options)) (*GetTableAutoScalingSettingsOutput, error) { + if params == nil { + params = &GetTableAutoScalingSettingsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetTableAutoScalingSettings", params, optFns, c.addOperationGetTableAutoScalingSettingsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetTableAutoScalingSettingsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetTableAutoScalingSettingsInput struct { + + // The name of the keyspace. + // + // This member is required. + KeyspaceName *string + + // The name of the table. + // + // This member is required. + TableName *string + + noSmithyDocumentSerde +} + +type GetTableAutoScalingSettingsOutput struct { + + // The name of the keyspace. + // + // This member is required. + KeyspaceName *string + + // The Amazon Resource Name (ARN) of the table. + // + // This member is required. + ResourceArn *string + + // The name of the table. + // + // This member is required. + TableName *string + + // The auto scaling settings of the table. + AutoScalingSpecification *types.AutoScalingSpecification + + // The Amazon Web Services Region specific settings of a multi-Region table. + // Returns the settings for all Regions the table is replicated in. + ReplicaSpecifications []types.ReplicaAutoScalingSpecification + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetTableAutoScalingSettingsMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson10_serializeOpGetTableAutoScalingSettings{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpGetTableAutoScalingSettings{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetTableAutoScalingSettings"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetTableAutoScalingSettingsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTableAutoScalingSettings(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetTableAutoScalingSettings(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetTableAutoScalingSettings", + } +} diff --git a/service/keyspaces/api_op_RestoreTable.go b/service/keyspaces/api_op_RestoreTable.go index 6ca5c666567..2a2f5abb5e3 100644 --- a/service/keyspaces/api_op_RestoreTable.go +++ b/service/keyspaces/api_op_RestoreTable.go @@ -13,7 +13,7 @@ import ( "time" ) -// Restores the specified table to the specified point in time within the +// Restores the table to the specified point in time within the // earliest_restorable_timestamp and the current time. For more information about // restore points, see Time window for PITR continuous backups (https://docs.aws.amazon.com/keyspaces/latest/devguide/PointInTimeRecovery_HowItWorks.html#howitworks_backup_window) // in the Amazon Keyspaces Developer Guide. Any number of users can execute up to 4 @@ -23,20 +23,20 @@ import ( // (day:hour:minute:second) to a new table. The Time to Live (TTL) settings are // also restored to the state based on the selected timestamp. In addition to the // table's schema, data, and TTL settings, RestoreTable restores the capacity -// mode, encryption, and point-in-time recovery settings from the source table. -// Unlike the table's schema data and TTL settings, which are restored based on the -// selected timestamp, these settings are always restored based on the table's -// settings as of the current time or when the table was deleted. You can also -// overwrite these settings during restore: +// mode, auto scaling settings, encryption settings, and point-in-time recovery +// settings from the source table. Unlike the table's schema data and TTL settings, +// which are restored based on the selected timestamp, these settings are always +// restored based on the table's settings as of the current time or when the table +// was deleted. You can also overwrite these settings during restore: // - Read/write capacity mode -// - Provisioned throughput capacity settings +// - Provisioned throughput capacity units +// - Auto scaling settings // - Point-in-time (PITR) settings // - Tags // // For more information, see PITR restore settings (https://docs.aws.amazon.com/keyspaces/latest/devguide/PointInTimeRecovery_HowItWorks.html#howitworks_backup_settings) // in the Amazon Keyspaces Developer Guide. Note that the following settings are // not restored, and you must configure them manually for the new table: -// - Automatic scaling policies (for tables that use provisioned capacity mode) // - Identity and Access Management (IAM) policies // - Amazon CloudWatch metrics and alarms func (c *Client) RestoreTable(ctx context.Context, params *RestoreTableInput, optFns ...func(*Options)) (*RestoreTableOutput, error) { @@ -76,6 +76,16 @@ type RestoreTableInput struct { // This member is required. TargetTableName *string + // The optional auto scaling settings for the restored table in provisioned + // capacity mode. Specifies if the service can manage throughput capacity of a + // provisioned table automatically on your behalf. Amazon Keyspaces auto scaling + // helps you provision throughput capacity for variable workloads efficiently by + // increasing and decreasing your table's read and write capacity automatically in + // response to application traffic. For more information, see Managing throughput + // capacity automatically with Amazon Keyspaces auto scaling (https://docs.aws.amazon.com/keyspaces/latest/devguide/autoscaling.html) + // in the Amazon Keyspaces Developer Guide. + AutoScalingSpecification *types.AutoScalingSpecification + // Specifies the read/write throughput capacity mode for the target table. The // options are: // - throughputMode:PAY_PER_REQUEST @@ -107,6 +117,9 @@ type RestoreTableInput struct { // in the Amazon Keyspaces Developer Guide. PointInTimeRecoveryOverride *types.PointInTimeRecovery + // The optional Region specific settings of a multi-Regional table. + ReplicaSpecifications []types.ReplicaSpecification + // The restore timestamp in ISO 8601 format. RestoreTimestamp *time.Time diff --git a/service/keyspaces/api_op_UpdateTable.go b/service/keyspaces/api_op_UpdateTable.go index 11bb9abcca7..d9e2acd74d7 100644 --- a/service/keyspaces/api_op_UpdateTable.go +++ b/service/keyspaces/api_op_UpdateTable.go @@ -13,8 +13,9 @@ import ( ) // Adds new columns to the table or updates one of the table's settings, for -// example capacity mode, encryption, point-in-time recovery, or ttl settings. Note -// that you can only update one specific table setting per update operation. +// example capacity mode, auto scaling, encryption, point-in-time recovery, or ttl +// settings. Note that you can only update one specific table setting per update +// operation. func (c *Client) UpdateTable(ctx context.Context, params *UpdateTableInput, optFns ...func(*Options)) (*UpdateTableOutput, error) { if params == nil { params = &UpdateTableInput{} @@ -48,6 +49,18 @@ type UpdateTableInput struct { // in the Amazon Keyspaces Developer Guide. AddColumns []types.ColumnDefinition + // The optional auto scaling settings to update for a table in provisioned + // capacity mode. Specifies if the service can manage throughput capacity of a + // provisioned table automatically on your behalf. Amazon Keyspaces auto scaling + // helps you provision throughput capacity for variable workloads efficiently by + // increasing and decreasing your table's read and write capacity automatically in + // response to application traffic. If auto scaling is already enabled for the + // table, you can use UpdateTable to update the minimum and maximum values or the + // auto scaling policy settings independently. For more information, see Managing + // throughput capacity automatically with Amazon Keyspaces auto scaling (https://docs.aws.amazon.com/keyspaces/latest/devguide/autoscaling.html) + // in the Amazon Keyspaces Developer Guide. + AutoScalingSpecification *types.AutoScalingSpecification + // Modifies the read/write throughput capacity mode for the table. The options // are: // - throughputMode:PAY_PER_REQUEST and @@ -89,6 +102,9 @@ type UpdateTableInput struct { // in the Amazon Keyspaces Developer Guide. PointInTimeRecovery *types.PointInTimeRecovery + // The Region specific settings of a multi-Regional table. + ReplicaSpecifications []types.ReplicaSpecification + // Modifies Time to Live custom settings for the table. The options are: // - status:enabled // - status:disabled diff --git a/service/keyspaces/deserializers.go b/service/keyspaces/deserializers.go index 7073fcca621..d8fc6f2cdfc 100644 --- a/service/keyspaces/deserializers.go +++ b/service/keyspaces/deserializers.go @@ -16,6 +16,7 @@ import ( smithytime "github.com/aws/smithy-go/time" smithyhttp "github.com/aws/smithy-go/transport/http" "io" + "math" "strings" ) @@ -766,6 +767,129 @@ func awsAwsjson10_deserializeOpErrorGetTable(response *smithyhttp.Response, meta } } +type awsAwsjson10_deserializeOpGetTableAutoScalingSettings struct { +} + +func (*awsAwsjson10_deserializeOpGetTableAutoScalingSettings) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson10_deserializeOpGetTableAutoScalingSettings) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson10_deserializeOpErrorGetTableAutoScalingSettings(response, &metadata) + } + output := &GetTableAutoScalingSettingsOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, 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 out, metadata, err + } + + err = awsAwsjson10_deserializeOpDocumentGetTableAutoScalingSettingsOutput(&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 out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson10_deserializeOpErrorGetTableAutoScalingSettings(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + 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) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsAwsjson10_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsAwsjson10_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsAwsjson10_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsAwsjson10_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsAwsjson10_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson10_deserializeOpListKeyspaces struct { } @@ -1886,6 +2010,154 @@ func awsAwsjson10_deserializeDocumentAccessDeniedException(v **types.AccessDenie return nil } +func awsAwsjson10_deserializeDocumentAutoScalingPolicy(v **types.AutoScalingPolicy, 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.AutoScalingPolicy + if *v == nil { + sv = &types.AutoScalingPolicy{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "targetTrackingScalingPolicyConfiguration": + if err := awsAwsjson10_deserializeDocumentTargetTrackingScalingPolicyConfiguration(&sv.TargetTrackingScalingPolicyConfiguration, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson10_deserializeDocumentAutoScalingSettings(v **types.AutoScalingSettings, 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.AutoScalingSettings + if *v == nil { + sv = &types.AutoScalingSettings{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "autoScalingDisabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected BooleanObject to be of type *bool, got %T instead", value) + } + sv.AutoScalingDisabled = jtv + } + + case "maximumUnits": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected CapacityUnits to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaximumUnits = ptr.Int64(i64) + } + + case "minimumUnits": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected CapacityUnits to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MinimumUnits = ptr.Int64(i64) + } + + case "scalingPolicy": + if err := awsAwsjson10_deserializeDocumentAutoScalingPolicy(&sv.ScalingPolicy, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson10_deserializeDocumentAutoScalingSpecification(v **types.AutoScalingSpecification, 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.AutoScalingSpecification + if *v == nil { + sv = &types.AutoScalingSpecification{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "readCapacityAutoScaling": + if err := awsAwsjson10_deserializeDocumentAutoScalingSettings(&sv.ReadCapacityAutoScaling, value); err != nil { + return err + } + + case "writeCapacityAutoScaling": + if err := awsAwsjson10_deserializeDocumentAutoScalingSettings(&sv.WriteCapacityAutoScaling, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeDocumentCapacitySpecificationSummary(v **types.CapacitySpecificationSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -2606,7 +2878,7 @@ func awsAwsjson10_deserializeDocumentRegionList(v *[]string, value interface{}) return nil } -func awsAwsjson10_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { +func awsAwsjson10_deserializeDocumentReplicaAutoScalingSpecification(v **types.ReplicaAutoScalingSpecification, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -2619,31 +2891,27 @@ func awsAwsjson10_deserializeDocumentResourceNotFoundException(v **types.Resourc return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.ResourceNotFoundException + var sv *types.ReplicaAutoScalingSpecification if *v == nil { - sv = &types.ResourceNotFoundException{} + sv = &types.ReplicaAutoScalingSpecification{} } else { sv = *v } for key, value := range shape { switch key { - 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 "autoScalingSpecification": + if err := awsAwsjson10_deserializeDocumentAutoScalingSpecification(&sv.AutoScalingSpecification, value); err != nil { + return err } - case "resourceArn": + case "region": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + return fmt.Errorf("expected region to be of type string, got %T instead", value) } - sv.ResourceArn = ptr.String(jtv) + sv.Region = ptr.String(jtv) } default: @@ -2655,7 +2923,7 @@ func awsAwsjson10_deserializeDocumentResourceNotFoundException(v **types.Resourc return nil } -func awsAwsjson10_deserializeDocumentSchemaDefinition(v **types.SchemaDefinition, value interface{}) error { +func awsAwsjson10_deserializeDocumentReplicaAutoScalingSpecificationList(v *[]types.ReplicaAutoScalingSpecification, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -2663,7 +2931,178 @@ func awsAwsjson10_deserializeDocumentSchemaDefinition(v **types.SchemaDefinition return nil } - shape, ok := value.(map[string]interface{}) + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.ReplicaAutoScalingSpecification + if *v == nil { + cv = []types.ReplicaAutoScalingSpecification{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ReplicaAutoScalingSpecification + destAddr := &col + if err := awsAwsjson10_deserializeDocumentReplicaAutoScalingSpecification(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsAwsjson10_deserializeDocumentReplicaSpecificationSummary(v **types.ReplicaSpecificationSummary, 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.ReplicaSpecificationSummary + if *v == nil { + sv = &types.ReplicaSpecificationSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "capacitySpecification": + if err := awsAwsjson10_deserializeDocumentCapacitySpecificationSummary(&sv.CapacitySpecification, value); err != nil { + return err + } + + case "region": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected region to be of type string, got %T instead", value) + } + sv.Region = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TableStatus to be of type string, got %T instead", value) + } + sv.Status = types.TableStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson10_deserializeDocumentReplicaSpecificationSummaryList(v *[]types.ReplicaSpecificationSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.ReplicaSpecificationSummary + if *v == nil { + cv = []types.ReplicaSpecificationSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ReplicaSpecificationSummary + destAddr := &col + if err := awsAwsjson10_deserializeDocumentReplicaSpecificationSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsAwsjson10_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, 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.ResourceNotFoundException + if *v == nil { + sv = &types.ResourceNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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 "resourceArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.ResourceArn = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson10_deserializeDocumentSchemaDefinition(v **types.SchemaDefinition, 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) } @@ -2995,6 +3434,106 @@ func awsAwsjson10_deserializeDocumentTagList(v *[]types.Tag, value interface{}) return nil } +func awsAwsjson10_deserializeDocumentTargetTrackingScalingPolicyConfiguration(v **types.TargetTrackingScalingPolicyConfiguration, 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.TargetTrackingScalingPolicyConfiguration + if *v == nil { + sv = &types.TargetTrackingScalingPolicyConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "disableScaleIn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected BooleanObject to be of type *bool, got %T instead", value) + } + sv.DisableScaleIn = jtv + } + + case "scaleInCooldown": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerObject to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.ScaleInCooldown = int32(i64) + } + + case "scaleOutCooldown": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected IntegerObject to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.ScaleOutCooldown = int32(i64) + } + + case "targetValue": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.TargetValue = f64 + + case string: + var f64 float64 + switch { + case strings.EqualFold(jtv, "NaN"): + f64 = math.NaN() + + case strings.EqualFold(jtv, "Infinity"): + f64 = math.Inf(1) + + case strings.EqualFold(jtv, "-Infinity"): + f64 = math.Inf(-1) + + default: + return fmt.Errorf("unknown JSON number value: %s", jtv) + + } + sv.TargetValue = f64 + + default: + return fmt.Errorf("expected DoubleObject to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeDocumentTimeToLive(v **types.TimeToLive, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -3280,6 +3819,74 @@ func awsAwsjson10_deserializeOpDocumentGetKeyspaceOutput(v **GetKeyspaceOutput, return nil } +func awsAwsjson10_deserializeOpDocumentGetTableAutoScalingSettingsOutput(v **GetTableAutoScalingSettingsOutput, 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 *GetTableAutoScalingSettingsOutput + if *v == nil { + sv = &GetTableAutoScalingSettingsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "autoScalingSpecification": + if err := awsAwsjson10_deserializeDocumentAutoScalingSpecification(&sv.AutoScalingSpecification, value); err != nil { + return err + } + + case "keyspaceName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KeyspaceName to be of type string, got %T instead", value) + } + sv.KeyspaceName = ptr.String(jtv) + } + + case "replicaSpecifications": + if err := awsAwsjson10_deserializeDocumentReplicaAutoScalingSpecificationList(&sv.ReplicaSpecifications, value); err != nil { + return err + } + + case "resourceArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ARN to be of type string, got %T instead", value) + } + sv.ResourceArn = ptr.String(jtv) + } + + case "tableName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TableName to be of type string, got %T instead", value) + } + sv.TableName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeOpDocumentGetTableOutput(v **GetTableOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -3365,6 +3972,11 @@ func awsAwsjson10_deserializeOpDocumentGetTableOutput(v **GetTableOutput, value return err } + case "replicaSpecifications": + if err := awsAwsjson10_deserializeDocumentReplicaSpecificationSummaryList(&sv.ReplicaSpecifications, value); err != nil { + return err + } + case "resourceArn": if value != nil { jtv, ok := value.(string) diff --git a/service/keyspaces/endpoints.go b/service/keyspaces/endpoints.go index 66c8c2e2cef..1f17fcb2189 100644 --- a/service/keyspaces/endpoints.go +++ b/service/keyspaces/endpoints.go @@ -366,8 +366,8 @@ func (r *resolver) ResolveEndpoint( } } if _UseFIPS == true { - if true == _PartitionResult.SupportsFIPS { - if "aws-us-gov" == _PartitionResult.Name { + if _PartitionResult.SupportsFIPS == true { + if _PartitionResult.Name == "aws-us-gov" { uriString := func() string { var out strings.Builder out.WriteString("https://cassandra.") diff --git a/service/keyspaces/generated.json b/service/keyspaces/generated.json index cbb87ee54a7..aa550f10bb5 100644 --- a/service/keyspaces/generated.json +++ b/service/keyspaces/generated.json @@ -15,6 +15,7 @@ "api_op_DeleteTable.go", "api_op_GetKeyspace.go", "api_op_GetTable.go", + "api_op_GetTableAutoScalingSettings.go", "api_op_ListKeyspaces.go", "api_op_ListTables.go", "api_op_ListTagsForResource.go", diff --git a/service/keyspaces/serializers.go b/service/keyspaces/serializers.go index 851a4009b5d..15228dcd2ad 100644 --- a/service/keyspaces/serializers.go +++ b/service/keyspaces/serializers.go @@ -13,6 +13,7 @@ import ( "github.com/aws/smithy-go/middleware" smithytime "github.com/aws/smithy-go/time" smithyhttp "github.com/aws/smithy-go/transport/http" + "math" "path" ) @@ -346,6 +347,61 @@ func (m *awsAwsjson10_serializeOpGetTable) HandleSerialize(ctx context.Context, return next.HandleSerialize(ctx, in) } +type awsAwsjson10_serializeOpGetTableAutoScalingSettings struct { +} + +func (*awsAwsjson10_serializeOpGetTableAutoScalingSettings) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson10_serializeOpGetTableAutoScalingSettings) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*GetTableAutoScalingSettingsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.0") + httpBindingEncoder.SetHeader("X-Amz-Target").String("KeyspacesService.GetTableAutoScalingSettings") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson10_serializeOpDocumentGetTableAutoScalingSettingsInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsjson10_serializeOpListKeyspaces struct { } @@ -730,6 +786,70 @@ func (m *awsAwsjson10_serializeOpUpdateTable) HandleSerialize(ctx context.Contex return next.HandleSerialize(ctx, in) } +func awsAwsjson10_serializeDocumentAutoScalingPolicy(v *types.AutoScalingPolicy, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.TargetTrackingScalingPolicyConfiguration != nil { + ok := object.Key("targetTrackingScalingPolicyConfiguration") + if err := awsAwsjson10_serializeDocumentTargetTrackingScalingPolicyConfiguration(v.TargetTrackingScalingPolicyConfiguration, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson10_serializeDocumentAutoScalingSettings(v *types.AutoScalingSettings, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AutoScalingDisabled { + ok := object.Key("autoScalingDisabled") + ok.Boolean(v.AutoScalingDisabled) + } + + if v.MaximumUnits != nil { + ok := object.Key("maximumUnits") + ok.Long(*v.MaximumUnits) + } + + if v.MinimumUnits != nil { + ok := object.Key("minimumUnits") + ok.Long(*v.MinimumUnits) + } + + if v.ScalingPolicy != nil { + ok := object.Key("scalingPolicy") + if err := awsAwsjson10_serializeDocumentAutoScalingPolicy(v.ScalingPolicy, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson10_serializeDocumentAutoScalingSpecification(v *types.AutoScalingSpecification, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ReadCapacityAutoScaling != nil { + ok := object.Key("readCapacityAutoScaling") + if err := awsAwsjson10_serializeDocumentAutoScalingSettings(v.ReadCapacityAutoScaling, ok); err != nil { + return err + } + } + + if v.WriteCapacityAutoScaling != nil { + ok := object.Key("writeCapacityAutoScaling") + if err := awsAwsjson10_serializeDocumentAutoScalingSettings(v.WriteCapacityAutoScaling, ok); err != nil { + return err + } + } + + return nil +} + func awsAwsjson10_serializeDocumentCapacitySpecification(v *types.CapacitySpecification, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -901,6 +1021,43 @@ func awsAwsjson10_serializeDocumentRegionList(v []string, value smithyjson.Value return nil } +func awsAwsjson10_serializeDocumentReplicaSpecification(v *types.ReplicaSpecification, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ReadCapacityAutoScaling != nil { + ok := object.Key("readCapacityAutoScaling") + if err := awsAwsjson10_serializeDocumentAutoScalingSettings(v.ReadCapacityAutoScaling, ok); err != nil { + return err + } + } + + if v.ReadCapacityUnits != nil { + ok := object.Key("readCapacityUnits") + ok.Long(*v.ReadCapacityUnits) + } + + if v.Region != nil { + ok := object.Key("region") + ok.String(*v.Region) + } + + return nil +} + +func awsAwsjson10_serializeDocumentReplicaSpecificationList(v []types.ReplicaSpecification, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsAwsjson10_serializeDocumentReplicaSpecification(&v[i], av); err != nil { + return err + } + } + return nil +} + func awsAwsjson10_serializeDocumentReplicationSpecification(v *types.ReplicationSpecification, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1010,6 +1167,46 @@ func awsAwsjson10_serializeDocumentTagList(v []types.Tag, value smithyjson.Value return nil } +func awsAwsjson10_serializeDocumentTargetTrackingScalingPolicyConfiguration(v *types.TargetTrackingScalingPolicyConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DisableScaleIn { + ok := object.Key("disableScaleIn") + ok.Boolean(v.DisableScaleIn) + } + + if v.ScaleInCooldown != 0 { + ok := object.Key("scaleInCooldown") + ok.Integer(v.ScaleInCooldown) + } + + if v.ScaleOutCooldown != 0 { + ok := object.Key("scaleOutCooldown") + ok.Integer(v.ScaleOutCooldown) + } + + { + ok := object.Key("targetValue") + switch { + case math.IsNaN(v.TargetValue): + ok.String("NaN") + + case math.IsInf(v.TargetValue, 1): + ok.String("Infinity") + + case math.IsInf(v.TargetValue, -1): + ok.String("-Infinity") + + default: + ok.Double(v.TargetValue) + + } + } + + return nil +} + func awsAwsjson10_serializeDocumentTimeToLive(v *types.TimeToLive, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1052,6 +1249,13 @@ func awsAwsjson10_serializeOpDocumentCreateTableInput(v *CreateTableInput, value object := value.Object() defer object.Close() + if v.AutoScalingSpecification != nil { + ok := object.Key("autoScalingSpecification") + if err := awsAwsjson10_serializeDocumentAutoScalingSpecification(v.AutoScalingSpecification, ok); err != nil { + return err + } + } + if v.CapacitySpecification != nil { ok := object.Key("capacitySpecification") if err := awsAwsjson10_serializeDocumentCapacitySpecification(v.CapacitySpecification, ok); err != nil { @@ -1097,6 +1301,13 @@ func awsAwsjson10_serializeOpDocumentCreateTableInput(v *CreateTableInput, value } } + if v.ReplicaSpecifications != nil { + ok := object.Key("replicaSpecifications") + if err := awsAwsjson10_serializeDocumentReplicaSpecificationList(v.ReplicaSpecifications, ok); err != nil { + return err + } + } + if v.SchemaDefinition != nil { ok := object.Key("schemaDefinition") if err := awsAwsjson10_serializeDocumentSchemaDefinition(v.SchemaDefinition, ok); err != nil { @@ -1167,6 +1378,23 @@ func awsAwsjson10_serializeOpDocumentGetKeyspaceInput(v *GetKeyspaceInput, value return nil } +func awsAwsjson10_serializeOpDocumentGetTableAutoScalingSettingsInput(v *GetTableAutoScalingSettingsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.KeyspaceName != nil { + ok := object.Key("keyspaceName") + ok.String(*v.KeyspaceName) + } + + if v.TableName != nil { + ok := object.Key("tableName") + ok.String(*v.TableName) + } + + return nil +} + func awsAwsjson10_serializeOpDocumentGetTableInput(v *GetTableInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1249,6 +1477,13 @@ func awsAwsjson10_serializeOpDocumentRestoreTableInput(v *RestoreTableInput, val object := value.Object() defer object.Close() + if v.AutoScalingSpecification != nil { + ok := object.Key("autoScalingSpecification") + if err := awsAwsjson10_serializeDocumentAutoScalingSpecification(v.AutoScalingSpecification, ok); err != nil { + return err + } + } + if v.CapacitySpecificationOverride != nil { ok := object.Key("capacitySpecificationOverride") if err := awsAwsjson10_serializeDocumentCapacitySpecification(v.CapacitySpecificationOverride, ok); err != nil { @@ -1270,6 +1505,13 @@ func awsAwsjson10_serializeOpDocumentRestoreTableInput(v *RestoreTableInput, val } } + if v.ReplicaSpecifications != nil { + ok := object.Key("replicaSpecifications") + if err := awsAwsjson10_serializeDocumentReplicaSpecificationList(v.ReplicaSpecifications, ok); err != nil { + return err + } + } + if v.RestoreTimestamp != nil { ok := object.Key("restoreTimestamp") ok.Double(smithytime.FormatEpochSeconds(*v.RestoreTimestamp)) @@ -1354,6 +1596,13 @@ func awsAwsjson10_serializeOpDocumentUpdateTableInput(v *UpdateTableInput, value } } + if v.AutoScalingSpecification != nil { + ok := object.Key("autoScalingSpecification") + if err := awsAwsjson10_serializeDocumentAutoScalingSpecification(v.AutoScalingSpecification, ok); err != nil { + return err + } + } + if v.CapacitySpecification != nil { ok := object.Key("capacitySpecification") if err := awsAwsjson10_serializeDocumentCapacitySpecification(v.CapacitySpecification, ok); err != nil { @@ -1392,6 +1641,13 @@ func awsAwsjson10_serializeOpDocumentUpdateTableInput(v *UpdateTableInput, value } } + if v.ReplicaSpecifications != nil { + ok := object.Key("replicaSpecifications") + if err := awsAwsjson10_serializeDocumentReplicaSpecificationList(v.ReplicaSpecifications, ok); err != nil { + return err + } + } + if v.TableName != nil { ok := object.Key("tableName") ok.String(*v.TableName) diff --git a/service/keyspaces/types/errors.go b/service/keyspaces/types/errors.go index 65919e9c019..d57d8840ef7 100644 --- a/service/keyspaces/types/errors.go +++ b/service/keyspaces/types/errors.go @@ -7,7 +7,7 @@ import ( smithy "github.com/aws/smithy-go" ) -// You do not have sufficient access to perform this action. +// You don't have sufficient access permissions to perform this action. type AccessDeniedException struct { Message *string @@ -33,7 +33,7 @@ func (e *AccessDeniedException) ErrorCode() string { } func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } -// Amazon Keyspaces could not complete the requested action. This error may occur +// Amazon Keyspaces couldn't complete the requested action. This error may occur // if you try to perform an action and the same or a different action is already in // progress, or if you try to create a resource that already exists. type ConflictException struct { diff --git a/service/keyspaces/types/types.go b/service/keyspaces/types/types.go index b6aff10a2ed..34ea555bddc 100644 --- a/service/keyspaces/types/types.go +++ b/service/keyspaces/types/types.go @@ -7,6 +7,91 @@ import ( "time" ) +// Amazon Keyspaces supports the target tracking auto scaling policy. With this +// policy, Amazon Keyspaces auto scaling ensures that the table's ratio of consumed +// to provisioned capacity stays at or near the target value that you specify. You +// define the target value as a percentage between 20 and 90. +type AutoScalingPolicy struct { + + // Auto scaling scales up capacity automatically when traffic exceeds this target + // utilization rate, and then back down when it falls below the target. A double + // between 20 and 90. + TargetTrackingScalingPolicyConfiguration *TargetTrackingScalingPolicyConfiguration + + noSmithyDocumentSerde +} + +// The optional auto scaling settings for a table with provisioned throughput +// capacity. To turn on auto scaling for a table in throughputMode:PROVISIONED , +// you must specify the following parameters. Configure the minimum and maximum +// units for write and read capacity. The auto scaling policy ensures that capacity +// never goes below the minimum or above the maximum range. +// - minimumUnits : The minimum level of throughput the table should always be +// ready to support. The value must be between 1 and the max throughput per second +// quota for your account (40,000 by default). +// - maximumUnits : The maximum level of throughput the table should always be +// ready to support. The value must be between 1 and the max throughput per second +// quota for your account (40,000 by default). +// - scalingPolicy : Amazon Keyspaces supports the target tracking scaling +// policy. The auto scaling target is the provisioned read and write capacity of +// the table. +// - targetTrackingScalingPolicyConfiguration : To define the target tracking +// policy, you must define the target value. +// - targetValue : The target utilization rate of the table. Amazon Keyspaces +// auto scaling ensures that the ratio of consumed capacity to provisioned capacity +// stays at or near this value. You define targetValue as a percentage. A double +// between 20 and 90. (Required) +// - disableScaleIn : A boolean that specifies if scale-in is disabled or enabled +// for the table. This parameter is disabled by default. To turn on scale-in , +// set the boolean value to FALSE . This means that capacity for a table can be +// automatically scaled down on your behalf. (Optional) +// - scaleInCooldown : A cooldown period in seconds between scaling activities +// that lets the table stabilize before another scale in activity starts. If no +// value is provided, the default is 0. (Optional) +// - scaleOutCooldown : A cooldown period in seconds between scaling activities +// that lets the table stabilize before another scale out activity starts. If no +// value is provided, the default is 0. (Optional) +// +// For more information, see Managing throughput capacity automatically with +// Amazon Keyspaces auto scaling (https://docs.aws.amazon.com/keyspaces/latest/devguide/autoscaling.html) +// in the Amazon Keyspaces Developer Guide. +type AutoScalingSettings struct { + + // This optional parameter enables auto scaling for the table if set to false . + AutoScalingDisabled bool + + // Manage costs by specifying the maximum amount of throughput to provision. The + // value must be between 1 and the max throughput per second quota for your account + // (40,000 by default). + MaximumUnits *int64 + + // The minimum level of throughput the table should always be ready to support. + // The value must be between 1 and the max throughput per second quota for your + // account (40,000 by default). + MinimumUnits *int64 + + // Amazon Keyspaces supports the target tracking auto scaling policy. With this + // policy, Amazon Keyspaces auto scaling ensures that the table's ratio of consumed + // to provisioned capacity stays at or near the target value that you specify. You + // define the target value as a percentage between 20 and 90. + ScalingPolicy *AutoScalingPolicy + + noSmithyDocumentSerde +} + +// The optional auto scaling settings for read and write capacity of a table in +// provisioned capacity mode. +type AutoScalingSpecification struct { + + // The auto scaling settings for the table's read capacity. + ReadCapacityAutoScaling *AutoScalingSettings + + // The auto scaling settings for the table's write capacity. + WriteCapacityAutoScaling *AutoScalingSettings + + noSmithyDocumentSerde +} + // Amazon Keyspaces has two read/write capacity modes for processing reads and // writes on your tables: // - On-demand (default) @@ -239,6 +324,73 @@ type PointInTimeRecoverySummary struct { noSmithyDocumentSerde } +// The auto scaling settings of a multi-Region table in the specified Amazon Web +// Services Region. +type ReplicaAutoScalingSpecification struct { + + // The auto scaling settings for a multi-Region table in the specified Amazon Web + // Services Region. + AutoScalingSpecification *AutoScalingSpecification + + // The Amazon Web Services Region. + Region *string + + noSmithyDocumentSerde +} + +// The Amazon Web Services Region specific settings of a multi-Region table. For a +// multi-Region table, you can configure the table's read capacity differently per +// Amazon Web Services Region. You can do this by configuring the following +// parameters. +// - region : The Region where these settings are applied. (Required) +// - readCapacityUnits : The provisioned read capacity units. (Optional) +// - readCapacityAutoScaling : The read capacity auto scaling settings for the +// table. (Optional) +type ReplicaSpecification struct { + + // The Amazon Web Services Region. + // + // This member is required. + Region *string + + // The read capacity auto scaling settings for the multi-Region table in the + // specified Amazon Web Services Region. + ReadCapacityAutoScaling *AutoScalingSettings + + // The provisioned read capacity units for the multi-Region table in the specified + // Amazon Web Services Region. + ReadCapacityUnits *int64 + + noSmithyDocumentSerde +} + +// The Region-specific settings of a multi-Region table in the specified Amazon +// Web Services Region. If the multi-Region table is using provisioned capacity and +// has optional auto scaling policies configured, note that the Region specific +// summary returns both read and write capacity settings. But only Region specific +// read capacity settings can be configured for a multi-Region table. In a +// multi-Region table, your write capacity units will be synced across all Amazon +// Web Services Regions to ensure that there is enough capacity to replicate write +// events across Regions. +type ReplicaSpecificationSummary struct { + + // The read/write throughput capacity mode for a table. The options are: + // - throughputMode:PAY_PER_REQUEST and + // - throughputMode:PROVISIONED . + // For more information, see Read/write capacity modes (https://docs.aws.amazon.com/keyspaces/latest/devguide/ReadWriteCapacityMode.html) + // in the Amazon Keyspaces Developer Guide. + CapacitySpecification *CapacitySpecificationSummary + + // The Amazon Web Services Region. + Region *string + + // The status of the multi-Region table in the specified Amazon Web Services + // Region. + Status TableStatus + + noSmithyDocumentSerde +} + // The replication specification of the keyspace includes: // - regionList - up to six Amazon Web Services Regions where the keyspace is // replicated in. @@ -341,6 +493,38 @@ type Tag struct { noSmithyDocumentSerde } +// The auto scaling policy that scales a table based on the ratio of consumed to +// provisioned capacity. +type TargetTrackingScalingPolicyConfiguration struct { + + // Specifies the target value for the target tracking auto scaling policy. Amazon + // Keyspaces auto scaling scales up capacity automatically when traffic exceeds + // this target utilization rate, and then back down when it falls below the target. + // This ensures that the ratio of consumed capacity to provisioned capacity stays + // at or near this value. You define targetValue as a percentage. A double between + // 20 and 90. + // + // This member is required. + TargetValue float64 + + // Specifies if scale-in is enabled. When auto scaling automatically decreases + // capacity for a table, the table scales in. When scaling policies are set, they + // can't scale in the table lower than its minimum capacity. + DisableScaleIn bool + + // Specifies a scale-in cool down period. A cooldown period in seconds between + // scaling activities that lets the table stabilize before another scaling activity + // starts. + ScaleInCooldown int32 + + // Specifies a scale out cool down period. A cooldown period in seconds between + // scaling activities that lets the table stabilize before another scaling activity + // starts. + ScaleOutCooldown int32 + + noSmithyDocumentSerde +} + // Enable custom Time to Live (TTL) settings for rows and columns without setting // a TTL default for the specified table. For more information, see Enabling TTL // on tables (https://docs.aws.amazon.com/keyspaces/latest/devguide/TTL-how-it-works.html#ttl-howitworks_enabling) diff --git a/service/keyspaces/validators.go b/service/keyspaces/validators.go index 2a2651b4aac..d1bd7443fb4 100644 --- a/service/keyspaces/validators.go +++ b/service/keyspaces/validators.go @@ -110,6 +110,26 @@ func (m *validateOpGetKeyspace) HandleInitialize(ctx context.Context, in middlew return next.HandleInitialize(ctx, in) } +type validateOpGetTableAutoScalingSettings struct { +} + +func (*validateOpGetTableAutoScalingSettings) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetTableAutoScalingSettings) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetTableAutoScalingSettingsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetTableAutoScalingSettingsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetTable struct { } @@ -270,6 +290,10 @@ func addOpGetKeyspaceValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetKeyspace{}, middleware.After) } +func addOpGetTableAutoScalingSettingsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetTableAutoScalingSettings{}, middleware.After) +} + func addOpGetTableValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetTable{}, middleware.After) } @@ -298,6 +322,62 @@ func addOpUpdateTableValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpUpdateTable{}, middleware.After) } +func validateAutoScalingPolicy(v *types.AutoScalingPolicy) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AutoScalingPolicy"} + if v.TargetTrackingScalingPolicyConfiguration != nil { + if err := validateTargetTrackingScalingPolicyConfiguration(v.TargetTrackingScalingPolicyConfiguration); err != nil { + invalidParams.AddNested("TargetTrackingScalingPolicyConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAutoScalingSettings(v *types.AutoScalingSettings) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AutoScalingSettings"} + if v.ScalingPolicy != nil { + if err := validateAutoScalingPolicy(v.ScalingPolicy); err != nil { + invalidParams.AddNested("ScalingPolicy", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateAutoScalingSpecification(v *types.AutoScalingSpecification) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AutoScalingSpecification"} + if v.WriteCapacityAutoScaling != nil { + if err := validateAutoScalingSettings(v.WriteCapacityAutoScaling); err != nil { + invalidParams.AddNested("WriteCapacityAutoScaling", err.(smithy.InvalidParamsError)) + } + } + if v.ReadCapacityAutoScaling != nil { + if err := validateAutoScalingSettings(v.ReadCapacityAutoScaling); err != nil { + invalidParams.AddNested("ReadCapacityAutoScaling", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateCapacitySpecification(v *types.CapacitySpecification) error { if v == nil { return nil @@ -475,6 +555,43 @@ func validatePointInTimeRecovery(v *types.PointInTimeRecovery) error { } } +func validateReplicaSpecification(v *types.ReplicaSpecification) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ReplicaSpecification"} + if v.Region == nil { + invalidParams.Add(smithy.NewErrParamRequired("Region")) + } + if v.ReadCapacityAutoScaling != nil { + if err := validateAutoScalingSettings(v.ReadCapacityAutoScaling); err != nil { + invalidParams.AddNested("ReadCapacityAutoScaling", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateReplicaSpecificationList(v []types.ReplicaSpecification) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ReplicaSpecificationList"} + for i := range v { + if err := validateReplicaSpecification(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateReplicationSpecification(v *types.ReplicationSpecification) error { if v == nil { return nil @@ -593,6 +710,18 @@ func validateTagList(v []types.Tag) error { } } +func validateTargetTrackingScalingPolicyConfiguration(v *types.TargetTrackingScalingPolicyConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TargetTrackingScalingPolicyConfiguration"} + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateTimeToLive(v *types.TimeToLive) error { if v == nil { return nil @@ -686,6 +815,16 @@ func validateOpCreateTableInput(v *CreateTableInput) error { invalidParams.AddNested("ClientSideTimestamps", err.(smithy.InvalidParamsError)) } } + if v.AutoScalingSpecification != nil { + if err := validateAutoScalingSpecification(v.AutoScalingSpecification); err != nil { + invalidParams.AddNested("AutoScalingSpecification", err.(smithy.InvalidParamsError)) + } + } + if v.ReplicaSpecifications != nil { + if err := validateReplicaSpecificationList(v.ReplicaSpecifications); err != nil { + invalidParams.AddNested("ReplicaSpecifications", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else { @@ -741,6 +880,24 @@ func validateOpGetKeyspaceInput(v *GetKeyspaceInput) error { } } +func validateOpGetTableAutoScalingSettingsInput(v *GetTableAutoScalingSettingsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetTableAutoScalingSettingsInput"} + if v.KeyspaceName == nil { + invalidParams.Add(smithy.NewErrParamRequired("KeyspaceName")) + } + if v.TableName == nil { + invalidParams.Add(smithy.NewErrParamRequired("TableName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetTableInput(v *GetTableInput) error { if v == nil { return nil @@ -826,6 +983,16 @@ func validateOpRestoreTableInput(v *RestoreTableInput) error { invalidParams.AddNested("TagsOverride", err.(smithy.InvalidParamsError)) } } + if v.AutoScalingSpecification != nil { + if err := validateAutoScalingSpecification(v.AutoScalingSpecification); err != nil { + invalidParams.AddNested("AutoScalingSpecification", err.(smithy.InvalidParamsError)) + } + } + if v.ReplicaSpecifications != nil { + if err := validateReplicaSpecificationList(v.ReplicaSpecifications); err != nil { + invalidParams.AddNested("ReplicaSpecifications", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else { @@ -918,6 +1085,16 @@ func validateOpUpdateTableInput(v *UpdateTableInput) error { invalidParams.AddNested("ClientSideTimestamps", err.(smithy.InvalidParamsError)) } } + if v.AutoScalingSpecification != nil { + if err := validateAutoScalingSpecification(v.AutoScalingSpecification); err != nil { + invalidParams.AddNested("AutoScalingSpecification", err.(smithy.InvalidParamsError)) + } + } + if v.ReplicaSpecifications != nil { + if err := validateReplicaSpecificationList(v.ReplicaSpecifications); err != nil { + invalidParams.AddNested("ReplicaSpecifications", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else {