From 769b1e08ea9acae6b2488864977a444dccb59e62 Mon Sep 17 00:00:00 2001 From: AWS SDK for Go v2 automation user Date: Wed, 22 Nov 2023 19:42:02 +0000 Subject: [PATCH] Regenerated Clients --- .../73bce282ad544603bf98c27597f0c089.json | 8 + .../a0225ddcc20d4d8cb1cb4dfd7510d3c6.json | 8 + .../d1ddac3601b7422b90eb5b8911c339ad.json | 8 + service/kinesis/api_op_AddTagsToStream.go | 11 +- .../api_op_DecreaseStreamRetentionPeriod.go | 11 +- .../kinesis/api_op_DeleteResourcePolicy.go | 142 ++ service/kinesis/api_op_DeleteStream.go | 24 +- service/kinesis/api_op_DescribeStream.go | 19 +- .../kinesis/api_op_DescribeStreamConsumer.go | 4 +- .../kinesis/api_op_DescribeStreamSummary.go | 12 +- .../api_op_DisableEnhancedMonitoring.go | 5 +- .../api_op_EnableEnhancedMonitoring.go | 5 +- service/kinesis/api_op_GetRecords.go | 19 +- service/kinesis/api_op_GetResourcePolicy.go | 148 ++ service/kinesis/api_op_GetShardIterator.go | 19 +- .../api_op_IncreaseStreamRetentionPeriod.go | 15 +- service/kinesis/api_op_ListShards.go | 9 +- service/kinesis/api_op_ListTagsForStream.go | 6 +- service/kinesis/api_op_MergeShards.go | 12 +- service/kinesis/api_op_PutRecord.go | 27 +- service/kinesis/api_op_PutRecords.go | 35 +- service/kinesis/api_op_PutResourcePolicy.go | 159 ++ .../kinesis/api_op_RemoveTagsFromStream.go | 9 +- service/kinesis/api_op_SplitShard.go | 23 +- .../kinesis/api_op_StartStreamEncryption.go | 31 +- .../kinesis/api_op_StopStreamEncryption.go | 29 +- service/kinesis/api_op_UpdateShardCount.go | 35 +- service/kinesis/deserializers.go | 362 ++++ service/kinesis/endpoints.go | 187 +- service/kinesis/endpoints_test.go | 1784 +++++++++++++++++ service/kinesis/generated.json | 3 + service/kinesis/serializers.go | 206 ++ service/kinesis/validators.go | 120 ++ service/s3control/deserializers.go | 260 +++ service/s3control/serializers.go | 118 ++ service/s3control/types/types.go | 49 +- service/sagemaker/api_op_DescribeDomain.go | 4 +- service/sagemaker/deserializers.go | 45 + service/sagemaker/serializers.go | 19 + service/sagemaker/types/types.go | 28 +- service/sagemaker/validators.go | 20 + 41 files changed, 3856 insertions(+), 182 deletions(-) create mode 100644 .changelog/73bce282ad544603bf98c27597f0c089.json create mode 100644 .changelog/a0225ddcc20d4d8cb1cb4dfd7510d3c6.json create mode 100644 .changelog/d1ddac3601b7422b90eb5b8911c339ad.json create mode 100644 service/kinesis/api_op_DeleteResourcePolicy.go create mode 100644 service/kinesis/api_op_GetResourcePolicy.go create mode 100644 service/kinesis/api_op_PutResourcePolicy.go diff --git a/.changelog/73bce282ad544603bf98c27597f0c089.json b/.changelog/73bce282ad544603bf98c27597f0c089.json new file mode 100644 index 00000000000..e62e76fecee --- /dev/null +++ b/.changelog/73bce282ad544603bf98c27597f0c089.json @@ -0,0 +1,8 @@ +{ + "id": "73bce282-ad54-4603-bf98-c27597f0c089", + "type": "feature", + "description": "Amazon S3 Batch Operations now manages buckets or prefixes in a single step.", + "modules": [ + "service/s3control" + ] +} \ No newline at end of file diff --git a/.changelog/a0225ddcc20d4d8cb1cb4dfd7510d3c6.json b/.changelog/a0225ddcc20d4d8cb1cb4dfd7510d3c6.json new file mode 100644 index 00000000000..eaa2935a580 --- /dev/null +++ b/.changelog/a0225ddcc20d4d8cb1cb4dfd7510d3c6.json @@ -0,0 +1,8 @@ +{ + "id": "a0225ddc-c20d-4d8c-b1cb-4dfd7510d3c6", + "type": "feature", + "description": "This release adds support for resource based policies on streams and consumers.", + "modules": [ + "service/kinesis" + ] +} \ No newline at end of file diff --git a/.changelog/d1ddac3601b7422b90eb5b8911c339ad.json b/.changelog/d1ddac3601b7422b90eb5b8911c339ad.json new file mode 100644 index 00000000000..a1d4e734286 --- /dev/null +++ b/.changelog/d1ddac3601b7422b90eb5b8911c339ad.json @@ -0,0 +1,8 @@ +{ + "id": "d1ddac36-01b7-422b-90eb-5b8911c339ad", + "type": "feature", + "description": "This feature adds the end user license agreement status as a model access configuration parameter.", + "modules": [ + "service/sagemaker" + ] +} \ No newline at end of file diff --git a/service/kinesis/api_op_AddTagsToStream.go b/service/kinesis/api_op_AddTagsToStream.go index 652856b7ab2..90ff65c9236 100644 --- a/service/kinesis/api_op_AddTagsToStream.go +++ b/service/kinesis/api_op_AddTagsToStream.go @@ -13,11 +13,12 @@ import ( ) // Adds or updates tags for the specified Kinesis data stream. You can assign up -// to 50 tags to a data stream. When invoking this API, it is recommended you use -// the StreamARN input parameter rather than the StreamName input parameter. If -// tags have already been assigned to the stream, AddTagsToStream overwrites any -// existing tags that correspond to the specified tag keys. AddTagsToStream has a -// limit of five transactions per second per account. +// to 50 tags to a data stream. When invoking this API, you must use either the +// StreamARN or the StreamName parameter, or both. It is recommended that you use +// the StreamARN input parameter when you invoke this API. If tags have already +// been assigned to the stream, AddTagsToStream overwrites any existing tags that +// correspond to the specified tag keys. AddTagsToStream has a limit of five +// transactions per second per account. func (c *Client) AddTagsToStream(ctx context.Context, params *AddTagsToStreamInput, optFns ...func(*Options)) (*AddTagsToStreamOutput, error) { if params == nil { params = &AddTagsToStreamInput{} diff --git a/service/kinesis/api_op_DecreaseStreamRetentionPeriod.go b/service/kinesis/api_op_DecreaseStreamRetentionPeriod.go index 51d74363758..c0b2b0fcf40 100644 --- a/service/kinesis/api_op_DecreaseStreamRetentionPeriod.go +++ b/service/kinesis/api_op_DecreaseStreamRetentionPeriod.go @@ -14,11 +14,12 @@ import ( // Decreases the Kinesis data stream's retention period, which is the length of // time data records are accessible after they are added to the stream. The minimum -// value of a stream's retention period is 24 hours. When invoking this API, it is -// recommended you use the StreamARN input parameter rather than the StreamName -// input parameter. This operation may result in lost data. For example, if the -// stream's retention period is 48 hours and is decreased to 24 hours, any data -// already in the stream that is older than 24 hours is inaccessible. +// value of a stream's retention period is 24 hours. When invoking this API, you +// must use either the StreamARN or the StreamName parameter, or both. It is +// recommended that you use the StreamARN input parameter when you invoke this +// API. This operation may result in lost data. For example, if the stream's +// retention period is 48 hours and is decreased to 24 hours, any data already in +// the stream that is older than 24 hours is inaccessible. func (c *Client) DecreaseStreamRetentionPeriod(ctx context.Context, params *DecreaseStreamRetentionPeriodInput, optFns ...func(*Options)) (*DecreaseStreamRetentionPeriodOutput, error) { if params == nil { params = &DecreaseStreamRetentionPeriodInput{} diff --git a/service/kinesis/api_op_DeleteResourcePolicy.go b/service/kinesis/api_op_DeleteResourcePolicy.go new file mode 100644 index 00000000000..329fa09b4c5 --- /dev/null +++ b/service/kinesis/api_op_DeleteResourcePolicy.go @@ -0,0 +1,142 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package kinesis + +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/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Delete a policy for the specified data stream or consumer. Request patterns can +// be one of the following: +// - Data stream pattern: arn:aws.*:kinesis:.*:\d{12}:.*stream/\S+ +// - Consumer pattern: +// ^(arn):aws.*:kinesis:.*:\d{12}:.*stream\/[a-zA-Z0-9_.-]+\/consumer\/[a-zA-Z0-9_.-]+:[0-9]+ +func (c *Client) DeleteResourcePolicy(ctx context.Context, params *DeleteResourcePolicyInput, optFns ...func(*Options)) (*DeleteResourcePolicyOutput, error) { + if params == nil { + params = &DeleteResourcePolicyInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteResourcePolicy", params, optFns, c.addOperationDeleteResourcePolicyMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteResourcePolicyOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteResourcePolicyInput struct { + + // The Amazon Resource Name (ARN) of the data stream or consumer. + // + // This member is required. + ResourceARN *string + + noSmithyDocumentSerde +} + +func (in *DeleteResourcePolicyInput) bindEndpointParams(p *EndpointParameters) { + p.ResourceARN = in.ResourceARN + p.OperationType = ptr.String("control") +} + +type DeleteResourcePolicyOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteResourcePolicy{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteResourcePolicy{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteResourcePolicy"); 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 = addOpDeleteResourcePolicyValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteResourcePolicy(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_opDeleteResourcePolicy(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteResourcePolicy", + } +} diff --git a/service/kinesis/api_op_DeleteStream.go b/service/kinesis/api_op_DeleteStream.go index 11cd1a83d26..b3f326ac98f 100644 --- a/service/kinesis/api_op_DeleteStream.go +++ b/service/kinesis/api_op_DeleteStream.go @@ -15,18 +15,18 @@ import ( // Deletes a Kinesis data stream and all its shards and data. You must shut down // any applications that are operating on the stream before you delete the stream. // If an application attempts to operate on a deleted stream, it receives the -// exception ResourceNotFoundException . When invoking this API, it is recommended -// you use the StreamARN input parameter rather than the StreamName input -// parameter. If the stream is in the ACTIVE state, you can delete it. After a -// DeleteStream request, the specified stream is in the DELETING state until -// Kinesis Data Streams completes the deletion. Note: Kinesis Data Streams might -// continue to accept data read and write operations, such as PutRecord , -// PutRecords , and GetRecords , on a stream in the DELETING state until the -// stream deletion is complete. When you delete a stream, any shards in that stream -// are also deleted, and any tags are dissociated from the stream. You can use the -// DescribeStreamSummary operation to check the state of the stream, which is -// returned in StreamStatus . DeleteStream has a limit of five transactions per -// second per account. +// exception ResourceNotFoundException . When invoking this API, you must use +// either the StreamARN or the StreamName parameter, or both. It is recommended +// that you use the StreamARN input parameter when you invoke this API. If the +// stream is in the ACTIVE state, you can delete it. After a DeleteStream request, +// the specified stream is in the DELETING state until Kinesis Data Streams +// completes the deletion. Note: Kinesis Data Streams might continue to accept data +// read and write operations, such as PutRecord , PutRecords , and GetRecords , on +// a stream in the DELETING state until the stream deletion is complete. When you +// delete a stream, any shards in that stream are also deleted, and any tags are +// dissociated from the stream. You can use the DescribeStreamSummary operation to +// check the state of the stream, which is returned in StreamStatus . DeleteStream +// has a limit of five transactions per second per account. func (c *Client) DeleteStream(ctx context.Context, params *DeleteStreamInput, optFns ...func(*Options)) (*DeleteStreamOutput, error) { if params == nil { params = &DeleteStreamInput{} diff --git a/service/kinesis/api_op_DescribeStream.go b/service/kinesis/api_op_DescribeStream.go index 6657728e1b7..bca2bad01dc 100644 --- a/service/kinesis/api_op_DescribeStream.go +++ b/service/kinesis/api_op_DescribeStream.go @@ -22,15 +22,16 @@ import ( // highly recommended that you use the DescribeStreamSummary API to get a // summarized description of the specified Kinesis data stream and the ListShards // API to list the shards in a specified data stream and obtain information about -// each shard. When invoking this API, it is recommended you use the StreamARN -// input parameter rather than the StreamName input parameter. The information -// returned includes the stream name, Amazon Resource Name (ARN), creation time, -// enhanced metric configuration, and shard map. The shard map is an array of shard -// objects. For each shard object, there is the hash key and sequence number ranges -// that the shard spans, and the IDs of any earlier shards that played in a role in -// creating the shard. Every record ingested in the stream is identified by a -// sequence number, which is assigned when the record is put into the stream. You -// can limit the number of shards returned by each call. For more information, see +// each shard. When invoking this API, you must use either the StreamARN or the +// StreamName parameter, or both. It is recommended that you use the StreamARN +// input parameter when you invoke this API. The information returned includes the +// stream name, Amazon Resource Name (ARN), creation time, enhanced metric +// configuration, and shard map. The shard map is an array of shard objects. For +// each shard object, there is the hash key and sequence number ranges that the +// shard spans, and the IDs of any earlier shards that played in a role in creating +// the shard. Every record ingested in the stream is identified by a sequence +// number, which is assigned when the record is put into the stream. You can limit +// the number of shards returned by each call. For more information, see // Retrieving Shards from a Stream (https://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-sdk-java-retrieve-shards.html) // in the Amazon Kinesis Data Streams Developer Guide. There are no guarantees // about the chronological order shards returned. To process shards in diff --git a/service/kinesis/api_op_DescribeStreamConsumer.go b/service/kinesis/api_op_DescribeStreamConsumer.go index a9e8c7d66d8..8764f7553cc 100644 --- a/service/kinesis/api_op_DescribeStreamConsumer.go +++ b/service/kinesis/api_op_DescribeStreamConsumer.go @@ -20,7 +20,9 @@ import ( // the name or ARN of the consumer that you want to describe, you can use the // ListStreamConsumers operation to get a list of the descriptions of all the // consumers that are currently registered with a given data stream. This operation -// has a limit of 20 transactions per second per stream. +// has a limit of 20 transactions per second per stream. When making a +// cross-account call with DescribeStreamConsumer , make sure to provide the ARN of +// the consumer. func (c *Client) DescribeStreamConsumer(ctx context.Context, params *DescribeStreamConsumerInput, optFns ...func(*Options)) (*DescribeStreamConsumerOutput, error) { if params == nil { params = &DescribeStreamConsumerInput{} diff --git a/service/kinesis/api_op_DescribeStreamSummary.go b/service/kinesis/api_op_DescribeStreamSummary.go index 1e748c53e2a..33c9977cfa9 100644 --- a/service/kinesis/api_op_DescribeStreamSummary.go +++ b/service/kinesis/api_op_DescribeStreamSummary.go @@ -14,12 +14,12 @@ import ( ) // Provides a summarized description of the specified Kinesis data stream without -// the shard list. When invoking this API, it is recommended you use the StreamARN -// input parameter rather than the StreamName input parameter. The information -// returned includes the stream name, Amazon Resource Name (ARN), status, record -// retention period, approximate creation time, monitoring, encryption details, and -// open shard count. DescribeStreamSummary has a limit of 20 transactions per -// second per account. +// the shard list. When invoking this API, you must use either the StreamARN or +// the StreamName parameter, or both. It is recommended that you use the StreamARN +// input parameter when you invoke this API. The information returned includes the +// stream name, Amazon Resource Name (ARN), status, record retention period, +// approximate creation time, monitoring, encryption details, and open shard count. +// DescribeStreamSummary has a limit of 20 transactions per second per account. func (c *Client) DescribeStreamSummary(ctx context.Context, params *DescribeStreamSummaryInput, optFns ...func(*Options)) (*DescribeStreamSummaryOutput, error) { if params == nil { params = &DescribeStreamSummaryInput{} diff --git a/service/kinesis/api_op_DisableEnhancedMonitoring.go b/service/kinesis/api_op_DisableEnhancedMonitoring.go index 1ef5c92fabb..5ba220694b2 100644 --- a/service/kinesis/api_op_DisableEnhancedMonitoring.go +++ b/service/kinesis/api_op_DisableEnhancedMonitoring.go @@ -13,8 +13,9 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Disables enhanced monitoring. When invoking this API, it is recommended you use -// the StreamARN input parameter rather than the StreamName input parameter. +// Disables enhanced monitoring. When invoking this API, you must use either the +// StreamARN or the StreamName parameter, or both. It is recommended that you use +// the StreamARN input parameter when you invoke this API. func (c *Client) DisableEnhancedMonitoring(ctx context.Context, params *DisableEnhancedMonitoringInput, optFns ...func(*Options)) (*DisableEnhancedMonitoringOutput, error) { if params == nil { params = &DisableEnhancedMonitoringInput{} diff --git a/service/kinesis/api_op_EnableEnhancedMonitoring.go b/service/kinesis/api_op_EnableEnhancedMonitoring.go index 6c6ada0be78..578aeedbe61 100644 --- a/service/kinesis/api_op_EnableEnhancedMonitoring.go +++ b/service/kinesis/api_op_EnableEnhancedMonitoring.go @@ -14,8 +14,9 @@ import ( ) // Enables enhanced Kinesis data stream monitoring for shard-level metrics. When -// invoking this API, it is recommended you use the StreamARN input parameter -// rather than the StreamName input parameter. +// invoking this API, you must use either the StreamARN or the StreamName +// parameter, or both. It is recommended that you use the StreamARN input +// parameter when you invoke this API. func (c *Client) EnableEnhancedMonitoring(ctx context.Context, params *EnableEnhancedMonitoringInput, optFns ...func(*Options)) (*EnableEnhancedMonitoringOutput, error) { if params == nil { params = &EnableEnhancedMonitoringInput{} diff --git a/service/kinesis/api_op_GetRecords.go b/service/kinesis/api_op_GetRecords.go index 6127a6301cf..bde614cdb49 100644 --- a/service/kinesis/api_op_GetRecords.go +++ b/service/kinesis/api_op_GetRecords.go @@ -16,15 +16,16 @@ import ( ) // Gets data records from a Kinesis data stream's shard. When invoking this API, -// it is recommended you use the StreamARN input parameter in addition to the -// ShardIterator parameter. Specify a shard iterator using the ShardIterator -// parameter. The shard iterator specifies the position in the shard from which you -// want to start reading data records sequentially. If there are no records -// available in the portion of the shard that the iterator points to, GetRecords -// returns an empty list. It might take multiple calls to get to a portion of the -// shard that contains records. You can scale by provisioning multiple shards per -// stream while considering service limits (for more information, see Amazon -// Kinesis Data Streams Limits (https://docs.aws.amazon.com/kinesis/latest/dev/service-sizes-and-limits.html) +// you must use either the StreamARN or the StreamName parameter, or both. It is +// recommended that you use the StreamARN input parameter when you invoke this +// API. Specify a shard iterator using the ShardIterator parameter. The shard +// iterator specifies the position in the shard from which you want to start +// reading data records sequentially. If there are no records available in the +// portion of the shard that the iterator points to, GetRecords returns an empty +// list. It might take multiple calls to get to a portion of the shard that +// contains records. You can scale by provisioning multiple shards per stream while +// considering service limits (for more information, see Amazon Kinesis Data +// Streams Limits (https://docs.aws.amazon.com/kinesis/latest/dev/service-sizes-and-limits.html) // in the Amazon Kinesis Data Streams Developer Guide). Your application should // have one thread per shard, each reading continuously from its stream. To read // from a stream continually, call GetRecords in a loop. Use GetShardIterator to diff --git a/service/kinesis/api_op_GetResourcePolicy.go b/service/kinesis/api_op_GetResourcePolicy.go new file mode 100644 index 00000000000..bc0811684d4 --- /dev/null +++ b/service/kinesis/api_op_GetResourcePolicy.go @@ -0,0 +1,148 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package kinesis + +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/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns a policy attached to the specified data stream or consumer. Request +// patterns can be one of the following: +// - Data stream pattern: arn:aws.*:kinesis:.*:\d{12}:.*stream/\S+ +// - Consumer pattern: +// ^(arn):aws.*:kinesis:.*:\d{12}:.*stream\/[a-zA-Z0-9_.-]+\/consumer\/[a-zA-Z0-9_.-]+:[0-9]+ +func (c *Client) GetResourcePolicy(ctx context.Context, params *GetResourcePolicyInput, optFns ...func(*Options)) (*GetResourcePolicyOutput, error) { + if params == nil { + params = &GetResourcePolicyInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetResourcePolicy", params, optFns, c.addOperationGetResourcePolicyMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetResourcePolicyOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetResourcePolicyInput struct { + + // The Amazon Resource Name (ARN) of the data stream or consumer. + // + // This member is required. + ResourceARN *string + + noSmithyDocumentSerde +} + +func (in *GetResourcePolicyInput) bindEndpointParams(p *EndpointParameters) { + p.ResourceARN = in.ResourceARN + p.OperationType = ptr.String("control") +} + +type GetResourcePolicyOutput struct { + + // Details of the resource policy. This is formatted as a JSON string. + // + // This member is required. + Policy *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetResourcePolicy{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetResourcePolicy{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetResourcePolicy"); 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 = addOpGetResourcePolicyValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetResourcePolicy(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_opGetResourcePolicy(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetResourcePolicy", + } +} diff --git a/service/kinesis/api_op_GetShardIterator.go b/service/kinesis/api_op_GetShardIterator.go index 292888c923d..0e29e274d1f 100644 --- a/service/kinesis/api_op_GetShardIterator.go +++ b/service/kinesis/api_op_GetShardIterator.go @@ -15,15 +15,16 @@ import ( ) // Gets an Amazon Kinesis shard iterator. A shard iterator expires 5 minutes after -// it is returned to the requester. When invoking this API, it is recommended you -// use the StreamARN input parameter rather than the StreamName input parameter. A -// shard iterator specifies the shard position from which to start reading data -// records sequentially. The position is specified using the sequence number of a -// data record in a shard. A sequence number is the identifier associated with -// every record ingested in the stream, and is assigned when a record is put into -// the stream. Each stream has one or more shards. You must specify the shard -// iterator type. For example, you can set the ShardIteratorType parameter to read -// exactly from the position denoted by a specific sequence number by using the +// it is returned to the requester. When invoking this API, you must use either the +// StreamARN or the StreamName parameter, or both. It is recommended that you use +// the StreamARN input parameter when you invoke this API. A shard iterator +// specifies the shard position from which to start reading data records +// sequentially. The position is specified using the sequence number of a data +// record in a shard. A sequence number is the identifier associated with every +// record ingested in the stream, and is assigned when a record is put into the +// stream. Each stream has one or more shards. You must specify the shard iterator +// type. For example, you can set the ShardIteratorType parameter to read exactly +// from the position denoted by a specific sequence number by using the // AT_SEQUENCE_NUMBER shard iterator type. Alternatively, the parameter can read // right after the sequence number by using the AFTER_SEQUENCE_NUMBER shard // iterator type, using sequence numbers returned by earlier calls to PutRecord , diff --git a/service/kinesis/api_op_IncreaseStreamRetentionPeriod.go b/service/kinesis/api_op_IncreaseStreamRetentionPeriod.go index 580c5b642c6..28a5b56845e 100644 --- a/service/kinesis/api_op_IncreaseStreamRetentionPeriod.go +++ b/service/kinesis/api_op_IncreaseStreamRetentionPeriod.go @@ -15,13 +15,14 @@ import ( // Increases the Kinesis data stream's retention period, which is the length of // time data records are accessible after they are added to the stream. The maximum // value of a stream's retention period is 8760 hours (365 days). When invoking -// this API, it is recommended you use the StreamARN input parameter rather than -// the StreamName input parameter. If you choose a longer stream retention period, -// this operation increases the time period during which records that have not yet -// expired are accessible. However, it does not make previous, expired data (older -// than the stream's previous retention period) accessible after the operation has -// been called. For example, if a stream's retention period is set to 24 hours and -// is increased to 168 hours, any data that is older than 24 hours remains +// this API, you must use either the StreamARN or the StreamName parameter, or +// both. It is recommended that you use the StreamARN input parameter when you +// invoke this API. If you choose a longer stream retention period, this operation +// increases the time period during which records that have not yet expired are +// accessible. However, it does not make previous, expired data (older than the +// stream's previous retention period) accessible after the operation has been +// called. For example, if a stream's retention period is set to 24 hours and is +// increased to 168 hours, any data that is older than 24 hours remains // inaccessible to consumer applications. func (c *Client) IncreaseStreamRetentionPeriod(ctx context.Context, params *IncreaseStreamRetentionPeriodInput, optFns ...func(*Options)) (*IncreaseStreamRetentionPeriodOutput, error) { if params == nil { diff --git a/service/kinesis/api_op_ListShards.go b/service/kinesis/api_op_ListShards.go index ceddc59a952..55b69b5aa72 100644 --- a/service/kinesis/api_op_ListShards.go +++ b/service/kinesis/api_op_ListShards.go @@ -16,10 +16,11 @@ import ( // Lists the shards in a stream and provides information about each shard. This // operation has a limit of 1000 transactions per second per data stream. When -// invoking this API, it is recommended you use the StreamARN input parameter -// rather than the StreamName input parameter. This action does not list expired -// shards. For information about expired shards, see Data Routing, Data -// Persistence, and Shard State after a Reshard (https://docs.aws.amazon.com/streams/latest/dev/kinesis-using-sdk-java-after-resharding.html#kinesis-using-sdk-java-resharding-data-routing) +// invoking this API, you must use either the StreamARN or the StreamName +// parameter, or both. It is recommended that you use the StreamARN input +// parameter when you invoke this API. This action does not list expired shards. +// For information about expired shards, see Data Routing, Data Persistence, and +// Shard State after a Reshard (https://docs.aws.amazon.com/streams/latest/dev/kinesis-using-sdk-java-after-resharding.html#kinesis-using-sdk-java-resharding-data-routing) // . This API is a new operation that is used by the Amazon Kinesis Client Library // (KCL). If you have a fine-grained IAM policy that only allows specific // operations, you must update your policy to allow calls to this API. For more diff --git a/service/kinesis/api_op_ListTagsForStream.go b/service/kinesis/api_op_ListTagsForStream.go index 5569858d785..194fb4487c1 100644 --- a/service/kinesis/api_op_ListTagsForStream.go +++ b/service/kinesis/api_op_ListTagsForStream.go @@ -14,9 +14,9 @@ import ( ) // Lists the tags for the specified Kinesis data stream. This operation has a -// limit of five transactions per second per account. When invoking this API, it is -// recommended you use the StreamARN input parameter rather than the StreamName -// input parameter. +// limit of five transactions per second per account. When invoking this API, you +// must use either the StreamARN or the StreamName parameter, or both. It is +// recommended that you use the StreamARN input parameter when you invoke this API. func (c *Client) ListTagsForStream(ctx context.Context, params *ListTagsForStreamInput, optFns ...func(*Options)) (*ListTagsForStreamOutput, error) { if params == nil { params = &ListTagsForStreamInput{} diff --git a/service/kinesis/api_op_MergeShards.go b/service/kinesis/api_op_MergeShards.go index 6aa9aaaa2d0..4562e33bd31 100644 --- a/service/kinesis/api_op_MergeShards.go +++ b/service/kinesis/api_op_MergeShards.go @@ -21,12 +21,12 @@ import ( // range of 382...454, then you could merge these two shards into a single shard // that would have a hash key range of 276...454. After the merge, the single child // shard receives data for all hash key values covered by the two parent shards. -// When invoking this API, it is recommended you use the StreamARN input parameter -// rather than the StreamName input parameter. MergeShards is called when there is -// a need to reduce the overall capacity of a stream because of excess capacity -// that is not being used. You must specify the shard to be merged and the adjacent -// shard for a stream. For more information about merging shards, see Merge Two -// Shards (https://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-sdk-java-resharding-merge.html) +// When invoking this API, you must use either the StreamARN or the StreamName +// parameter, or both. It is recommended that you use the StreamARN input +// parameter when you invoke this API. MergeShards is called when there is a need +// to reduce the overall capacity of a stream because of excess capacity that is +// not being used. You must specify the shard to be merged and the adjacent shard +// for a stream. For more information about merging shards, see Merge Two Shards (https://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-sdk-java-resharding-merge.html) // in the Amazon Kinesis Data Streams Developer Guide. If the stream is in the // ACTIVE state, you can call MergeShards . If a stream is in the CREATING , // UPDATING , or DELETING state, MergeShards returns a ResourceInUseException . If diff --git a/service/kinesis/api_op_PutRecord.go b/service/kinesis/api_op_PutRecord.go index 256e4f388d1..ef6495f2a2f 100644 --- a/service/kinesis/api_op_PutRecord.go +++ b/service/kinesis/api_op_PutRecord.go @@ -17,19 +17,20 @@ import ( // to send data into the stream for real-time ingestion and subsequent processing, // one record at a time. Each shard can support writes up to 1,000 records per // second, up to a maximum data write total of 1 MiB per second. When invoking this -// API, it is recommended you use the StreamARN input parameter rather than the -// StreamName input parameter. You must specify the name of the stream that -// captures, stores, and transports the data; a partition key; and the data blob -// itself. The data blob can be any type of data; for example, a segment from a log -// file, geographic/location data, website clickstream data, and so on. The -// partition key is used by Kinesis Data Streams to distribute data across shards. -// Kinesis Data Streams segregates the data records that belong to a stream into -// multiple shards, using the partition key associated with each data record to -// determine the shard to which a given data record belongs. Partition keys are -// Unicode strings, with a maximum length limit of 256 characters for each key. An -// MD5 hash function is used to map partition keys to 128-bit integer values and to -// map associated data records to shards using the hash key ranges of the shards. -// You can override hashing the partition key to determine the shard by explicitly +// API, you must use either the StreamARN or the StreamName parameter, or both. It +// is recommended that you use the StreamARN input parameter when you invoke this +// API. You must specify the name of the stream that captures, stores, and +// transports the data; a partition key; and the data blob itself. The data blob +// can be any type of data; for example, a segment from a log file, +// geographic/location data, website clickstream data, and so on. The partition key +// is used by Kinesis Data Streams to distribute data across shards. Kinesis Data +// Streams segregates the data records that belong to a stream into multiple +// shards, using the partition key associated with each data record to determine +// the shard to which a given data record belongs. Partition keys are Unicode +// strings, with a maximum length limit of 256 characters for each key. An MD5 hash +// function is used to map partition keys to 128-bit integer values and to map +// associated data records to shards using the hash key ranges of the shards. You +// can override hashing the partition key to determine the shard by explicitly // specifying a hash value using the ExplicitHashKey parameter. For more // information, see Adding Data to a Stream (https://docs.aws.amazon.com/kinesis/latest/dev/developing-producers-with-sdk.html#kinesis-using-sdk-java-add-data-to-stream) // in the Amazon Kinesis Data Streams Developer Guide. PutRecord returns the shard diff --git a/service/kinesis/api_op_PutRecords.go b/service/kinesis/api_op_PutRecords.go index 122f2f029b1..efdf3b9f7ba 100644 --- a/service/kinesis/api_op_PutRecords.go +++ b/service/kinesis/api_op_PutRecords.go @@ -15,23 +15,24 @@ import ( // Writes multiple data records into a Kinesis data stream in a single call (also // referred to as a PutRecords request). Use this operation to send data into the -// stream for data ingestion and processing. When invoking this API, it is -// recommended you use the StreamARN input parameter rather than the StreamName -// input parameter. Each PutRecords request can support up to 500 records. Each -// record in the request can be as large as 1 MiB, up to a limit of 5 MiB for the -// entire request, including partition keys. Each shard can support writes up to -// 1,000 records per second, up to a maximum data write total of 1 MiB per second. -// You must specify the name of the stream that captures, stores, and transports -// the data; and an array of request Records , with each record in the array -// requiring a partition key and data blob. The record size limit applies to the -// total size of the partition key and data blob. The data blob can be any type of -// data; for example, a segment from a log file, geographic/location data, website -// clickstream data, and so on. The partition key is used by Kinesis Data Streams -// as input to a hash function that maps the partition key and associated data to a -// specific shard. An MD5 hash function is used to map partition keys to 128-bit -// integer values and to map associated data records to shards. As a result of this -// hashing mechanism, all data records with the same partition key map to the same -// shard within the stream. For more information, see Adding Data to a Stream (https://docs.aws.amazon.com/kinesis/latest/dev/developing-producers-with-sdk.html#kinesis-using-sdk-java-add-data-to-stream) +// stream for data ingestion and processing. When invoking this API, you must use +// either the StreamARN or the StreamName parameter, or both. It is recommended +// that you use the StreamARN input parameter when you invoke this API. Each +// PutRecords request can support up to 500 records. Each record in the request can +// be as large as 1 MiB, up to a limit of 5 MiB for the entire request, including +// partition keys. Each shard can support writes up to 1,000 records per second, up +// to a maximum data write total of 1 MiB per second. You must specify the name of +// the stream that captures, stores, and transports the data; and an array of +// request Records , with each record in the array requiring a partition key and +// data blob. The record size limit applies to the total size of the partition key +// and data blob. The data blob can be any type of data; for example, a segment +// from a log file, geographic/location data, website clickstream data, and so on. +// The partition key is used by Kinesis Data Streams as input to a hash function +// that maps the partition key and associated data to a specific shard. An MD5 hash +// function is used to map partition keys to 128-bit integer values and to map +// associated data records to shards. As a result of this hashing mechanism, all +// data records with the same partition key map to the same shard within the +// stream. For more information, see Adding Data to a Stream (https://docs.aws.amazon.com/kinesis/latest/dev/developing-producers-with-sdk.html#kinesis-using-sdk-java-add-data-to-stream) // in the Amazon Kinesis Data Streams Developer Guide. Each record in the Records // array may include an optional parameter, ExplicitHashKey , which overrides the // partition key to shard mapping. This parameter allows a data producer to diff --git a/service/kinesis/api_op_PutResourcePolicy.go b/service/kinesis/api_op_PutResourcePolicy.go new file mode 100644 index 00000000000..5c9d5b41a0f --- /dev/null +++ b/service/kinesis/api_op_PutResourcePolicy.go @@ -0,0 +1,159 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package kinesis + +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/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Attaches a resource-based policy to a data stream or registered consumer. If +// you are using an identity other than the root user of the Amazon Web Services +// account that owns the resource, the calling identity must have the +// PutResourcePolicy permissions on the specified Kinesis Data Streams resource and +// belong to the owner's account in order to use this operation. If you don't have +// PutResourcePolicy permissions, Amazon Kinesis Data Streams returns a 403 Access +// Denied error . If you receive a ResourceNotFoundException , check to see if you +// passed a valid stream or consumer resource. Request patterns can be one of the +// following: +// - Data stream pattern: arn:aws.*:kinesis:.*:\d{12}:.*stream/\S+ +// - Consumer pattern: +// ^(arn):aws.*:kinesis:.*:\d{12}:.*stream\/[a-zA-Z0-9_.-]+\/consumer\/[a-zA-Z0-9_.-]+:[0-9]+ +// +// For more information, see Controlling Access to Amazon Kinesis Data Streams +// Resources Using IAM (https://docs.aws.amazon.com/streams/latest/dev/controlling-access.html) +// . +func (c *Client) PutResourcePolicy(ctx context.Context, params *PutResourcePolicyInput, optFns ...func(*Options)) (*PutResourcePolicyOutput, error) { + if params == nil { + params = &PutResourcePolicyInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "PutResourcePolicy", params, optFns, c.addOperationPutResourcePolicyMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*PutResourcePolicyOutput) + out.ResultMetadata = metadata + return out, nil +} + +type PutResourcePolicyInput struct { + + // Details of the resource policy. It must include the identity of the principal + // and the actions allowed on this resource. This is formatted as a JSON string. + // + // This member is required. + Policy *string + + // The Amazon Resource Name (ARN) of the data stream or consumer. + // + // This member is required. + ResourceARN *string + + noSmithyDocumentSerde +} + +func (in *PutResourcePolicyInput) bindEndpointParams(p *EndpointParameters) { + p.ResourceARN = in.ResourceARN + p.OperationType = ptr.String("control") +} + +type PutResourcePolicyOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutResourcePolicy{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutResourcePolicy{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "PutResourcePolicy"); 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 = addOpPutResourcePolicyValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutResourcePolicy(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_opPutResourcePolicy(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "PutResourcePolicy", + } +} diff --git a/service/kinesis/api_op_RemoveTagsFromStream.go b/service/kinesis/api_op_RemoveTagsFromStream.go index 988a7dc1af1..65699760824 100644 --- a/service/kinesis/api_op_RemoveTagsFromStream.go +++ b/service/kinesis/api_op_RemoveTagsFromStream.go @@ -14,10 +14,11 @@ import ( // Removes tags from the specified Kinesis data stream. Removed tags are deleted // and cannot be recovered after this operation successfully completes. When -// invoking this API, it is recommended you use the StreamARN input parameter -// rather than the StreamName input parameter. If you specify a tag that does not -// exist, it is ignored. RemoveTagsFromStream has a limit of five transactions per -// second per account. +// invoking this API, you must use either the StreamARN or the StreamName +// parameter, or both. It is recommended that you use the StreamARN input +// parameter when you invoke this API. If you specify a tag that does not exist, it +// is ignored. RemoveTagsFromStream has a limit of five transactions per second +// per account. func (c *Client) RemoveTagsFromStream(ctx context.Context, params *RemoveTagsFromStreamInput, optFns ...func(*Options)) (*RemoveTagsFromStreamOutput, error) { if params == nil { params = &RemoveTagsFromStreamInput{} diff --git a/service/kinesis/api_op_SplitShard.go b/service/kinesis/api_op_SplitShard.go index e3c1f2cd6d1..abdbddba689 100644 --- a/service/kinesis/api_op_SplitShard.go +++ b/service/kinesis/api_op_SplitShard.go @@ -17,17 +17,18 @@ import ( // is a need to increase the overall capacity of a stream because of an expected // increase in the volume of data records being ingested. This API is only // supported for the data streams with the provisioned capacity mode. When invoking -// this API, it is recommended you use the StreamARN input parameter rather than -// the StreamName input parameter. You can also use SplitShard when a shard -// appears to be approaching its maximum utilization; for example, the producers -// sending data into the specific shard are suddenly sending more than previously -// anticipated. You can also call SplitShard to increase stream capacity, so that -// more Kinesis Data Streams applications can simultaneously read data from the -// stream for real-time processing. You must specify the shard to be split and the -// new hash key, which is the position in the shard where the shard gets split in -// two. In many cases, the new hash key might be the average of the beginning and -// ending hash key, but it can be any hash key value in the range being mapped into -// the shard. For more information, see Split a Shard (https://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-sdk-java-resharding-split.html) +// this API, you must use either the StreamARN or the StreamName parameter, or +// both. It is recommended that you use the StreamARN input parameter when you +// invoke this API. You can also use SplitShard when a shard appears to be +// approaching its maximum utilization; for example, the producers sending data +// into the specific shard are suddenly sending more than previously anticipated. +// You can also call SplitShard to increase stream capacity, so that more Kinesis +// Data Streams applications can simultaneously read data from the stream for +// real-time processing. You must specify the shard to be split and the new hash +// key, which is the position in the shard where the shard gets split in two. In +// many cases, the new hash key might be the average of the beginning and ending +// hash key, but it can be any hash key value in the range being mapped into the +// shard. For more information, see Split a Shard (https://docs.aws.amazon.com/kinesis/latest/dev/kinesis-using-sdk-java-resharding-split.html) // in the Amazon Kinesis Data Streams Developer Guide. You can use // DescribeStreamSummary and the ListShards APIs to determine the shard ID and // hash key values for the ShardToSplit and NewStartingHashKey parameters that are diff --git a/service/kinesis/api_op_StartStreamEncryption.go b/service/kinesis/api_op_StartStreamEncryption.go index b3a0c46aa1e..d7ce63450a8 100644 --- a/service/kinesis/api_op_StartStreamEncryption.go +++ b/service/kinesis/api_op_StartStreamEncryption.go @@ -14,21 +14,22 @@ import ( ) // Enables or updates server-side encryption using an Amazon Web Services KMS key -// for a specified stream. Starting encryption is an asynchronous operation. Upon -// receiving the request, Kinesis Data Streams returns immediately and sets the -// status of the stream to UPDATING . After the update is complete, Kinesis Data -// Streams sets the status of the stream back to ACTIVE . Updating or applying -// encryption normally takes a few seconds to complete, but it can take minutes. -// You can continue to read and write data to your stream while its status is -// UPDATING . Once the status of the stream is ACTIVE , encryption begins for -// records written to the stream. API Limits: You can successfully apply a new -// Amazon Web Services KMS key for server-side encryption 25 times in a rolling -// 24-hour period. Note: It can take up to 5 seconds after the stream is in an -// ACTIVE status before all records written to the stream are encrypted. After you -// enable encryption, you can verify that encryption is applied by inspecting the -// API response from PutRecord or PutRecords . When invoking this API, it is -// recommended you use the StreamARN input parameter rather than the StreamName -// input parameter. +// for a specified stream. When invoking this API, you must use either the +// StreamARN or the StreamName parameter, or both. It is recommended that you use +// the StreamARN input parameter when you invoke this API. Starting encryption is +// an asynchronous operation. Upon receiving the request, Kinesis Data Streams +// returns immediately and sets the status of the stream to UPDATING . After the +// update is complete, Kinesis Data Streams sets the status of the stream back to +// ACTIVE . Updating or applying encryption normally takes a few seconds to +// complete, but it can take minutes. You can continue to read and write data to +// your stream while its status is UPDATING . Once the status of the stream is +// ACTIVE , encryption begins for records written to the stream. API Limits: You +// can successfully apply a new Amazon Web Services KMS key for server-side +// encryption 25 times in a rolling 24-hour period. Note: It can take up to 5 +// seconds after the stream is in an ACTIVE status before all records written to +// the stream are encrypted. After you enable encryption, you can verify that +// encryption is applied by inspecting the API response from PutRecord or +// PutRecords . func (c *Client) StartStreamEncryption(ctx context.Context, params *StartStreamEncryptionInput, optFns ...func(*Options)) (*StartStreamEncryptionOutput, error) { if params == nil { params = &StartStreamEncryptionInput{} diff --git a/service/kinesis/api_op_StopStreamEncryption.go b/service/kinesis/api_op_StopStreamEncryption.go index 63cb09c00c7..e90417f6289 100644 --- a/service/kinesis/api_op_StopStreamEncryption.go +++ b/service/kinesis/api_op_StopStreamEncryption.go @@ -14,20 +14,21 @@ import ( ) // Disables server-side encryption for a specified stream. When invoking this API, -// it is recommended you use the StreamARN input parameter rather than the -// StreamName input parameter. Stopping encryption is an asynchronous operation. -// Upon receiving the request, Kinesis Data Streams returns immediately and sets -// the status of the stream to UPDATING . After the update is complete, Kinesis -// Data Streams sets the status of the stream back to ACTIVE . Stopping encryption -// normally takes a few seconds to complete, but it can take minutes. You can -// continue to read and write data to your stream while its status is UPDATING . -// Once the status of the stream is ACTIVE , records written to the stream are no -// longer encrypted by Kinesis Data Streams. API Limits: You can successfully -// disable server-side encryption 25 times in a rolling 24-hour period. Note: It -// can take up to 5 seconds after the stream is in an ACTIVE status before all -// records written to the stream are no longer subject to encryption. After you -// disabled encryption, you can verify that encryption is not applied by inspecting -// the API response from PutRecord or PutRecords . +// you must use either the StreamARN or the StreamName parameter, or both. It is +// recommended that you use the StreamARN input parameter when you invoke this +// API. Stopping encryption is an asynchronous operation. Upon receiving the +// request, Kinesis Data Streams returns immediately and sets the status of the +// stream to UPDATING . After the update is complete, Kinesis Data Streams sets the +// status of the stream back to ACTIVE . Stopping encryption normally takes a few +// seconds to complete, but it can take minutes. You can continue to read and write +// data to your stream while its status is UPDATING . Once the status of the stream +// is ACTIVE , records written to the stream are no longer encrypted by Kinesis +// Data Streams. API Limits: You can successfully disable server-side encryption 25 +// times in a rolling 24-hour period. Note: It can take up to 5 seconds after the +// stream is in an ACTIVE status before all records written to the stream are no +// longer subject to encryption. After you disabled encryption, you can verify that +// encryption is not applied by inspecting the API response from PutRecord or +// PutRecords . func (c *Client) StopStreamEncryption(ctx context.Context, params *StopStreamEncryptionInput, optFns ...func(*Options)) (*StopStreamEncryptionOutput, error) { if params == nil { params = &StopStreamEncryptionInput{} diff --git a/service/kinesis/api_op_UpdateShardCount.go b/service/kinesis/api_op_UpdateShardCount.go index 93b618f0303..d2f5fbdff8b 100644 --- a/service/kinesis/api_op_UpdateShardCount.go +++ b/service/kinesis/api_op_UpdateShardCount.go @@ -15,23 +15,23 @@ import ( // Updates the shard count of the specified stream to the specified number of // shards. This API is only supported for the data streams with the provisioned -// capacity mode. When invoking this API, it is recommended you use the StreamARN -// input parameter rather than the StreamName input parameter. Updating the shard -// count is an asynchronous operation. Upon receiving the request, Kinesis Data -// Streams returns immediately and sets the status of the stream to UPDATING . -// After the update is complete, Kinesis Data Streams sets the status of the stream -// back to ACTIVE . Depending on the size of the stream, the scaling action could -// take a few minutes to complete. You can continue to read and write data to your -// stream while its status is UPDATING . To update the shard count, Kinesis Data -// Streams performs splits or merges on individual shards. This can cause -// short-lived shards to be created, in addition to the final shards. These -// short-lived shards count towards your total shard limit for your account in the -// Region. When using this operation, we recommend that you specify a target shard -// count that is a multiple of 25% (25%, 50%, 75%, 100%). You can specify any -// target value within your shard limit. However, if you specify a target that -// isn't a multiple of 25%, the scaling action might take longer to complete. This -// operation has the following default limits. By default, you cannot do the -// following: +// capacity mode. When invoking this API, you must use either the StreamARN or the +// StreamName parameter, or both. It is recommended that you use the StreamARN +// input parameter when you invoke this API. Updating the shard count is an +// asynchronous operation. Upon receiving the request, Kinesis Data Streams returns +// immediately and sets the status of the stream to UPDATING . After the update is +// complete, Kinesis Data Streams sets the status of the stream back to ACTIVE . +// Depending on the size of the stream, the scaling action could take a few minutes +// to complete. You can continue to read and write data to your stream while its +// status is UPDATING . To update the shard count, Kinesis Data Streams performs +// splits or merges on individual shards. This can cause short-lived shards to be +// created, in addition to the final shards. These short-lived shards count towards +// your total shard limit for your account in the Region. When using this +// operation, we recommend that you specify a target shard count that is a multiple +// of 25% (25%, 50%, 75%, 100%). You can specify any target value within your shard +// limit. However, if you specify a target that isn't a multiple of 25%, the +// scaling action might take longer to complete. This operation has the following +// default limits. By default, you cannot do the following: // - Scale more than ten times per rolling 24-hour period per stream // - Scale up to more than double your current shard count for a stream // - Scale down below half your current shard count for a stream @@ -39,6 +39,7 @@ import ( // - Scale a stream with more than 10000 shards down unless the result is less // than 10000 shards // - Scale up to more than the shard limit for your account +// - Make over 10 TPS. TPS over 10 will trigger the LimitExceededException // // For the default limits for an Amazon Web Services account, see Streams Limits (https://docs.aws.amazon.com/kinesis/latest/dev/service-sizes-and-limits.html) // in the Amazon Kinesis Data Streams Developer Guide. To request an increase in diff --git a/service/kinesis/deserializers.go b/service/kinesis/deserializers.go index 7d730d7cc4d..84f09cb1b79 100644 --- a/service/kinesis/deserializers.go +++ b/service/kinesis/deserializers.go @@ -320,6 +320,107 @@ func awsAwsjson11_deserializeOpErrorDecreaseStreamRetentionPeriod(response *smit } } +type awsAwsjson11_deserializeOpDeleteResourcePolicy struct { +} + +func (*awsAwsjson11_deserializeOpDeleteResourcePolicy) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpDeleteResourcePolicy) 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, awsAwsjson11_deserializeOpErrorDeleteResourcePolicy(response, &metadata) + } + output := &DeleteResourcePolicyOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorDeleteResourcePolicy(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 awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsAwsjson11_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("LimitExceededException", errorCode): + return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) + + case strings.EqualFold("ResourceInUseException", errorCode): + return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpDeleteStream struct { } @@ -1371,6 +1472,126 @@ func awsAwsjson11_deserializeOpErrorGetRecords(response *smithyhttp.Response, me } } +type awsAwsjson11_deserializeOpGetResourcePolicy struct { +} + +func (*awsAwsjson11_deserializeOpGetResourcePolicy) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpGetResourcePolicy) 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, awsAwsjson11_deserializeOpErrorGetResourcePolicy(response, &metadata) + } + output := &GetResourcePolicyOutput{} + 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 = awsAwsjson11_deserializeOpDocumentGetResourcePolicyOutput(&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 awsAwsjson11_deserializeOpErrorGetResourcePolicy(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 awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsAwsjson11_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("LimitExceededException", errorCode): + return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpGetShardIterator struct { } @@ -2458,6 +2679,107 @@ func awsAwsjson11_deserializeOpErrorPutRecords(response *smithyhttp.Response, me } } +type awsAwsjson11_deserializeOpPutResourcePolicy struct { +} + +func (*awsAwsjson11_deserializeOpPutResourcePolicy) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpPutResourcePolicy) 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, awsAwsjson11_deserializeOpErrorPutResourcePolicy(response, &metadata) + } + output := &PutResourcePolicyOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsAwsjson11_deserializeOpErrorPutResourcePolicy(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 awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsAwsjson11_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("LimitExceededException", errorCode): + return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) + + case strings.EqualFold("ResourceInUseException", errorCode): + return awsAwsjson11_deserializeErrorResourceInUseException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpRegisterStreamConsumer struct { } @@ -6818,6 +7140,46 @@ func awsAwsjson11_deserializeOpDocumentGetRecordsOutput(v **GetRecordsOutput, va return nil } +func awsAwsjson11_deserializeOpDocumentGetResourcePolicyOutput(v **GetResourcePolicyOutput, 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 *GetResourcePolicyOutput + if *v == nil { + sv = &GetResourcePolicyOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Policy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Policy to be of type string, got %T instead", value) + } + sv.Policy = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentGetShardIteratorOutput(v **GetShardIteratorOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/kinesis/endpoints.go b/service/kinesis/endpoints.go index bf25b193f9d..481add9802a 100644 --- a/service/kinesis/endpoints.go +++ b/service/kinesis/endpoints.go @@ -270,6 +270,11 @@ type EndpointParameters struct { // // Parameter is required. ConsumerARN *string + + // The ARN of the Kinesis resource + // + // Parameter is required. + ResourceARN *string } // ValidateRequired validates required parameters are set. @@ -684,6 +689,184 @@ func (r *resolver) ResolveEndpoint( } } } + if exprVal := params.ResourceARN; exprVal != nil { + _ResourceARN := *exprVal + _ = _ResourceARN + if !(params.Endpoint != nil) { + if exprVal := params.Region; exprVal != nil { + _Region := *exprVal + _ = _Region + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _PartitionResult := *exprVal + _ = _PartitionResult + if !(_PartitionResult.Name == "aws-iso") { + if !(_PartitionResult.Name == "aws-iso-b") { + if exprVal := awsrulesfn.ParseARN(_ResourceARN); exprVal != nil { + _arn := *exprVal + _ = _arn + if rulesfn.IsValidHostLabel(_arn.AccountId, false) { + if rulesfn.IsValidHostLabel(_arn.Region, false) { + if _arn.Service == "kinesis" { + if exprVal := _arn.ResourceId.Get(0); exprVal != nil { + _arnType := *exprVal + _ = _arnType + if !(_arnType == "") { + if _arnType == "stream" { + if _PartitionResult.Name == _arn.Partition { + if exprVal := params.OperationType; exprVal != nil { + _OperationType := *exprVal + _ = _OperationType + if _UseFIPS == true { + if _UseDualStack == true { + if _PartitionResult.SupportsFIPS == true { + if _PartitionResult.SupportsDualStack == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_arn.AccountId) + out.WriteString(".") + out.WriteString(_OperationType) + out.WriteString("-kinesis-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled, but this partition does not support DualStack.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled, but this partition does not support FIPS.") + } + } + if _UseFIPS == true { + if _PartitionResult.SupportsFIPS == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_arn.AccountId) + out.WriteString(".") + out.WriteString(_OperationType) + out.WriteString("-kinesis-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS") + } + if _UseDualStack == true { + if _PartitionResult.SupportsDualStack == true { + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_arn.AccountId) + out.WriteString(".") + out.WriteString(_OperationType) + out.WriteString("-kinesis.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack") + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://") + out.WriteString(_arn.AccountId) + out.WriteString(".") + out.WriteString(_OperationType) + out.WriteString("-kinesis.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Operation Type is not set. Please contact service team for resolution.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Partition: ") + out.WriteString(_arn.Partition) + out.WriteString(" from ARN doesn't match with partition name: ") + out.WriteString(_PartitionResult.Name) + out.WriteString(".") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: Kinesis ARNs don't support `") + out.WriteString(_arnType) + out.WriteString("` arn types.") + return out.String() + }()) + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: No ARN type specified") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", func() string { + var out strings.Builder + out.WriteString("Invalid ARN: The ARN was not for the Kinesis service, found: ") + out.WriteString(_arn.Service) + out.WriteString(".") + return out.String() + }()) + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Invalid region.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Invalid account id.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid ARN: Failed to parse ARN.") + } + } + } + } + } + } if exprVal := params.Endpoint; exprVal != nil { _Endpoint := *exprVal _ = _Endpoint @@ -739,8 +922,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://kinesis.") diff --git a/service/kinesis/endpoints_test.go b/service/kinesis/endpoints_test.go index b93e24a202a..2a093e3068e 100644 --- a/service/kinesis/endpoints_test.go +++ b/service/kinesis/endpoints_test.go @@ -3811,3 +3811,1787 @@ func TestEndpointCase108(t *testing.T) { t.Errorf("expect properties to match\n%s", diff) } } + +// ResourceARN test: Invalid ARN: Failed to parse ARN. +func TestEndpointCase109(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Failed to parse ARN.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Invalid ARN: partition missing from ARN. +func TestEndpointCase110(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn::kinesis:us-west-2:123456789012:stream/testStream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Failed to parse ARN.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Invalid ARN: partitions mismatch. +func TestEndpointCase111(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-west-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-west-2:123456789012:stream/testStream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Partition: aws from ARN doesn't match with partition name: aws-us-gov.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Invalid ARN: Not Kinesis +func TestEndpointCase112(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:s3:us-west-2:123456789012:stream/testStream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: The ARN was not for the Kinesis service, found: s3.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Invalid ARN: Region is missing in ARN +func TestEndpointCase113(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis::123456789012:stream/testStream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Invalid region.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Invalid ARN: Region is empty string in ARN +func TestEndpointCase114(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis: :123456789012:stream/testStream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Invalid region.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Invalid ARN: Invalid account id +func TestEndpointCase115(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1::stream/testStream"), + OperationType: ptr.String("control"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Invalid account id.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Invalid ARN: Invalid account id +func TestEndpointCase116(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1: :stream/testStream"), + OperationType: ptr.String("control"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Invalid account id.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Invalid ARN: Kinesis ARNs only support stream arn +// types +func TestEndpointCase117(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:accesspoint/testStream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Kinesis ARNs don't support `accesspoint` arn types.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Dual Stack not supported region. +func TestEndpointCase118(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-west-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + ResourceARN: ptr.String("arn:aws-iso:kinesis:us-iso-west-1:123456789012:stream/testStream"), + OperationType: ptr.String("control"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: OperationType not set +func TestEndpointCase119(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123456789012:stream/testStream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Operation Type is not set. Please contact service team for resolution.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as StreamARN test: Custom Endpoint is specified +func TestEndpointCase120(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream"), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint targeting control operation type +func TestEndpointCase121(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.control-kinesis.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint targeting data operation type +func TestEndpointCase122(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with fips targeting data +// operation type +func TestEndpointCase123(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis-fips.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with fips targeting control +// operation type +func TestEndpointCase124(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.control-kinesis-fips.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with Dual Stack and FIPS enabled +func TestEndpointCase125(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.control-kinesis-fips.us-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with Dual Stack enabled +func TestEndpointCase126(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-west-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws:kinesis:us-west-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis.us-west-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with FIPS and DualStack disabled +func TestEndpointCase127(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-west-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-west-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.control-kinesis.us-west-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: RegionMismatch: client region should be used for +// endpoint region +func TestEndpointCase128(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws:kinesis:us-west-1:123:stream/testStream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with FIPS enabled +func TestEndpointCase129(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-northwest-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws-cn:kinesis:cn-northwest-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis-fips.cn-northwest-1.amazonaws.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with FIPS and DualStack enabled +// for cn regions. +func TestEndpointCase130(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-northwest-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws-cn:kinesis:cn-northwest-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis-fips.cn-northwest-1.api.amazonwebservices.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint targeting control operation type +// in ADC regions +func TestEndpointCase131(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws-iso:kinesis:us-iso-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint targeting control operation type +// in ADC regions +func TestEndpointCase132(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-west-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws-iso:kinesis:us-iso-west-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis.us-iso-west-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint targeting data operation type in +// ADC regions +func TestEndpointCase133(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws-iso-b:kinesis:us-isob-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with fips targeting control +// operation type in ADC regions +func TestEndpointCase134(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws-iso:kinesis:us-iso-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis-fips.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as StreamARN test: Account endpoint with fips targeting data +// operation type in ADC regions +func TestEndpointCase135(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws-iso-b:kinesis:us-isob-east-1:123:stream/test-stream"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis-fips.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Invalid ARN: partition missing from ARN. +func TestEndpointCase136(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn::kinesis:us-west-2:123456789012:stream/testStream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Failed to parse ARN.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Invalid ARN: partitions mismatch. +func TestEndpointCase137(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-west-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-west-2:123456789012:stream/testStream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Partition: aws from ARN doesn't match with partition name: aws-us-gov.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Invalid ARN: Not Kinesis +func TestEndpointCase138(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:s3:us-west-2:123456789012:stream/testStream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: The ARN was not for the Kinesis service, found: s3.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Invalid ARN: Region is missing in ARN +func TestEndpointCase139(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis::123456789012:stream/testStream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Invalid region.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Invalid ARN: Region is empty string in ARN +func TestEndpointCase140(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis: :123456789012:stream/testStream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Invalid region.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Invalid ARN: Invalid account id +func TestEndpointCase141(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1::stream/testStream/consumer/test-consumer:1525898737"), + OperationType: ptr.String("control"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Invalid account id.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Invalid ARN: Invalid account id +func TestEndpointCase142(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1: :stream/testStream/consumer/test-consumer:1525898737"), + OperationType: ptr.String("control"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Invalid account id.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Invalid ARN: Kinesis ARNs only support stream +// arn/consumer arn types +func TestEndpointCase143(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:accesspoint/testStream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid ARN: Kinesis ARNs don't support `accesspoint` arn types.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Dual Stack not supported region. +func TestEndpointCase144(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-west-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + ResourceARN: ptr.String("arn:aws-iso:kinesis:us-iso-west-1:123456789012:stream/testStream/consumer/test-consumer:1525898737"), + OperationType: ptr.String("control"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: OperationType not set +func TestEndpointCase145(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123456789012:stream/testStream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Operation Type is not set. Please contact service team for resolution.", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// ResourceARN as ConsumerARN test: Custom Endpoint is specified +func TestEndpointCase146(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint targeting control operation +// type +func TestEndpointCase147(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.control-kinesis.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint targeting data operation type +func TestEndpointCase148(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with fips targeting data +// operation type +func TestEndpointCase149(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis-fips.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with fips targeting control +// operation type +func TestEndpointCase150(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.control-kinesis-fips.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with Dual Stack and FIPS +// enabled +func TestEndpointCase151(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.control-kinesis-fips.us-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with Dual Stack enabled +func TestEndpointCase152(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-west-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws:kinesis:us-west-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis.us-west-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with FIPS and DualStack +// disabled +func TestEndpointCase153(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-west-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws:kinesis:us-west-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.control-kinesis.us-west-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: RegionMismatch: client region should be used +// for endpoint region +func TestEndpointCase154(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws:kinesis:us-west-1:123:stream/testStream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with FIPS enabled +func TestEndpointCase155(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-northwest-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws-cn:kinesis:cn-northwest-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis-fips.cn-northwest-1.amazonaws.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with FIPS and DualStack +// enabled for cn regions. +func TestEndpointCase156(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-northwest-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws-cn:kinesis:cn-northwest-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://123.data-kinesis-fips.cn-northwest-1.api.amazonwebservices.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint targeting control operation +// type in ADC regions +func TestEndpointCase157(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws-iso:kinesis:us-iso-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint targeting control operation +// type in ADC regions +func TestEndpointCase158(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-west-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws-iso:kinesis:us-iso-west-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis.us-iso-west-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint targeting data operation type +// in ADC regions +func TestEndpointCase159(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws-iso-b:kinesis:us-isob-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with fips targeting control +// operation type in ADC regions +func TestEndpointCase160(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("control"), + ResourceARN: ptr.String("arn:aws-iso:kinesis:us-iso-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis-fips.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// ResourceARN as ConsumerARN test: Account endpoint with fips targeting data +// operation type in ADC regions +func TestEndpointCase161(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + OperationType: ptr.String("data"), + ResourceARN: ptr.String("arn:aws-iso-b:kinesis:us-isob-east-1:123:stream/test-stream/consumer/test-consumer:1525898737"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://kinesis-fips.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} diff --git a/service/kinesis/generated.json b/service/kinesis/generated.json index b89bf58274d..34914ce9ab1 100644 --- a/service/kinesis/generated.json +++ b/service/kinesis/generated.json @@ -14,6 +14,7 @@ "api_op_AddTagsToStream.go", "api_op_CreateStream.go", "api_op_DecreaseStreamRetentionPeriod.go", + "api_op_DeleteResourcePolicy.go", "api_op_DeleteStream.go", "api_op_DeregisterStreamConsumer.go", "api_op_DescribeLimits.go", @@ -23,6 +24,7 @@ "api_op_DisableEnhancedMonitoring.go", "api_op_EnableEnhancedMonitoring.go", "api_op_GetRecords.go", + "api_op_GetResourcePolicy.go", "api_op_GetShardIterator.go", "api_op_IncreaseStreamRetentionPeriod.go", "api_op_ListShards.go", @@ -32,6 +34,7 @@ "api_op_MergeShards.go", "api_op_PutRecord.go", "api_op_PutRecords.go", + "api_op_PutResourcePolicy.go", "api_op_RegisterStreamConsumer.go", "api_op_RemoveTagsFromStream.go", "api_op_SplitShard.go", diff --git a/service/kinesis/serializers.go b/service/kinesis/serializers.go index b081e3fdf51..b44581923b4 100644 --- a/service/kinesis/serializers.go +++ b/service/kinesis/serializers.go @@ -181,6 +181,61 @@ func (m *awsAwsjson11_serializeOpDecreaseStreamRetentionPeriod) HandleSerialize( return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpDeleteResourcePolicy struct { +} + +func (*awsAwsjson11_serializeOpDeleteResourcePolicy) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpDeleteResourcePolicy) 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.(*DeleteResourcePolicyInput) + _ = 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.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("Kinesis_20131202.DeleteResourcePolicy") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentDeleteResourcePolicyInput(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 awsAwsjson11_serializeOpDeleteStream struct { } @@ -676,6 +731,61 @@ func (m *awsAwsjson11_serializeOpGetRecords) HandleSerialize(ctx context.Context return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpGetResourcePolicy struct { +} + +func (*awsAwsjson11_serializeOpGetResourcePolicy) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpGetResourcePolicy) 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.(*GetResourcePolicyInput) + _ = 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.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("Kinesis_20131202.GetResourcePolicy") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentGetResourcePolicyInput(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 awsAwsjson11_serializeOpGetShardIterator struct { } @@ -1171,6 +1281,61 @@ func (m *awsAwsjson11_serializeOpPutRecords) HandleSerialize(ctx context.Context return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpPutResourcePolicy struct { +} + +func (*awsAwsjson11_serializeOpPutResourcePolicy) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpPutResourcePolicy) 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.(*PutResourcePolicyInput) + _ = 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.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("Kinesis_20131202.PutResourcePolicy") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentPutResourcePolicyInput(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 awsAwsjson11_serializeOpRegisterStreamConsumer struct { } @@ -1804,6 +1969,18 @@ func awsAwsjson11_serializeOpDocumentDecreaseStreamRetentionPeriodInput(v *Decre return nil } +func awsAwsjson11_serializeOpDocumentDeleteResourcePolicyInput(v *DeleteResourcePolicyInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ResourceARN != nil { + ok := object.Key("ResourceARN") + ok.String(*v.ResourceARN) + } + + return nil +} + func awsAwsjson11_serializeOpDocumentDeleteStreamInput(v *DeleteStreamInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1991,6 +2168,18 @@ func awsAwsjson11_serializeOpDocumentGetRecordsInput(v *GetRecordsInput, value s return nil } +func awsAwsjson11_serializeOpDocumentGetResourcePolicyInput(v *GetResourcePolicyInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ResourceARN != nil { + ok := object.Key("ResourceARN") + ok.String(*v.ResourceARN) + } + + return nil +} + func awsAwsjson11_serializeOpDocumentGetShardIteratorInput(v *GetShardIteratorInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -2258,6 +2447,23 @@ func awsAwsjson11_serializeOpDocumentPutRecordsInput(v *PutRecordsInput, value s return nil } +func awsAwsjson11_serializeOpDocumentPutResourcePolicyInput(v *PutResourcePolicyInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Policy != nil { + ok := object.Key("Policy") + ok.String(*v.Policy) + } + + if v.ResourceARN != nil { + ok := object.Key("ResourceARN") + ok.String(*v.ResourceARN) + } + + return nil +} + func awsAwsjson11_serializeOpDocumentRegisterStreamConsumerInput(v *RegisterStreamConsumerInput, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/kinesis/validators.go b/service/kinesis/validators.go index 954b9d6f071..b6f72781c63 100644 --- a/service/kinesis/validators.go +++ b/service/kinesis/validators.go @@ -70,6 +70,26 @@ func (m *validateOpDecreaseStreamRetentionPeriod) HandleInitialize(ctx context.C return next.HandleInitialize(ctx, in) } +type validateOpDeleteResourcePolicy struct { +} + +func (*validateOpDeleteResourcePolicy) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteResourcePolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteResourcePolicyInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteResourcePolicyInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpDisableEnhancedMonitoring struct { } @@ -130,6 +150,26 @@ func (m *validateOpGetRecords) HandleInitialize(ctx context.Context, in middlewa return next.HandleInitialize(ctx, in) } +type validateOpGetResourcePolicy struct { +} + +func (*validateOpGetResourcePolicy) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetResourcePolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetResourcePolicyInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetResourcePolicyInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetShardIterator struct { } @@ -270,6 +310,26 @@ func (m *validateOpPutRecords) HandleInitialize(ctx context.Context, in middlewa return next.HandleInitialize(ctx, in) } +type validateOpPutResourcePolicy struct { +} + +func (*validateOpPutResourcePolicy) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpPutResourcePolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*PutResourcePolicyInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpPutResourcePolicyInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpRegisterStreamConsumer struct { } @@ -442,6 +502,10 @@ func addOpDecreaseStreamRetentionPeriodValidationMiddleware(stack *middleware.St return stack.Initialize.Add(&validateOpDecreaseStreamRetentionPeriod{}, middleware.After) } +func addOpDeleteResourcePolicyValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteResourcePolicy{}, middleware.After) +} + func addOpDisableEnhancedMonitoringValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDisableEnhancedMonitoring{}, middleware.After) } @@ -454,6 +518,10 @@ func addOpGetRecordsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetRecords{}, middleware.After) } +func addOpGetResourcePolicyValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetResourcePolicy{}, middleware.After) +} + func addOpGetShardIteratorValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetShardIterator{}, middleware.After) } @@ -482,6 +550,10 @@ func addOpPutRecordsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutRecords{}, middleware.After) } +func addOpPutResourcePolicyValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpPutResourcePolicy{}, middleware.After) +} + func addOpRegisterStreamConsumerValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpRegisterStreamConsumer{}, middleware.After) } @@ -644,6 +716,21 @@ func validateOpDecreaseStreamRetentionPeriodInput(v *DecreaseStreamRetentionPeri } } +func validateOpDeleteResourcePolicyInput(v *DeleteResourcePolicyInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteResourcePolicyInput"} + if v.ResourceARN == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceARN")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpDisableEnhancedMonitoringInput(v *DisableEnhancedMonitoringInput) error { if v == nil { return nil @@ -689,6 +776,21 @@ func validateOpGetRecordsInput(v *GetRecordsInput) error { } } +func validateOpGetResourcePolicyInput(v *GetResourcePolicyInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetResourcePolicyInput"} + if v.ResourceARN == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceARN")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetShardIteratorInput(v *GetShardIteratorInput) error { if v == nil { return nil @@ -809,6 +911,24 @@ func validateOpPutRecordsInput(v *PutRecordsInput) error { } } +func validateOpPutResourcePolicyInput(v *PutResourcePolicyInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PutResourcePolicyInput"} + if v.ResourceARN == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceARN")) + } + if v.Policy == nil { + invalidParams.Add(smithy.NewErrParamRequired("Policy")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpRegisterStreamConsumerInput(v *RegisterStreamConsumerInput) error { if v == nil { return nil diff --git a/service/s3control/deserializers.go b/service/s3control/deserializers.go index 6c6ef30fdee..18a23313039 100644 --- a/service/s3control/deserializers.go +++ b/service/s3control/deserializers.go @@ -11952,12 +11952,58 @@ func awsRestxml_deserializeDocumentJobManifestGeneratorFilter(v **types.JobManif sv.EligibleForReplication = ptr.Bool(xtv) } + case strings.EqualFold("KeyNameConstraint", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentKeyNameConstraint(&sv.KeyNameConstraint, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("MatchAnyStorageClass", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentStorageClassList(&sv.MatchAnyStorageClass, nodeDecoder); err != nil { + return err + } + case strings.EqualFold("ObjectReplicationStatuses", t.Name.Local): nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) if err := awsRestxml_deserializeDocumentReplicationStatusFilterList(&sv.ObjectReplicationStatuses, nodeDecoder); err != nil { return err } + case strings.EqualFold("ObjectSizeGreaterThanBytes", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.ObjectSizeGreaterThanBytes = ptr.Int64(i64) + } + + case strings.EqualFold("ObjectSizeLessThanBytes", t.Name.Local): + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + i64, err := strconv.ParseInt(xtv, 10, 64) + if err != nil { + return err + } + sv.ObjectSizeLessThanBytes = ptr.Int64(i64) + } + default: // Do nothing and ignore the unexpected tag element err = decoder.Decoder.Skip() @@ -12491,6 +12537,60 @@ func awsRestxml_deserializeDocumentJobTimers(v **types.JobTimers, decoder smithy return nil } +func awsRestxml_deserializeDocumentKeyNameConstraint(v **types.KeyNameConstraint, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv *types.KeyNameConstraint + if *v == nil { + sv = &types.KeyNameConstraint{} + } else { + sv = *v + } + + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + originalDecoder := decoder + decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t) + switch { + case strings.EqualFold("MatchAnyPrefix", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentNonEmptyMaxLength1024StringList(&sv.MatchAnyPrefix, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("MatchAnySubstring", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentNonEmptyMaxLength1024StringList(&sv.MatchAnySubstring, nodeDecoder); err != nil { + return err + } + + case strings.EqualFold("MatchAnySuffix", t.Name.Local): + nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + if err := awsRestxml_deserializeDocumentNonEmptyMaxLength1024StringList(&sv.MatchAnySuffix, nodeDecoder); err != nil { + return err + } + + default: + // Do nothing and ignore the unexpected tag element + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + func awsRestxml_deserializeDocumentLambdaInvokeOperation(v **types.LambdaInvokeOperation, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -14240,6 +14340,86 @@ func awsRestxml_deserializeDocumentNoncurrentVersionTransitionListUnwrapped(v *[ *v = sv return nil } +func awsRestxml_deserializeDocumentNonEmptyMaxLength1024StringList(v *[]string, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []string + if *v == nil { + sv = make([]string, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col string + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + col = xtv + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsRestxml_deserializeDocumentNonEmptyMaxLength1024StringListUnwrapped(v *[]string, decoder smithyxml.NodeDecoder) error { + var sv []string + if *v == nil { + sv = make([]string, 0) + } else { + sv = *v + } + + switch { + default: + var mv string + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + mv = xtv + } + sv = append(sv, mv) + } + *v = sv + return nil +} func awsRestxml_deserializeDocumentNoSuchPublicAccessBlockConfiguration(v **types.NoSuchPublicAccessBlockConfiguration, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -18678,6 +18858,86 @@ func awsRestxml_deserializeDocumentSSES3Encryption(v **types.SSES3Encryption, de return nil } +func awsRestxml_deserializeDocumentStorageClassList(v *[]types.S3StorageClass, decoder smithyxml.NodeDecoder) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + var sv []types.S3StorageClass + if *v == nil { + sv = make([]types.S3StorageClass, 0) + } else { + sv = *v + } + + originalDecoder := decoder + for { + t, done, err := decoder.Token() + if err != nil { + return err + } + if done { + break + } + memberDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t) + decoder = memberDecoder + switch { + case strings.EqualFold("member", t.Name.Local): + var col types.S3StorageClass + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + col = types.S3StorageClass(xtv) + } + sv = append(sv, col) + + default: + err = decoder.Decoder.Skip() + if err != nil { + return err + } + + } + decoder = originalDecoder + } + *v = sv + return nil +} + +func awsRestxml_deserializeDocumentStorageClassListUnwrapped(v *[]types.S3StorageClass, decoder smithyxml.NodeDecoder) error { + var sv []types.S3StorageClass + if *v == nil { + sv = make([]types.S3StorageClass, 0) + } else { + sv = *v + } + + switch { + default: + var mv types.S3StorageClass + t := decoder.StartEl + _ = t + val, err := decoder.Value() + if err != nil { + return err + } + if val == nil { + break + } + { + xtv := string(val) + mv = types.S3StorageClass(xtv) + } + sv = append(sv, mv) + } + *v = sv + return nil +} func awsRestxml_deserializeDocumentStorageLensAwsOrg(v **types.StorageLensAwsOrg, decoder smithyxml.NodeDecoder) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/s3control/serializers.go b/service/s3control/serializers.go index dfa21c43f75..2d3a938c733 100644 --- a/service/s3control/serializers.go +++ b/service/s3control/serializers.go @@ -6717,6 +6717,32 @@ func awsRestxml_serializeDocumentJobManifestGeneratorFilter(v *types.JobManifest el := value.MemberElement(root) el.Boolean(*v.EligibleForReplication) } + if v.KeyNameConstraint != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "KeyNameConstraint", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentKeyNameConstraint(v.KeyNameConstraint, el); err != nil { + return err + } + } + if v.MatchAnyStorageClass != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "MatchAnyStorageClass", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentStorageClassList(v.MatchAnyStorageClass, el); err != nil { + return err + } + } if v.ObjectReplicationStatuses != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ @@ -6730,6 +6756,28 @@ func awsRestxml_serializeDocumentJobManifestGeneratorFilter(v *types.JobManifest return err } } + if v.ObjectSizeGreaterThanBytes != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "ObjectSizeGreaterThanBytes", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.Long(*v.ObjectSizeGreaterThanBytes) + } + if v.ObjectSizeLessThanBytes != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "ObjectSizeLessThanBytes", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + el.Long(*v.ObjectSizeLessThanBytes) + } return nil } @@ -6982,6 +7030,50 @@ func awsRestxml_serializeDocumentJobReport(v *types.JobReport, value smithyxml.V return nil } +func awsRestxml_serializeDocumentKeyNameConstraint(v *types.KeyNameConstraint, value smithyxml.Value) error { + defer value.Close() + if v.MatchAnyPrefix != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "MatchAnyPrefix", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentNonEmptyMaxLength1024StringList(v.MatchAnyPrefix, el); err != nil { + return err + } + } + if v.MatchAnySubstring != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "MatchAnySubstring", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentNonEmptyMaxLength1024StringList(v.MatchAnySubstring, el); err != nil { + return err + } + } + if v.MatchAnySuffix != nil { + rootAttr := []smithyxml.Attr{} + root := smithyxml.StartElement{ + Name: smithyxml.Name{ + Local: "MatchAnySuffix", + }, + Attr: rootAttr, + } + el := value.MemberElement(root) + if err := awsRestxml_serializeDocumentNonEmptyMaxLength1024StringList(v.MatchAnySuffix, el); err != nil { + return err + } + } + return nil +} + func awsRestxml_serializeDocumentLambdaInvokeOperation(v *types.LambdaInvokeOperation, value smithyxml.Value) error { defer value.Close() if v.FunctionArn != nil { @@ -7555,6 +7647,19 @@ func awsRestxml_serializeDocumentNoncurrentVersionTransitionList(v []types.Noncu return nil } +func awsRestxml_serializeDocumentNonEmptyMaxLength1024StringList(v []string, value smithyxml.Value) error { + var array *smithyxml.Array + if !value.IsFlattened() { + defer value.Close() + } + array = value.Array() + for i := range v { + am := array.Member() + am.String(v[i]) + } + return nil +} + func awsRestxml_serializeDocumentObjectLambdaAllowedFeaturesList(v []types.ObjectLambdaAllowedFeature, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { @@ -9337,6 +9442,19 @@ func awsRestxml_serializeDocumentSSES3Encryption(v *types.SSES3Encryption, value return nil } +func awsRestxml_serializeDocumentStorageClassList(v []types.S3StorageClass, value smithyxml.Value) error { + var array *smithyxml.Array + if !value.IsFlattened() { + defer value.Close() + } + array = value.Array() + for i := range v { + am := array.Member() + am.String(string(v[i])) + } + return nil +} + func awsRestxml_serializeDocumentStorageLensAwsOrg(v *types.StorageLensAwsOrg, value smithyxml.Value) error { defer value.Close() if v.Arn != nil { diff --git a/service/s3control/types/types.go b/service/s3control/types/types.go index 725a1ea08f5..05f13faf1df 100644 --- a/service/s3control/types/types.go +++ b/service/s3control/types/types.go @@ -649,22 +649,39 @@ func (*JobManifestGeneratorMemberS3JobManifestGenerator) isJobManifestGenerator( // The filter used to describe a set of objects for the job's manifest. type JobManifestGeneratorFilter struct { - // If provided, the generated manifest should include only source bucket objects - // that were created after this time. + // If provided, the generated manifest includes only source bucket objects that + // were created after this time. CreatedAfter *time.Time - // If provided, the generated manifest should include only source bucket objects - // that were created before this time. + // If provided, the generated manifest includes only source bucket objects that + // were created before this time. CreatedBefore *time.Time // Include objects in the generated manifest only if they are eligible for // replication according to the Replication configuration on the source bucket. EligibleForReplication *bool - // If provided, the generated manifest should include only source bucket objects - // that have one of the specified Replication statuses. + // If provided, the generated manifest includes only source bucket objects whose + // object keys match the string constraints specified for MatchAnyPrefix , + // MatchAnySuffix , and MatchAnySubstring . + KeyNameConstraint *KeyNameConstraint + + // If provided, the generated manifest includes only source bucket objects that + // are stored with the specified storage class. + MatchAnyStorageClass []S3StorageClass + + // If provided, the generated manifest includes only source bucket objects that + // have one of the specified Replication statuses. ObjectReplicationStatuses []ReplicationStatus + // If provided, the generated manifest includes only source bucket objects whose + // file size is greater than the specified number of bytes. + ObjectSizeGreaterThanBytes *int64 + + // If provided, the generated manifest includes only source bucket objects whose + // file size is less than the specified number of bytes. + ObjectSizeLessThanBytes *int64 + noSmithyDocumentSerde } @@ -812,6 +829,26 @@ type JobTimers struct { noSmithyDocumentSerde } +// If provided, the generated manifest includes only source bucket objects whose +// object keys match the string constraints specified for MatchAnyPrefix , +// MatchAnySuffix , and MatchAnySubstring . +type KeyNameConstraint struct { + + // If provided, the generated manifest includes objects where the specified string + // appears at the start of the object key string. + MatchAnyPrefix []string + + // If provided, the generated manifest includes objects where the specified string + // appears anywhere within the object key string. + MatchAnySubstring []string + + // If provided, the generated manifest includes objects where the specified string + // appears at the end of the object key string. + MatchAnySuffix []string + + noSmithyDocumentSerde +} + // Contains the configuration parameters for a Lambda Invoke operation. type LambdaInvokeOperation struct { diff --git a/service/sagemaker/api_op_DescribeDomain.go b/service/sagemaker/api_op_DescribeDomain.go index bd3f633697d..9aedca4cc47 100644 --- a/service/sagemaker/api_op_DescribeDomain.go +++ b/service/sagemaker/api_op_DescribeDomain.go @@ -101,8 +101,8 @@ type DescribeDomainOutput struct { // apps and the RStudioServerPro app. SecurityGroupIdForDomainBoundary *string - // The ARN of the associated Amazon Web Services Single Sign-On application for - // this Domain. + // The ARN of the application managed by SageMaker in IAM Identity Center. This + // value is only returned for domains created after September 19, 2023. SingleSignOnApplicationArn *string // The IAM Identity Center managed application instance ID. diff --git a/service/sagemaker/deserializers.go b/service/sagemaker/deserializers.go index 0883d13f0c6..20f0a98423a 100644 --- a/service/sagemaker/deserializers.go +++ b/service/sagemaker/deserializers.go @@ -53664,6 +53664,46 @@ func awsAwsjson11_deserializeDocumentModel(v **types.Model, value interface{}) e return nil } +func awsAwsjson11_deserializeDocumentModelAccessConfig(v **types.ModelAccessConfig, 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.ModelAccessConfig + if *v == nil { + sv = &types.ModelAccessConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AcceptEula": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected AcceptEula to be of type *bool, got %T instead", value) + } + sv.AcceptEula = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeDocumentModelArtifacts(v **types.ModelArtifacts, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -67227,6 +67267,11 @@ func awsAwsjson11_deserializeDocumentS3ModelDataSource(v **types.S3ModelDataSour sv.CompressionType = types.ModelCompressionType(jtv) } + case "ModelAccessConfig": + if err := awsAwsjson11_deserializeDocumentModelAccessConfig(&sv.ModelAccessConfig, value); err != nil { + return err + } + case "S3DataType": if value != nil { jtv, ok := value.(string) diff --git a/service/sagemaker/serializers.go b/service/sagemaker/serializers.go index 8b16ad459dd..8574afb9049 100644 --- a/service/sagemaker/serializers.go +++ b/service/sagemaker/serializers.go @@ -21650,6 +21650,18 @@ func awsAwsjson11_serializeDocumentMetricsSource(v *types.MetricsSource, value s return nil } +func awsAwsjson11_serializeDocumentModelAccessConfig(v *types.ModelAccessConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AcceptEula != nil { + ok := object.Key("AcceptEula") + ok.Boolean(*v.AcceptEula) + } + + return nil +} + func awsAwsjson11_serializeDocumentModelBiasAppSpecification(v *types.ModelBiasAppSpecification, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -24781,6 +24793,13 @@ func awsAwsjson11_serializeDocumentS3ModelDataSource(v *types.S3ModelDataSource, ok.String(string(v.CompressionType)) } + if v.ModelAccessConfig != nil { + ok := object.Key("ModelAccessConfig") + if err := awsAwsjson11_serializeDocumentModelAccessConfig(v.ModelAccessConfig, ok); err != nil { + return err + } + } + if len(v.S3DataType) > 0 { ok := object.Key("S3DataType") ok.String(string(v.S3DataType)) diff --git a/service/sagemaker/types/types.go b/service/sagemaker/types/types.go index 2764fbee1ce..2aa10e5ff4a 100644 --- a/service/sagemaker/types/types.go +++ b/service/sagemaker/types/types.go @@ -7953,6 +7953,24 @@ type Model struct { noSmithyDocumentSerde } +// The access configuration file for the ML model. You can explicitly accept the +// model end-user license agreement (EULA) within the ModelAccessConfig . For more +// information, see End-user license agreements (https://docs.aws.amazon.com/sagemaker/latest/dg/jumpstart-foundation-models-choose.html#jumpstart-foundation-models-choose-eula) +// . +type ModelAccessConfig struct { + + // Specifies agreement to the model end-user license agreement (EULA). The + // AcceptEula value must be explicitly defined as True in order to accept the EULA + // that this model requires. You are responsible for reviewing and complying with + // any applicable license terms and making sure they are acceptable for your use + // case before downloading or using a model. + // + // This member is required. + AcceptEula *bool + + noSmithyDocumentSerde +} + // Provides information about the location that is configured for storing model // artifacts. Model artifacts are the output that results from training a model, // and typically consist of trained parameters, a model definition that describes @@ -12687,6 +12705,13 @@ type S3ModelDataSource struct { // This member is required. S3Uri *string + // Specifies the access configuration file for the ML model. You can explicitly + // accept the model end-user license agreement (EULA) within the ModelAccessConfig + // . You are responsible for reviewing and complying with any applicable license + // terms and making sure they are acceptable for your use case before downloading + // or using a model. + ModelAccessConfig *ModelAccessConfig + noSmithyDocumentSerde } @@ -13283,7 +13308,8 @@ type Stairs struct { // maximum runtime is sufficient for the training job to complete. type StoppingCondition struct { - // The maximum pending time in seconds. + // The maximum length of time, in seconds, that a training or compilation job can + // be pending before it is stopped. MaxPendingTimeInSeconds *int32 // The maximum length of time, in seconds, that a training or compilation job can diff --git a/service/sagemaker/validators.go b/service/sagemaker/validators.go index 3001bf05378..e677e7c7cab 100644 --- a/service/sagemaker/validators.go +++ b/service/sagemaker/validators.go @@ -8847,6 +8847,21 @@ func validateMetricsSource(v *types.MetricsSource) error { } } +func validateModelAccessConfig(v *types.ModelAccessConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ModelAccessConfig"} + if v.AcceptEula == nil { + invalidParams.Add(smithy.NewErrParamRequired("AcceptEula")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateModelBiasAppSpecification(v *types.ModelBiasAppSpecification) error { if v == nil { return nil @@ -10571,6 +10586,11 @@ func validateS3ModelDataSource(v *types.S3ModelDataSource) error { if len(v.CompressionType) == 0 { invalidParams.Add(smithy.NewErrParamRequired("CompressionType")) } + if v.ModelAccessConfig != nil { + if err := validateModelAccessConfig(v.ModelAccessConfig); err != nil { + invalidParams.AddNested("ModelAccessConfig", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else {