repo_name stringlengths 1 52 | repo_creator stringclasses 6
values | programming_language stringclasses 4
values | code stringlengths 0 9.68M | num_lines int64 1 234k |
|---|---|---|---|---|
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about a specific workgroup.
func (c *Client) GetWorkgroup(ctx context.Context, params *GetWorkgroupInput, optFns ...func(*Options)) (*GetWorkgroupOutput, error) {
if params == nil {
params = &GetWorkgroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetWorkgroup", params, optFns, c.addOperationGetWorkgroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetWorkgroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetWorkgroupInput struct {
// The name of the workgroup to return information for.
//
// This member is required.
WorkgroupName *string
noSmithyDocumentSerde
}
type GetWorkgroupOutput struct {
// The returned workgroup object.
//
// This member is required.
Workgroup *types.Workgroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetWorkgroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetWorkgroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetWorkgroup{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetWorkgroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetWorkgroup(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
}
return nil
}
func newServiceMetadataMiddleware_opGetWorkgroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "GetWorkgroup",
}
}
| 127 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns an array of EndpointAccess objects and relevant information.
func (c *Client) ListEndpointAccess(ctx context.Context, params *ListEndpointAccessInput, optFns ...func(*Options)) (*ListEndpointAccessOutput, error) {
if params == nil {
params = &ListEndpointAccessInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListEndpointAccess", params, optFns, c.addOperationListEndpointAccessMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListEndpointAccessOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListEndpointAccessInput struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
MaxResults *int32
// If your initial ListEndpointAccess operation returns a nextToken , you can
// include the returned nextToken in following ListEndpointAccess operations,
// which returns results in the next page.
NextToken *string
// The unique identifier of the virtual private cloud with access to Amazon
// Redshift Serverless.
VpcId *string
// The name of the workgroup associated with the VPC endpoint to return.
WorkgroupName *string
noSmithyDocumentSerde
}
type ListEndpointAccessOutput struct {
// The returned VPC endpoints.
//
// This member is required.
Endpoints []types.EndpointAccess
// When nextToken is returned, there are more results available. The value of
// nextToken is a unique pagination token for each page. Make the call again using
// the returned token to retrieve the next page.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListEndpointAccessMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListEndpointAccess{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListEndpointAccess{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListEndpointAccess(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
}
return nil
}
// ListEndpointAccessAPIClient is a client that implements the ListEndpointAccess
// operation.
type ListEndpointAccessAPIClient interface {
ListEndpointAccess(context.Context, *ListEndpointAccessInput, ...func(*Options)) (*ListEndpointAccessOutput, error)
}
var _ ListEndpointAccessAPIClient = (*Client)(nil)
// ListEndpointAccessPaginatorOptions is the paginator options for
// ListEndpointAccess
type ListEndpointAccessPaginatorOptions struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListEndpointAccessPaginator is a paginator for ListEndpointAccess
type ListEndpointAccessPaginator struct {
options ListEndpointAccessPaginatorOptions
client ListEndpointAccessAPIClient
params *ListEndpointAccessInput
nextToken *string
firstPage bool
}
// NewListEndpointAccessPaginator returns a new ListEndpointAccessPaginator
func NewListEndpointAccessPaginator(client ListEndpointAccessAPIClient, params *ListEndpointAccessInput, optFns ...func(*ListEndpointAccessPaginatorOptions)) *ListEndpointAccessPaginator {
if params == nil {
params = &ListEndpointAccessInput{}
}
options := ListEndpointAccessPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListEndpointAccessPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListEndpointAccessPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListEndpointAccess page.
func (p *ListEndpointAccessPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListEndpointAccessOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListEndpointAccess(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListEndpointAccess(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "ListEndpointAccess",
}
}
| 233 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about a list of specified namespaces.
func (c *Client) ListNamespaces(ctx context.Context, params *ListNamespacesInput, optFns ...func(*Options)) (*ListNamespacesOutput, error) {
if params == nil {
params = &ListNamespacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListNamespaces", params, optFns, c.addOperationListNamespacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListNamespacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListNamespacesInput struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
MaxResults *int32
// If your initial ListNamespaces operation returns a nextToken , you can include
// the returned nextToken in following ListNamespaces operations, which returns
// results in the next page.
NextToken *string
noSmithyDocumentSerde
}
type ListNamespacesOutput struct {
// The list of returned namespaces.
//
// This member is required.
Namespaces []types.Namespace
// When nextToken is returned, there are more results available. The value of
// nextToken is a unique pagination token for each page. Make the call again using
// the returned token to retrieve the next page.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListNamespacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListNamespaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListNamespaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListNamespaces(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
}
return nil
}
// ListNamespacesAPIClient is a client that implements the ListNamespaces
// operation.
type ListNamespacesAPIClient interface {
ListNamespaces(context.Context, *ListNamespacesInput, ...func(*Options)) (*ListNamespacesOutput, error)
}
var _ ListNamespacesAPIClient = (*Client)(nil)
// ListNamespacesPaginatorOptions is the paginator options for ListNamespaces
type ListNamespacesPaginatorOptions struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListNamespacesPaginator is a paginator for ListNamespaces
type ListNamespacesPaginator struct {
options ListNamespacesPaginatorOptions
client ListNamespacesAPIClient
params *ListNamespacesInput
nextToken *string
firstPage bool
}
// NewListNamespacesPaginator returns a new ListNamespacesPaginator
func NewListNamespacesPaginator(client ListNamespacesAPIClient, params *ListNamespacesInput, optFns ...func(*ListNamespacesPaginatorOptions)) *ListNamespacesPaginator {
if params == nil {
params = &ListNamespacesInput{}
}
options := ListNamespacesPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListNamespacesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListNamespacesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListNamespaces page.
func (p *ListNamespacesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListNamespacesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListNamespaces(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListNamespaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "ListNamespaces",
}
}
| 225 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Returns an array of recovery points.
func (c *Client) ListRecoveryPoints(ctx context.Context, params *ListRecoveryPointsInput, optFns ...func(*Options)) (*ListRecoveryPointsOutput, error) {
if params == nil {
params = &ListRecoveryPointsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListRecoveryPoints", params, optFns, c.addOperationListRecoveryPointsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListRecoveryPointsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListRecoveryPointsInput struct {
// The time when creation of the recovery point finished.
EndTime *time.Time
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
MaxResults *int32
// The Amazon Resource Name (ARN) of the namespace from which to list recovery
// points.
NamespaceArn *string
// The name of the namespace to list recovery points for.
NamespaceName *string
// If your initial ListRecoveryPoints operation returns a nextToken , you can
// include the returned nextToken in following ListRecoveryPoints operations,
// which returns results in the next page.
NextToken *string
// The time when the recovery point's creation was initiated.
StartTime *time.Time
noSmithyDocumentSerde
}
type ListRecoveryPointsOutput struct {
// If nextToken is returned, there are more results available. The value of
// nextToken is a unique pagination token for each page. Make the call again using
// the returned token to retrieve the next page.
NextToken *string
// The returned recovery point objects.
RecoveryPoints []types.RecoveryPoint
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListRecoveryPointsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListRecoveryPoints{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListRecoveryPoints{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRecoveryPoints(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
}
return nil
}
// ListRecoveryPointsAPIClient is a client that implements the ListRecoveryPoints
// operation.
type ListRecoveryPointsAPIClient interface {
ListRecoveryPoints(context.Context, *ListRecoveryPointsInput, ...func(*Options)) (*ListRecoveryPointsOutput, error)
}
var _ ListRecoveryPointsAPIClient = (*Client)(nil)
// ListRecoveryPointsPaginatorOptions is the paginator options for
// ListRecoveryPoints
type ListRecoveryPointsPaginatorOptions struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListRecoveryPointsPaginator is a paginator for ListRecoveryPoints
type ListRecoveryPointsPaginator struct {
options ListRecoveryPointsPaginatorOptions
client ListRecoveryPointsAPIClient
params *ListRecoveryPointsInput
nextToken *string
firstPage bool
}
// NewListRecoveryPointsPaginator returns a new ListRecoveryPointsPaginator
func NewListRecoveryPointsPaginator(client ListRecoveryPointsAPIClient, params *ListRecoveryPointsInput, optFns ...func(*ListRecoveryPointsPaginatorOptions)) *ListRecoveryPointsPaginator {
if params == nil {
params = &ListRecoveryPointsInput{}
}
options := ListRecoveryPointsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListRecoveryPointsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListRecoveryPointsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListRecoveryPoints page.
func (p *ListRecoveryPointsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRecoveryPointsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListRecoveryPoints(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListRecoveryPoints(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "ListRecoveryPoints",
}
}
| 238 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Returns a list of snapshots.
func (c *Client) ListSnapshots(ctx context.Context, params *ListSnapshotsInput, optFns ...func(*Options)) (*ListSnapshotsOutput, error) {
if params == nil {
params = &ListSnapshotsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListSnapshots", params, optFns, c.addOperationListSnapshotsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListSnapshotsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListSnapshotsInput struct {
// The timestamp showing when the snapshot creation finished.
EndTime *time.Time
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
MaxResults *int32
// The Amazon Resource Name (ARN) of the namespace from which to list all
// snapshots.
NamespaceArn *string
// The namespace from which to list all snapshots.
NamespaceName *string
// If nextToken is returned, there are more results available. The value of
// nextToken is a unique pagination token for each page. Make the call again using
// the returned token to retrieve the next page.
NextToken *string
// The owner Amazon Web Services account of the snapshot.
OwnerAccount *string
// The time when the creation of the snapshot was initiated.
StartTime *time.Time
noSmithyDocumentSerde
}
type ListSnapshotsOutput struct {
// If nextToken is returned, there are more results available. The value of
// nextToken is a unique pagination token for each page. Make the call again using
// the returned token to retrieve the next page.
NextToken *string
// All of the returned snapshot objects.
Snapshots []types.Snapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListSnapshotsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListSnapshots{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListSnapshots{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListSnapshots(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
}
return nil
}
// ListSnapshotsAPIClient is a client that implements the ListSnapshots operation.
type ListSnapshotsAPIClient interface {
ListSnapshots(context.Context, *ListSnapshotsInput, ...func(*Options)) (*ListSnapshotsOutput, error)
}
var _ ListSnapshotsAPIClient = (*Client)(nil)
// ListSnapshotsPaginatorOptions is the paginator options for ListSnapshots
type ListSnapshotsPaginatorOptions struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListSnapshotsPaginator is a paginator for ListSnapshots
type ListSnapshotsPaginator struct {
options ListSnapshotsPaginatorOptions
client ListSnapshotsAPIClient
params *ListSnapshotsInput
nextToken *string
firstPage bool
}
// NewListSnapshotsPaginator returns a new ListSnapshotsPaginator
func NewListSnapshotsPaginator(client ListSnapshotsAPIClient, params *ListSnapshotsInput, optFns ...func(*ListSnapshotsPaginatorOptions)) *ListSnapshotsPaginator {
if params == nil {
params = &ListSnapshotsInput{}
}
options := ListSnapshotsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListSnapshotsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListSnapshotsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListSnapshots page.
func (p *ListSnapshotsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListSnapshotsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListSnapshots(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListSnapshots(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "ListSnapshots",
}
}
| 239 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about an array of TableRestoreStatus objects.
func (c *Client) ListTableRestoreStatus(ctx context.Context, params *ListTableRestoreStatusInput, optFns ...func(*Options)) (*ListTableRestoreStatusOutput, error) {
if params == nil {
params = &ListTableRestoreStatusInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListTableRestoreStatus", params, optFns, c.addOperationListTableRestoreStatusMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListTableRestoreStatusOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListTableRestoreStatusInput struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
MaxResults *int32
// The namespace from which to list all of the statuses of RestoreTableFromSnapshot
// operations .
NamespaceName *string
// If your initial ListTableRestoreStatus operation returns a nextToken, you can
// include the returned nextToken in following ListTableRestoreStatus operations.
// This will return results on the next page.
NextToken *string
// The workgroup from which to list all of the statuses of RestoreTableFromSnapshot
// operations.
WorkgroupName *string
noSmithyDocumentSerde
}
type ListTableRestoreStatusOutput struct {
// If your initial ListTableRestoreStatus operation returns a nextToken , you can
// include the returned nextToken in following ListTableRestoreStatus operations.
// This will returns results on the next page.
NextToken *string
// The array of returned TableRestoreStatus objects.
TableRestoreStatuses []types.TableRestoreStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListTableRestoreStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListTableRestoreStatus{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListTableRestoreStatus{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTableRestoreStatus(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
}
return nil
}
// ListTableRestoreStatusAPIClient is a client that implements the
// ListTableRestoreStatus operation.
type ListTableRestoreStatusAPIClient interface {
ListTableRestoreStatus(context.Context, *ListTableRestoreStatusInput, ...func(*Options)) (*ListTableRestoreStatusOutput, error)
}
var _ ListTableRestoreStatusAPIClient = (*Client)(nil)
// ListTableRestoreStatusPaginatorOptions is the paginator options for
// ListTableRestoreStatus
type ListTableRestoreStatusPaginatorOptions struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListTableRestoreStatusPaginator is a paginator for ListTableRestoreStatus
type ListTableRestoreStatusPaginator struct {
options ListTableRestoreStatusPaginatorOptions
client ListTableRestoreStatusAPIClient
params *ListTableRestoreStatusInput
nextToken *string
firstPage bool
}
// NewListTableRestoreStatusPaginator returns a new ListTableRestoreStatusPaginator
func NewListTableRestoreStatusPaginator(client ListTableRestoreStatusAPIClient, params *ListTableRestoreStatusInput, optFns ...func(*ListTableRestoreStatusPaginatorOptions)) *ListTableRestoreStatusPaginator {
if params == nil {
params = &ListTableRestoreStatusInput{}
}
options := ListTableRestoreStatusPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListTableRestoreStatusPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListTableRestoreStatusPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListTableRestoreStatus page.
func (p *ListTableRestoreStatusPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListTableRestoreStatusOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListTableRestoreStatus(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListTableRestoreStatus(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "ListTableRestoreStatus",
}
}
| 232 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the tags assigned to a resource.
func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) {
if params == nil {
params = &ListTagsForResourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListTagsForResourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListTagsForResourceInput struct {
// The Amazon Resource Name (ARN) of the resource to list tags for.
//
// This member is required.
ResourceArn *string
noSmithyDocumentSerde
}
type ListTagsForResourceOutput struct {
// A map of the key-value pairs assigned to the resource.
Tags []types.Tag
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListTagsForResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListTagsForResource{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(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
}
return nil
}
func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "ListTagsForResource",
}
}
| 125 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists all usage limits within Amazon Redshift Serverless.
func (c *Client) ListUsageLimits(ctx context.Context, params *ListUsageLimitsInput, optFns ...func(*Options)) (*ListUsageLimitsOutput, error) {
if params == nil {
params = &ListUsageLimitsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListUsageLimits", params, optFns, c.addOperationListUsageLimitsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListUsageLimitsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListUsageLimitsInput struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to get the next page of results. The default is 100.
MaxResults *int32
// If your initial ListUsageLimits operation returns a nextToken , you can include
// the returned nextToken in following ListUsageLimits operations, which returns
// results in the next page.
NextToken *string
// The Amazon Resource Name (ARN) associated with the resource whose usage limits
// you want to list.
ResourceArn *string
// The Amazon Redshift Serverless feature whose limits you want to see.
UsageType types.UsageLimitUsageType
noSmithyDocumentSerde
}
type ListUsageLimitsOutput struct {
// When nextToken is returned, there are more results available. The value of
// nextToken is a unique pagination token for each page. Make the call again using
// the returned token to retrieve the next page.
NextToken *string
// An array of returned usage limit objects.
UsageLimits []types.UsageLimit
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListUsageLimitsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListUsageLimits{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListUsageLimits{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListUsageLimits(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
}
return nil
}
// ListUsageLimitsAPIClient is a client that implements the ListUsageLimits
// operation.
type ListUsageLimitsAPIClient interface {
ListUsageLimits(context.Context, *ListUsageLimitsInput, ...func(*Options)) (*ListUsageLimitsOutput, error)
}
var _ ListUsageLimitsAPIClient = (*Client)(nil)
// ListUsageLimitsPaginatorOptions is the paginator options for ListUsageLimits
type ListUsageLimitsPaginatorOptions struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to get the next page of results. The default is 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListUsageLimitsPaginator is a paginator for ListUsageLimits
type ListUsageLimitsPaginator struct {
options ListUsageLimitsPaginatorOptions
client ListUsageLimitsAPIClient
params *ListUsageLimitsInput
nextToken *string
firstPage bool
}
// NewListUsageLimitsPaginator returns a new ListUsageLimitsPaginator
func NewListUsageLimitsPaginator(client ListUsageLimitsAPIClient, params *ListUsageLimitsInput, optFns ...func(*ListUsageLimitsPaginatorOptions)) *ListUsageLimitsPaginator {
if params == nil {
params = &ListUsageLimitsInput{}
}
options := ListUsageLimitsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListUsageLimitsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListUsageLimitsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListUsageLimits page.
func (p *ListUsageLimitsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListUsageLimitsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListUsageLimits(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListUsageLimits(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "ListUsageLimits",
}
}
| 230 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about a list of specified workgroups.
func (c *Client) ListWorkgroups(ctx context.Context, params *ListWorkgroupsInput, optFns ...func(*Options)) (*ListWorkgroupsOutput, error) {
if params == nil {
params = &ListWorkgroupsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListWorkgroups", params, optFns, c.addOperationListWorkgroupsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListWorkgroupsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListWorkgroupsInput struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
MaxResults *int32
// If your initial ListWorkgroups operation returns a nextToken , you can include
// the returned nextToken in following ListNamespaces operations, which returns
// results in the next page.
NextToken *string
noSmithyDocumentSerde
}
type ListWorkgroupsOutput struct {
// The returned array of workgroups.
//
// This member is required.
Workgroups []types.Workgroup
// If nextToken is returned, there are more results available. The value of
// nextToken is a unique pagination token for each page. To retrieve the next page,
// make the call again using the returned token.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListWorkgroupsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListWorkgroups{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListWorkgroups{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListWorkgroups(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
}
return nil
}
// ListWorkgroupsAPIClient is a client that implements the ListWorkgroups
// operation.
type ListWorkgroupsAPIClient interface {
ListWorkgroups(context.Context, *ListWorkgroupsInput, ...func(*Options)) (*ListWorkgroupsOutput, error)
}
var _ ListWorkgroupsAPIClient = (*Client)(nil)
// ListWorkgroupsPaginatorOptions is the paginator options for ListWorkgroups
type ListWorkgroupsPaginatorOptions struct {
// An optional parameter that specifies the maximum number of results to return.
// You can use nextToken to display the next page of results.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListWorkgroupsPaginator is a paginator for ListWorkgroups
type ListWorkgroupsPaginator struct {
options ListWorkgroupsPaginatorOptions
client ListWorkgroupsAPIClient
params *ListWorkgroupsInput
nextToken *string
firstPage bool
}
// NewListWorkgroupsPaginator returns a new ListWorkgroupsPaginator
func NewListWorkgroupsPaginator(client ListWorkgroupsAPIClient, params *ListWorkgroupsInput, optFns ...func(*ListWorkgroupsPaginatorOptions)) *ListWorkgroupsPaginator {
if params == nil {
params = &ListWorkgroupsInput{}
}
options := ListWorkgroupsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListWorkgroupsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListWorkgroupsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListWorkgroups page.
func (p *ListWorkgroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListWorkgroupsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListWorkgroups(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListWorkgroups(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "ListWorkgroups",
}
}
| 225 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates or updates a resource policy. Currently, you can use policies to share
// snapshots across Amazon Web Services accounts.
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 {
// The policy to create or update. For example, the following policy grants a user
// authorization to restore a snapshot. "{\"Version\": \"2012-10-17\",
// \"Statement\" : [{ \"Sid\": \"AllowUserRestoreFromSnapshot\",
// \"Principal\":{\"AWS\": [\"739247239426\"]}, \"Action\":
// [\"redshift-serverless:RestoreFromSnapshot\"] , \"Effect\": \"Allow\" }]}"
//
// This member is required.
Policy *string
// The Amazon Resource Name (ARN) of the account to create or update a resource
// policy for.
//
// This member is required.
ResourceArn *string
noSmithyDocumentSerde
}
type PutResourcePolicyOutput struct {
// The policy that was created or updated.
ResourcePolicy *types.ResourcePolicy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
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 = 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(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
}
return nil
}
func newServiceMetadataMiddleware_opPutResourcePolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "PutResourcePolicy",
}
}
| 136 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Restore the data from a recovery point.
func (c *Client) RestoreFromRecoveryPoint(ctx context.Context, params *RestoreFromRecoveryPointInput, optFns ...func(*Options)) (*RestoreFromRecoveryPointOutput, error) {
if params == nil {
params = &RestoreFromRecoveryPointInput{}
}
result, metadata, err := c.invokeOperation(ctx, "RestoreFromRecoveryPoint", params, optFns, c.addOperationRestoreFromRecoveryPointMiddlewares)
if err != nil {
return nil, err
}
out := result.(*RestoreFromRecoveryPointOutput)
out.ResultMetadata = metadata
return out, nil
}
type RestoreFromRecoveryPointInput struct {
// The name of the namespace to restore data into.
//
// This member is required.
NamespaceName *string
// The unique identifier of the recovery point to restore from.
//
// This member is required.
RecoveryPointId *string
// The name of the workgroup used to restore data.
//
// This member is required.
WorkgroupName *string
noSmithyDocumentSerde
}
type RestoreFromRecoveryPointOutput struct {
// The namespace that data was restored into.
Namespace *types.Namespace
// The unique identifier of the recovery point used for the restore.
RecoveryPointId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationRestoreFromRecoveryPointMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpRestoreFromRecoveryPoint{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpRestoreFromRecoveryPoint{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpRestoreFromRecoveryPointValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRestoreFromRecoveryPoint(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
}
return nil
}
func newServiceMetadataMiddleware_opRestoreFromRecoveryPoint(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "RestoreFromRecoveryPoint",
}
}
| 138 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Restores a namespace from a snapshot.
func (c *Client) RestoreFromSnapshot(ctx context.Context, params *RestoreFromSnapshotInput, optFns ...func(*Options)) (*RestoreFromSnapshotOutput, error) {
if params == nil {
params = &RestoreFromSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "RestoreFromSnapshot", params, optFns, c.addOperationRestoreFromSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*RestoreFromSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type RestoreFromSnapshotInput struct {
// The name of the namespace to restore the snapshot to.
//
// This member is required.
NamespaceName *string
// The name of the workgroup used to restore the snapshot.
//
// This member is required.
WorkgroupName *string
// The Amazon Web Services account that owns the snapshot.
OwnerAccount *string
// The Amazon Resource Name (ARN) of the snapshot to restore from. Required if
// restoring from Amazon Redshift Serverless to a provisioned cluster. Must not be
// specified at the same time as snapshotName . The format of the ARN is
// arn:aws:redshift:<region>:<account_id>:snapshot:<cluster_identifier>/<snapshot_identifier>.
SnapshotArn *string
// The name of the snapshot to restore from. Must not be specified at the same
// time as snapshotArn .
SnapshotName *string
noSmithyDocumentSerde
}
type RestoreFromSnapshotOutput struct {
// A collection of database objects and users.
Namespace *types.Namespace
// The owner Amazon Web Services; account of the snapshot that was restored.
OwnerAccount *string
// The name of the snapshot used to restore the namespace.
SnapshotName *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationRestoreFromSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpRestoreFromSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpRestoreFromSnapshot{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpRestoreFromSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRestoreFromSnapshot(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
}
return nil
}
func newServiceMetadataMiddleware_opRestoreFromSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "RestoreFromSnapshot",
}
}
| 149 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Restores a table from a snapshot to your Amazon Redshift Serverless instance.
// You can't use this operation to restore tables with interleaved sort keys (https://docs.aws.amazon.com/redshift/latest/dg/t_Sorting_data.html#t_Sorting_data-interleaved)
// .
func (c *Client) RestoreTableFromSnapshot(ctx context.Context, params *RestoreTableFromSnapshotInput, optFns ...func(*Options)) (*RestoreTableFromSnapshotOutput, error) {
if params == nil {
params = &RestoreTableFromSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "RestoreTableFromSnapshot", params, optFns, c.addOperationRestoreTableFromSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*RestoreTableFromSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type RestoreTableFromSnapshotInput struct {
// The namespace of the snapshot to restore from.
//
// This member is required.
NamespaceName *string
// The name of the table to create from the restore operation.
//
// This member is required.
NewTableName *string
// The name of the snapshot to restore the table from.
//
// This member is required.
SnapshotName *string
// The name of the source database that contains the table being restored.
//
// This member is required.
SourceDatabaseName *string
// The name of the source table being restored.
//
// This member is required.
SourceTableName *string
// The workgroup to restore the table to.
//
// This member is required.
WorkgroupName *string
// Indicates whether name identifiers for database, schema, and table are case
// sensitive. If true, the names are case sensitive. If false, the names are not
// case sensitive. The default is false.
ActivateCaseSensitiveIdentifier *bool
// The name of the source schema that contains the table being restored.
SourceSchemaName *string
// The name of the database to restore the table to.
TargetDatabaseName *string
// The name of the schema to restore the table to.
TargetSchemaName *string
noSmithyDocumentSerde
}
type RestoreTableFromSnapshotOutput struct {
// The TableRestoreStatus object that contains the status of the restore operation.
TableRestoreStatus *types.TableRestoreStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationRestoreTableFromSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpRestoreTableFromSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpRestoreTableFromSnapshot{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpRestoreTableFromSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRestoreTableFromSnapshot(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
}
return nil
}
func newServiceMetadataMiddleware_opRestoreTableFromSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "RestoreTableFromSnapshot",
}
}
| 166 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Assigns one or more tags to a resource.
func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) {
if params == nil {
params = &TagResourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*TagResourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type TagResourceInput struct {
// The Amazon Resource Name (ARN) of the resource to tag.
//
// This member is required.
ResourceArn *string
// The map of the key-value pairs used to tag the resource.
//
// This member is required.
Tags []types.Tag
noSmithyDocumentSerde
}
type TagResourceOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpTagResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpTagResource{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpTagResourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(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
}
return nil
}
func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "TagResource",
}
}
| 126 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Removes a tag or set of tags from a resource.
func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) {
if params == nil {
params = &UntagResourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UntagResourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type UntagResourceInput struct {
// The Amazon Resource Name (ARN) of the resource to remove tags from.
//
// This member is required.
ResourceArn *string
// The tag or set of tags to remove from the resource.
//
// This member is required.
TagKeys []string
noSmithyDocumentSerde
}
type UntagResourceOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUntagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUntagResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUntagResource{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpUntagResourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(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
}
return nil
}
func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "UntagResource",
}
}
| 125 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates an Amazon Redshift Serverless managed endpoint.
func (c *Client) UpdateEndpointAccess(ctx context.Context, params *UpdateEndpointAccessInput, optFns ...func(*Options)) (*UpdateEndpointAccessOutput, error) {
if params == nil {
params = &UpdateEndpointAccessInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateEndpointAccess", params, optFns, c.addOperationUpdateEndpointAccessMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateEndpointAccessOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateEndpointAccessInput struct {
// The name of the VPC endpoint to update.
//
// This member is required.
EndpointName *string
// The list of VPC security groups associated with the endpoint after the endpoint
// is modified.
VpcSecurityGroupIds []string
noSmithyDocumentSerde
}
type UpdateEndpointAccessOutput struct {
// The updated VPC endpoint.
Endpoint *types.EndpointAccess
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateEndpointAccessMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateEndpointAccess{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateEndpointAccess{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpUpdateEndpointAccessValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateEndpointAccess(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
}
return nil
}
func newServiceMetadataMiddleware_opUpdateEndpointAccess(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "UpdateEndpointAccess",
}
}
| 129 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates a namespace with the specified settings. Unless required, you can't
// update multiple parameters in one request. For example, you must specify both
// adminUsername and adminUserPassword to update either field, but you can't
// update both kmsKeyId and logExports in a single request.
func (c *Client) UpdateNamespace(ctx context.Context, params *UpdateNamespaceInput, optFns ...func(*Options)) (*UpdateNamespaceOutput, error) {
if params == nil {
params = &UpdateNamespaceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateNamespace", params, optFns, c.addOperationUpdateNamespaceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateNamespaceOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateNamespaceInput struct {
// The name of the namespace to update. You can't update the name of a namespace
// once it is created.
//
// This member is required.
NamespaceName *string
// The password of the administrator for the first database created in the
// namespace. This parameter must be updated together with adminUsername .
AdminUserPassword *string
// The username of the administrator for the first database created in the
// namespace. This parameter must be updated together with adminUserPassword .
AdminUsername *string
// The Amazon Resource Name (ARN) of the IAM role to set as a default in the
// namespace. This parameter must be updated together with iamRoles .
DefaultIamRoleArn *string
// A list of IAM roles to associate with the namespace. This parameter must be
// updated together with defaultIamRoleArn .
IamRoles []string
// The ID of the Amazon Web Services Key Management Service key used to encrypt
// your data.
KmsKeyId *string
// The types of logs the namespace can export. The export types are userlog ,
// connectionlog , and useractivitylog .
LogExports []types.LogExport
noSmithyDocumentSerde
}
type UpdateNamespaceOutput struct {
// A list of tag instances.
//
// This member is required.
Namespace *types.Namespace
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateNamespaceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateNamespace{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateNamespace{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpUpdateNamespaceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateNamespace(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
}
return nil
}
func newServiceMetadataMiddleware_opUpdateNamespace(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "UpdateNamespace",
}
}
| 155 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates a snapshot.
func (c *Client) UpdateSnapshot(ctx context.Context, params *UpdateSnapshotInput, optFns ...func(*Options)) (*UpdateSnapshotOutput, error) {
if params == nil {
params = &UpdateSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateSnapshot", params, optFns, c.addOperationUpdateSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateSnapshotInput struct {
// The name of the snapshot.
//
// This member is required.
SnapshotName *string
// The new retention period of the snapshot.
RetentionPeriod *int32
noSmithyDocumentSerde
}
type UpdateSnapshotOutput struct {
// The updated snapshot object.
Snapshot *types.Snapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateSnapshot{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpUpdateSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateSnapshot(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
}
return nil
}
func newServiceMetadataMiddleware_opUpdateSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "UpdateSnapshot",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Update a usage limit in Amazon Redshift Serverless. You can't update the usage
// type or period of a usage limit.
func (c *Client) UpdateUsageLimit(ctx context.Context, params *UpdateUsageLimitInput, optFns ...func(*Options)) (*UpdateUsageLimitOutput, error) {
if params == nil {
params = &UpdateUsageLimitInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateUsageLimit", params, optFns, c.addOperationUpdateUsageLimitMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateUsageLimitOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateUsageLimitInput struct {
// The identifier of the usage limit to update.
//
// This member is required.
UsageLimitId *string
// The new limit amount. If time-based, this amount is in Redshift Processing
// Units (RPU) consumed per hour. If data-based, this amount is in terabytes (TB)
// of data transferred between Regions in cross-account sharing. The value must be
// a positive number.
Amount *int64
// The new action that Amazon Redshift Serverless takes when the limit is reached.
BreachAction types.UsageLimitBreachAction
noSmithyDocumentSerde
}
type UpdateUsageLimitOutput struct {
// The updated usage limit object.
UsageLimit *types.UsageLimit
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateUsageLimitMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateUsageLimit{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateUsageLimit{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpUpdateUsageLimitValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateUsageLimit(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
}
return nil
}
func newServiceMetadataMiddleware_opUpdateUsageLimit(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "UpdateUsageLimit",
}
}
| 135 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates a workgroup with the specified configuration settings. You can't update
// multiple parameters in one request. For example, you can update baseCapacity or
// port in a single request, but you can't update both in the same request.
func (c *Client) UpdateWorkgroup(ctx context.Context, params *UpdateWorkgroupInput, optFns ...func(*Options)) (*UpdateWorkgroupOutput, error) {
if params == nil {
params = &UpdateWorkgroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateWorkgroup", params, optFns, c.addOperationUpdateWorkgroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateWorkgroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateWorkgroupInput struct {
// The name of the workgroup to update. You can't update the name of a workgroup
// once it is created.
//
// This member is required.
WorkgroupName *string
// The new base data warehouse capacity in Redshift Processing Units (RPUs).
BaseCapacity *int32
// An array of parameters to set for advanced control over a database. The options
// are auto_mv , datestyle , enable_case_sensitivity_identifier ,
// enable_user_activity_logging , query_group , search_path , and query monitoring
// metrics that let you define performance boundaries. For more information about
// query monitoring rules and available metrics, see Query monitoring metrics for
// Amazon Redshift Serverless (https://docs.aws.amazon.com/redshift/latest/dg/cm-c-wlm-query-monitoring-rules.html#cm-c-wlm-query-monitoring-metrics-serverless)
// .
ConfigParameters []types.ConfigParameter
// The value that specifies whether to turn on enhanced virtual private cloud
// (VPC) routing, which forces Amazon Redshift Serverless to route traffic through
// your VPC.
EnhancedVpcRouting *bool
// The custom port to use when connecting to a workgroup. Valid port ranges are
// 5431-5455 and 8191-8215. The default is 5439.
Port *int32
// A value that specifies whether the workgroup can be accessible from a public
// network.
PubliclyAccessible *bool
// An array of security group IDs to associate with the workgroup.
SecurityGroupIds []string
// An array of VPC subnet IDs to associate with the workgroup.
SubnetIds []string
noSmithyDocumentSerde
}
type UpdateWorkgroupOutput struct {
// The updated workgroup object.
//
// This member is required.
Workgroup *types.Workgroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateWorkgroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateWorkgroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateWorkgroup{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpUpdateWorkgroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateWorkgroup(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
}
return nil
}
func newServiceMetadataMiddleware_opUpdateWorkgroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "redshift-serverless",
OperationName: "UpdateWorkgroup",
}
}
| 161 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
smithy "github.com/aws/smithy-go"
smithyio "github.com/aws/smithy-go/io"
"github.com/aws/smithy-go/middleware"
"github.com/aws/smithy-go/ptr"
smithytime "github.com/aws/smithy-go/time"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
"math"
"strings"
)
type awsAwsjson11_deserializeOpConvertRecoveryPointToSnapshot struct {
}
func (*awsAwsjson11_deserializeOpConvertRecoveryPointToSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpConvertRecoveryPointToSnapshot) 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_deserializeOpErrorConvertRecoveryPointToSnapshot(response, &metadata)
}
output := &ConvertRecoveryPointToSnapshotOutput{}
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_deserializeOpDocumentConvertRecoveryPointToSnapshotOutput(&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_deserializeOpErrorConvertRecoveryPointToSnapshot(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("TooManyTagsException", errorCode):
return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpCreateEndpointAccess struct {
}
func (*awsAwsjson11_deserializeOpCreateEndpointAccess) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpCreateEndpointAccess) 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_deserializeOpErrorCreateEndpointAccess(response, &metadata)
}
output := &CreateEndpointAccessOutput{}
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_deserializeOpDocumentCreateEndpointAccessOutput(&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_deserializeOpErrorCreateEndpointAccess(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpCreateNamespace struct {
}
func (*awsAwsjson11_deserializeOpCreateNamespace) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpCreateNamespace) 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_deserializeOpErrorCreateNamespace(response, &metadata)
}
output := &CreateNamespaceOutput{}
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_deserializeOpDocumentCreateNamespaceOutput(&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_deserializeOpErrorCreateNamespace(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("TooManyTagsException", errorCode):
return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpCreateSnapshot struct {
}
func (*awsAwsjson11_deserializeOpCreateSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpCreateSnapshot) 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_deserializeOpErrorCreateSnapshot(response, &metadata)
}
output := &CreateSnapshotOutput{}
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_deserializeOpDocumentCreateSnapshotOutput(&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_deserializeOpErrorCreateSnapshot(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("TooManyTagsException", errorCode):
return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpCreateUsageLimit struct {
}
func (*awsAwsjson11_deserializeOpCreateUsageLimit) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpCreateUsageLimit) 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_deserializeOpErrorCreateUsageLimit(response, &metadata)
}
output := &CreateUsageLimitOutput{}
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_deserializeOpDocumentCreateUsageLimitOutput(&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_deserializeOpErrorCreateUsageLimit(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpCreateWorkgroup struct {
}
func (*awsAwsjson11_deserializeOpCreateWorkgroup) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpCreateWorkgroup) 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_deserializeOpErrorCreateWorkgroup(response, &metadata)
}
output := &CreateWorkgroupOutput{}
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_deserializeOpDocumentCreateWorkgroupOutput(&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_deserializeOpErrorCreateWorkgroup(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InsufficientCapacityException", errorCode):
return awsAwsjson11_deserializeErrorInsufficientCapacityException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("TooManyTagsException", errorCode):
return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpDeleteEndpointAccess struct {
}
func (*awsAwsjson11_deserializeOpDeleteEndpointAccess) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpDeleteEndpointAccess) 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_deserializeOpErrorDeleteEndpointAccess(response, &metadata)
}
output := &DeleteEndpointAccessOutput{}
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_deserializeOpDocumentDeleteEndpointAccessOutput(&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_deserializeOpErrorDeleteEndpointAccess(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpDeleteNamespace struct {
}
func (*awsAwsjson11_deserializeOpDeleteNamespace) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpDeleteNamespace) 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_deserializeOpErrorDeleteNamespace(response, &metadata)
}
output := &DeleteNamespaceOutput{}
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_deserializeOpDocumentDeleteNamespaceOutput(&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_deserializeOpErrorDeleteNamespace(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
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
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_deserializeOpDocumentDeleteResourcePolicyOutput(&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_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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpDeleteSnapshot struct {
}
func (*awsAwsjson11_deserializeOpDeleteSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpDeleteSnapshot) 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_deserializeOpErrorDeleteSnapshot(response, &metadata)
}
output := &DeleteSnapshotOutput{}
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_deserializeOpDocumentDeleteSnapshotOutput(&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_deserializeOpErrorDeleteSnapshot(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpDeleteUsageLimit struct {
}
func (*awsAwsjson11_deserializeOpDeleteUsageLimit) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpDeleteUsageLimit) 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_deserializeOpErrorDeleteUsageLimit(response, &metadata)
}
output := &DeleteUsageLimitOutput{}
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_deserializeOpDocumentDeleteUsageLimitOutput(&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_deserializeOpErrorDeleteUsageLimit(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpDeleteWorkgroup struct {
}
func (*awsAwsjson11_deserializeOpDeleteWorkgroup) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpDeleteWorkgroup) 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_deserializeOpErrorDeleteWorkgroup(response, &metadata)
}
output := &DeleteWorkgroupOutput{}
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_deserializeOpDocumentDeleteWorkgroupOutput(&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_deserializeOpErrorDeleteWorkgroup(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpGetCredentials struct {
}
func (*awsAwsjson11_deserializeOpGetCredentials) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpGetCredentials) 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_deserializeOpErrorGetCredentials(response, &metadata)
}
output := &GetCredentialsOutput{}
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_deserializeOpDocumentGetCredentialsOutput(&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_deserializeOpErrorGetCredentials(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpGetEndpointAccess struct {
}
func (*awsAwsjson11_deserializeOpGetEndpointAccess) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpGetEndpointAccess) 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_deserializeOpErrorGetEndpointAccess(response, &metadata)
}
output := &GetEndpointAccessOutput{}
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_deserializeOpDocumentGetEndpointAccessOutput(&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_deserializeOpErrorGetEndpointAccess(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpGetNamespace struct {
}
func (*awsAwsjson11_deserializeOpGetNamespace) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpGetNamespace) 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_deserializeOpErrorGetNamespace(response, &metadata)
}
output := &GetNamespaceOutput{}
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_deserializeOpDocumentGetNamespaceOutput(&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_deserializeOpErrorGetNamespace(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpGetRecoveryPoint struct {
}
func (*awsAwsjson11_deserializeOpGetRecoveryPoint) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpGetRecoveryPoint) 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_deserializeOpErrorGetRecoveryPoint(response, &metadata)
}
output := &GetRecoveryPointOutput{}
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_deserializeOpDocumentGetRecoveryPointOutput(&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_deserializeOpErrorGetRecoveryPoint(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpGetSnapshot struct {
}
func (*awsAwsjson11_deserializeOpGetSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpGetSnapshot) 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_deserializeOpErrorGetSnapshot(response, &metadata)
}
output := &GetSnapshotOutput{}
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_deserializeOpDocumentGetSnapshotOutput(&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_deserializeOpErrorGetSnapshot(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpGetTableRestoreStatus struct {
}
func (*awsAwsjson11_deserializeOpGetTableRestoreStatus) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpGetTableRestoreStatus) 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_deserializeOpErrorGetTableRestoreStatus(response, &metadata)
}
output := &GetTableRestoreStatusOutput{}
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_deserializeOpDocumentGetTableRestoreStatusOutput(&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_deserializeOpErrorGetTableRestoreStatus(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("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpGetUsageLimit struct {
}
func (*awsAwsjson11_deserializeOpGetUsageLimit) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpGetUsageLimit) 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_deserializeOpErrorGetUsageLimit(response, &metadata)
}
output := &GetUsageLimitOutput{}
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_deserializeOpDocumentGetUsageLimitOutput(&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_deserializeOpErrorGetUsageLimit(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpGetWorkgroup struct {
}
func (*awsAwsjson11_deserializeOpGetWorkgroup) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpGetWorkgroup) 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_deserializeOpErrorGetWorkgroup(response, &metadata)
}
output := &GetWorkgroupOutput{}
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_deserializeOpDocumentGetWorkgroupOutput(&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_deserializeOpErrorGetWorkgroup(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpListEndpointAccess struct {
}
func (*awsAwsjson11_deserializeOpListEndpointAccess) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpListEndpointAccess) 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_deserializeOpErrorListEndpointAccess(response, &metadata)
}
output := &ListEndpointAccessOutput{}
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_deserializeOpDocumentListEndpointAccessOutput(&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_deserializeOpErrorListEndpointAccess(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpListNamespaces struct {
}
func (*awsAwsjson11_deserializeOpListNamespaces) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpListNamespaces) 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_deserializeOpErrorListNamespaces(response, &metadata)
}
output := &ListNamespacesOutput{}
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_deserializeOpDocumentListNamespacesOutput(&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_deserializeOpErrorListNamespaces(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpListRecoveryPoints struct {
}
func (*awsAwsjson11_deserializeOpListRecoveryPoints) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpListRecoveryPoints) 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_deserializeOpErrorListRecoveryPoints(response, &metadata)
}
output := &ListRecoveryPointsOutput{}
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_deserializeOpDocumentListRecoveryPointsOutput(&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_deserializeOpErrorListRecoveryPoints(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpListSnapshots struct {
}
func (*awsAwsjson11_deserializeOpListSnapshots) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpListSnapshots) 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_deserializeOpErrorListSnapshots(response, &metadata)
}
output := &ListSnapshotsOutput{}
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_deserializeOpDocumentListSnapshotsOutput(&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_deserializeOpErrorListSnapshots(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpListTableRestoreStatus struct {
}
func (*awsAwsjson11_deserializeOpListTableRestoreStatus) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpListTableRestoreStatus) 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_deserializeOpErrorListTableRestoreStatus(response, &metadata)
}
output := &ListTableRestoreStatusOutput{}
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_deserializeOpDocumentListTableRestoreStatusOutput(&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_deserializeOpErrorListTableRestoreStatus(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("InvalidPaginationException", errorCode):
return awsAwsjson11_deserializeErrorInvalidPaginationException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpListTagsForResource struct {
}
func (*awsAwsjson11_deserializeOpListTagsForResource) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpListTagsForResource) 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_deserializeOpErrorListTagsForResource(response, &metadata)
}
output := &ListTagsForResourceOutput{}
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_deserializeOpDocumentListTagsForResourceOutput(&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_deserializeOpErrorListTagsForResource(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpListUsageLimits struct {
}
func (*awsAwsjson11_deserializeOpListUsageLimits) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpListUsageLimits) 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_deserializeOpErrorListUsageLimits(response, &metadata)
}
output := &ListUsageLimitsOutput{}
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_deserializeOpDocumentListUsageLimitsOutput(&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_deserializeOpErrorListUsageLimits(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("InvalidPaginationException", errorCode):
return awsAwsjson11_deserializeErrorInvalidPaginationException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpListWorkgroups struct {
}
func (*awsAwsjson11_deserializeOpListWorkgroups) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpListWorkgroups) 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_deserializeOpErrorListWorkgroups(response, &metadata)
}
output := &ListWorkgroupsOutput{}
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_deserializeOpDocumentListWorkgroupsOutput(&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_deserializeOpErrorListWorkgroups(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
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
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_deserializeOpDocumentPutResourcePolicyOutput(&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_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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpRestoreFromRecoveryPoint struct {
}
func (*awsAwsjson11_deserializeOpRestoreFromRecoveryPoint) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpRestoreFromRecoveryPoint) 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_deserializeOpErrorRestoreFromRecoveryPoint(response, &metadata)
}
output := &RestoreFromRecoveryPointOutput{}
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_deserializeOpDocumentRestoreFromRecoveryPointOutput(&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_deserializeOpErrorRestoreFromRecoveryPoint(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpRestoreFromSnapshot struct {
}
func (*awsAwsjson11_deserializeOpRestoreFromSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpRestoreFromSnapshot) 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_deserializeOpErrorRestoreFromSnapshot(response, &metadata)
}
output := &RestoreFromSnapshotOutput{}
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_deserializeOpDocumentRestoreFromSnapshotOutput(&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_deserializeOpErrorRestoreFromSnapshot(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpRestoreTableFromSnapshot struct {
}
func (*awsAwsjson11_deserializeOpRestoreTableFromSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpRestoreTableFromSnapshot) 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_deserializeOpErrorRestoreTableFromSnapshot(response, &metadata)
}
output := &RestoreTableFromSnapshotOutput{}
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_deserializeOpDocumentRestoreTableFromSnapshotOutput(&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_deserializeOpErrorRestoreTableFromSnapshot(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpTagResource struct {
}
func (*awsAwsjson11_deserializeOpTagResource) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpTagResource) 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_deserializeOpErrorTagResource(response, &metadata)
}
output := &TagResourceOutput{}
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_deserializeOpDocumentTagResourceOutput(&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_deserializeOpErrorTagResource(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("TooManyTagsException", errorCode):
return awsAwsjson11_deserializeErrorTooManyTagsException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpUntagResource struct {
}
func (*awsAwsjson11_deserializeOpUntagResource) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpUntagResource) 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_deserializeOpErrorUntagResource(response, &metadata)
}
output := &UntagResourceOutput{}
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_deserializeOpDocumentUntagResourceOutput(&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_deserializeOpErrorUntagResource(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("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpUpdateEndpointAccess struct {
}
func (*awsAwsjson11_deserializeOpUpdateEndpointAccess) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpUpdateEndpointAccess) 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_deserializeOpErrorUpdateEndpointAccess(response, &metadata)
}
output := &UpdateEndpointAccessOutput{}
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_deserializeOpDocumentUpdateEndpointAccessOutput(&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_deserializeOpErrorUpdateEndpointAccess(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpUpdateNamespace struct {
}
func (*awsAwsjson11_deserializeOpUpdateNamespace) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpUpdateNamespace) 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_deserializeOpErrorUpdateNamespace(response, &metadata)
}
output := &UpdateNamespaceOutput{}
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_deserializeOpDocumentUpdateNamespaceOutput(&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_deserializeOpErrorUpdateNamespace(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpUpdateSnapshot struct {
}
func (*awsAwsjson11_deserializeOpUpdateSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpUpdateSnapshot) 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_deserializeOpErrorUpdateSnapshot(response, &metadata)
}
output := &UpdateSnapshotOutput{}
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_deserializeOpDocumentUpdateSnapshotOutput(&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_deserializeOpErrorUpdateSnapshot(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpUpdateUsageLimit struct {
}
func (*awsAwsjson11_deserializeOpUpdateUsageLimit) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpUpdateUsageLimit) 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_deserializeOpErrorUpdateUsageLimit(response, &metadata)
}
output := &UpdateUsageLimitOutput{}
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_deserializeOpDocumentUpdateUsageLimitOutput(&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_deserializeOpErrorUpdateUsageLimit(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsAwsjson11_deserializeOpUpdateWorkgroup struct {
}
func (*awsAwsjson11_deserializeOpUpdateWorkgroup) ID() string {
return "OperationDeserializer"
}
func (m *awsAwsjson11_deserializeOpUpdateWorkgroup) 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_deserializeOpErrorUpdateWorkgroup(response, &metadata)
}
output := &UpdateWorkgroupOutput{}
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_deserializeOpDocumentUpdateWorkgroupOutput(&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_deserializeOpErrorUpdateWorkgroup(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("ConflictException", errorCode):
return awsAwsjson11_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InsufficientCapacityException", errorCode):
return awsAwsjson11_deserializeErrorInsufficientCapacityException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsAwsjson11_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsAwsjson11_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsAwsjson11_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.AccessDeniedException{}
err := awsAwsjson11_deserializeDocumentAccessDeniedException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.ConflictException{}
err := awsAwsjson11_deserializeDocumentConflictException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorInsufficientCapacityException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.InsufficientCapacityException{}
err := awsAwsjson11_deserializeDocumentInsufficientCapacityException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.InternalServerException{}
err := awsAwsjson11_deserializeDocumentInternalServerException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorInvalidPaginationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.InvalidPaginationException{}
err := awsAwsjson11_deserializeDocumentInvalidPaginationException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.ResourceNotFoundException{}
err := awsAwsjson11_deserializeDocumentResourceNotFoundException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.ServiceQuotaExceededException{}
err := awsAwsjson11_deserializeDocumentServiceQuotaExceededException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.ThrottlingException{}
err := awsAwsjson11_deserializeDocumentThrottlingException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorTooManyTagsException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.TooManyTagsException{}
err := awsAwsjson11_deserializeDocumentTooManyTagsException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
output := &types.ValidationException{}
err := awsAwsjson11_deserializeDocumentValidationException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsAwsjson11_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, 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.AccessDeniedException
if *v == nil {
sv = &types.AccessDeniedException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentAccountIdList(v *[]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []string
if *v == nil {
cv = []string{}
} else {
cv = *v
}
for _, value := range shape {
var col string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentConfigParameter(v **types.ConfigParameter, 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.ConfigParameter
if *v == nil {
sv = &types.ConfigParameter{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "parameterKey":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ParameterKey to be of type string, got %T instead", value)
}
sv.ParameterKey = ptr.String(jtv)
}
case "parameterValue":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ParameterValue to be of type string, got %T instead", value)
}
sv.ParameterValue = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentConfigParameterList(v *[]types.ConfigParameter, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.ConfigParameter
if *v == nil {
cv = []types.ConfigParameter{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ConfigParameter
destAddr := &col
if err := awsAwsjson11_deserializeDocumentConfigParameter(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentConflictException(v **types.ConflictException, 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.ConflictException
if *v == nil {
sv = &types.ConflictException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentEndpoint(v **types.Endpoint, 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.Endpoint
if *v == nil {
sv = &types.Endpoint{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "address":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Address = ptr.String(jtv)
}
case "port":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Port = ptr.Int32(int32(i64))
}
case "vpcEndpoints":
if err := awsAwsjson11_deserializeDocumentVpcEndpointList(&sv.VpcEndpoints, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentEndpointAccess(v **types.EndpointAccess, 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.EndpointAccess
if *v == nil {
sv = &types.EndpointAccess{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "address":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Address = ptr.String(jtv)
}
case "endpointArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.EndpointArn = ptr.String(jtv)
}
case "endpointCreateTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.EndpointCreateTime = ptr.Time(t)
}
case "endpointName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.EndpointName = ptr.String(jtv)
}
case "endpointStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.EndpointStatus = ptr.String(jtv)
}
case "port":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Port = ptr.Int32(int32(i64))
}
case "subnetIds":
if err := awsAwsjson11_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil {
return err
}
case "vpcEndpoint":
if err := awsAwsjson11_deserializeDocumentVpcEndpoint(&sv.VpcEndpoint, value); err != nil {
return err
}
case "vpcSecurityGroups":
if err := awsAwsjson11_deserializeDocumentVpcSecurityGroupMembershipList(&sv.VpcSecurityGroups, value); err != nil {
return err
}
case "workgroupName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.WorkgroupName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentEndpointAccessList(v *[]types.EndpointAccess, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.EndpointAccess
if *v == nil {
cv = []types.EndpointAccess{}
} else {
cv = *v
}
for _, value := range shape {
var col types.EndpointAccess
destAddr := &col
if err := awsAwsjson11_deserializeDocumentEndpointAccess(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentIamRoleArnList(v *[]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []string
if *v == nil {
cv = []string{}
} else {
cv = *v
}
for _, value := range shape {
var col string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentInsufficientCapacityException(v **types.InsufficientCapacityException, 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.InsufficientCapacityException
if *v == nil {
sv = &types.InsufficientCapacityException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentInternalServerException(v **types.InternalServerException, 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.InternalServerException
if *v == nil {
sv = &types.InternalServerException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentInvalidPaginationException(v **types.InvalidPaginationException, 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.InvalidPaginationException
if *v == nil {
sv = &types.InvalidPaginationException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentLogExportList(v *[]types.LogExport, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.LogExport
if *v == nil {
cv = []types.LogExport{}
} else {
cv = *v
}
for _, value := range shape {
var col types.LogExport
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LogExport to be of type string, got %T instead", value)
}
col = types.LogExport(jtv)
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentNamespace(v **types.Namespace, 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.Namespace
if *v == nil {
sv = &types.Namespace{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "adminUsername":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DbUser to be of type string, got %T instead", value)
}
sv.AdminUsername = ptr.String(jtv)
}
case "creationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationDate = ptr.Time(t)
}
case "dbName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.DbName = ptr.String(jtv)
}
case "defaultIamRoleArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.DefaultIamRoleArn = ptr.String(jtv)
}
case "iamRoles":
if err := awsAwsjson11_deserializeDocumentIamRoleArnList(&sv.IamRoles, value); err != nil {
return err
}
case "kmsKeyId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.KmsKeyId = ptr.String(jtv)
}
case "logExports":
if err := awsAwsjson11_deserializeDocumentLogExportList(&sv.LogExports, value); err != nil {
return err
}
case "namespaceArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NamespaceArn = ptr.String(jtv)
}
case "namespaceId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NamespaceId = ptr.String(jtv)
}
case "namespaceName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NamespaceName to be of type string, got %T instead", value)
}
sv.NamespaceName = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NamespaceStatus to be of type string, got %T instead", value)
}
sv.Status = types.NamespaceStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentNamespaceList(v *[]types.Namespace, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Namespace
if *v == nil {
cv = []types.Namespace{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Namespace
destAddr := &col
if err := awsAwsjson11_deserializeDocumentNamespace(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentNetworkInterface(v **types.NetworkInterface, 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.NetworkInterface
if *v == nil {
sv = &types.NetworkInterface{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "availabilityZone":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.AvailabilityZone = ptr.String(jtv)
}
case "networkInterfaceId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NetworkInterfaceId = ptr.String(jtv)
}
case "privateIpAddress":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.PrivateIpAddress = ptr.String(jtv)
}
case "subnetId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SubnetId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentNetworkInterfaceList(v *[]types.NetworkInterface, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.NetworkInterface
if *v == nil {
cv = []types.NetworkInterface{}
} else {
cv = *v
}
for _, value := range shape {
var col types.NetworkInterface
destAddr := &col
if err := awsAwsjson11_deserializeDocumentNetworkInterface(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentRecoveryPoint(v **types.RecoveryPoint, 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.RecoveryPoint
if *v == nil {
sv = &types.RecoveryPoint{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "namespaceArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NamespaceArn = ptr.String(jtv)
}
case "namespaceName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NamespaceName to be of type string, got %T instead", value)
}
sv.NamespaceName = ptr.String(jtv)
}
case "recoveryPointCreateTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.RecoveryPointCreateTime = ptr.Time(t)
}
case "recoveryPointId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.RecoveryPointId = ptr.String(jtv)
}
case "totalSizeInMegaBytes":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.TotalSizeInMegaBytes = ptr.Float64(f64)
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
sv.TotalSizeInMegaBytes = ptr.Float64(f64)
default:
return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value)
}
}
case "workgroupName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected WorkgroupName to be of type string, got %T instead", value)
}
sv.WorkgroupName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentRecoveryPointList(v *[]types.RecoveryPoint, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.RecoveryPoint
if *v == nil {
cv = []types.RecoveryPoint{}
} else {
cv = *v
}
for _, value := range shape {
var col types.RecoveryPoint
destAddr := &col
if err := awsAwsjson11_deserializeDocumentRecoveryPoint(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ResourceNotFoundException
if *v == nil {
sv = &types.ResourceNotFoundException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "resourceName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value)
}
sv.ResourceName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentResourcePolicy(v **types.ResourcePolicy, 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.ResourcePolicy
if *v == nil {
sv = &types.ResourcePolicy{}
} 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 String to be of type string, got %T instead", value)
}
sv.Policy = ptr.String(jtv)
}
case "resourceArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceArn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentSecurityGroupIdList(v *[]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []string
if *v == nil {
cv = []string{}
} else {
cv = *v
}
for _, value := range shape {
var col string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SecurityGroupId to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, 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.ServiceQuotaExceededException
if *v == nil {
sv = &types.ServiceQuotaExceededException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentSnapshot(v **types.Snapshot, 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.Snapshot
if *v == nil {
sv = &types.Snapshot{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "accountsWithProvisionedRestoreAccess":
if err := awsAwsjson11_deserializeDocumentAccountIdList(&sv.AccountsWithProvisionedRestoreAccess, value); err != nil {
return err
}
case "accountsWithRestoreAccess":
if err := awsAwsjson11_deserializeDocumentAccountIdList(&sv.AccountsWithRestoreAccess, value); err != nil {
return err
}
case "actualIncrementalBackupSizeInMegaBytes":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.ActualIncrementalBackupSizeInMegaBytes = ptr.Float64(f64)
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
sv.ActualIncrementalBackupSizeInMegaBytes = ptr.Float64(f64)
default:
return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value)
}
}
case "adminUsername":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.AdminUsername = ptr.String(jtv)
}
case "backupProgressInMegaBytes":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.BackupProgressInMegaBytes = ptr.Float64(f64)
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
sv.BackupProgressInMegaBytes = ptr.Float64(f64)
default:
return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value)
}
}
case "currentBackupRateInMegaBytesPerSecond":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CurrentBackupRateInMegaBytesPerSecond = ptr.Float64(f64)
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
sv.CurrentBackupRateInMegaBytesPerSecond = ptr.Float64(f64)
default:
return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value)
}
}
case "elapsedTimeInSeconds":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.ElapsedTimeInSeconds = ptr.Int64(i64)
}
case "estimatedSecondsToCompletion":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.EstimatedSecondsToCompletion = ptr.Int64(i64)
}
case "kmsKeyId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected KmsKeyId to be of type string, got %T instead", value)
}
sv.KmsKeyId = ptr.String(jtv)
}
case "namespaceArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NamespaceArn = ptr.String(jtv)
}
case "namespaceName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NamespaceName = ptr.String(jtv)
}
case "ownerAccount":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.OwnerAccount = ptr.String(jtv)
}
case "snapshotArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SnapshotArn = ptr.String(jtv)
}
case "snapshotCreateTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.SnapshotCreateTime = ptr.Time(t)
}
case "snapshotName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SnapshotName = ptr.String(jtv)
}
case "snapshotRemainingDays":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.SnapshotRemainingDays = ptr.Int32(int32(i64))
}
case "snapshotRetentionPeriod":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.SnapshotRetentionPeriod = ptr.Int32(int32(i64))
}
case "snapshotRetentionStartTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.SnapshotRetentionStartTime = ptr.Time(t)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SnapshotStatus to be of type string, got %T instead", value)
}
sv.Status = types.SnapshotStatus(jtv)
}
case "totalBackupSizeInMegaBytes":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.TotalBackupSizeInMegaBytes = ptr.Float64(f64)
case string:
var f64 float64
switch {
case strings.EqualFold(jtv, "NaN"):
f64 = math.NaN()
case strings.EqualFold(jtv, "Infinity"):
f64 = math.Inf(1)
case strings.EqualFold(jtv, "-Infinity"):
f64 = math.Inf(-1)
default:
return fmt.Errorf("unknown JSON number value: %s", jtv)
}
sv.TotalBackupSizeInMegaBytes = ptr.Float64(f64)
default:
return fmt.Errorf("expected Double to be a JSON Number, got %T instead", value)
}
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentSnapshotList(v *[]types.Snapshot, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Snapshot
if *v == nil {
cv = []types.Snapshot{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Snapshot
destAddr := &col
if err := awsAwsjson11_deserializeDocumentSnapshot(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentSubnetIdList(v *[]string, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []string
if *v == nil {
cv = []string{}
} else {
cv = *v
}
for _, value := range shape {
var col string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SubnetId to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentTableRestoreStatus(v **types.TableRestoreStatus, 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.TableRestoreStatus
if *v == nil {
sv = &types.TableRestoreStatus{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "namespaceName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NamespaceName = ptr.String(jtv)
}
case "newTableName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NewTableName = ptr.String(jtv)
}
case "progressInMegaBytes":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.ProgressInMegaBytes = ptr.Int64(i64)
}
case "requestTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.RequestTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "snapshotName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SnapshotName = ptr.String(jtv)
}
case "sourceDatabaseName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SourceDatabaseName = ptr.String(jtv)
}
case "sourceSchemaName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SourceSchemaName = ptr.String(jtv)
}
case "sourceTableName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SourceTableName = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
case "tableRestoreRequestId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.TableRestoreRequestId = ptr.String(jtv)
}
case "targetDatabaseName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.TargetDatabaseName = ptr.String(jtv)
}
case "targetSchemaName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.TargetSchemaName = ptr.String(jtv)
}
case "totalDataInMegaBytes":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.TotalDataInMegaBytes = ptr.Int64(i64)
}
case "workgroupName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.WorkgroupName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentTableRestoreStatusList(v *[]types.TableRestoreStatus, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.TableRestoreStatus
if *v == nil {
cv = []types.TableRestoreStatus{}
} else {
cv = *v
}
for _, value := range shape {
var col types.TableRestoreStatus
destAddr := &col
if err := awsAwsjson11_deserializeDocumentTableRestoreStatus(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentTag(v **types.Tag, 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.Tag
if *v == nil {
sv = &types.Tag{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "key":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagKey to be of type string, got %T instead", value)
}
sv.Key = ptr.String(jtv)
}
case "value":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagValue to be of type string, got %T instead", value)
}
sv.Value = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentTagList(v *[]types.Tag, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Tag
if *v == nil {
cv = []types.Tag{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Tag
destAddr := &col
if err := awsAwsjson11_deserializeDocumentTag(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ThrottlingException
if *v == nil {
sv = &types.ThrottlingException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentTooManyTagsException(v **types.TooManyTagsException, 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.TooManyTagsException
if *v == nil {
sv = &types.TooManyTagsException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "resourceName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected AmazonResourceName to be of type string, got %T instead", value)
}
sv.ResourceName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentUsageLimit(v **types.UsageLimit, 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.UsageLimit
if *v == nil {
sv = &types.UsageLimit{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "amount":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Long to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Amount = ptr.Int64(i64)
}
case "breachAction":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UsageLimitBreachAction to be of type string, got %T instead", value)
}
sv.BreachAction = types.UsageLimitBreachAction(jtv)
}
case "period":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UsageLimitPeriod to be of type string, got %T instead", value)
}
sv.Period = types.UsageLimitPeriod(jtv)
}
case "resourceArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceArn = ptr.String(jtv)
}
case "usageLimitArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UsageLimitArn = ptr.String(jtv)
}
case "usageLimitId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.UsageLimitId = ptr.String(jtv)
}
case "usageType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UsageLimitUsageType to be of type string, got %T instead", value)
}
sv.UsageType = types.UsageLimitUsageType(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentUsageLimits(v *[]types.UsageLimit, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.UsageLimit
if *v == nil {
cv = []types.UsageLimit{}
} else {
cv = *v
}
for _, value := range shape {
var col types.UsageLimit
destAddr := &col
if err := awsAwsjson11_deserializeDocumentUsageLimit(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentValidationException(v **types.ValidationException, 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.ValidationException
if *v == nil {
sv = &types.ValidationException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentVpcEndpoint(v **types.VpcEndpoint, 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.VpcEndpoint
if *v == nil {
sv = &types.VpcEndpoint{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "networkInterfaces":
if err := awsAwsjson11_deserializeDocumentNetworkInterfaceList(&sv.NetworkInterfaces, value); err != nil {
return err
}
case "vpcEndpointId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.VpcEndpointId = ptr.String(jtv)
}
case "vpcId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.VpcId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentVpcEndpointList(v *[]types.VpcEndpoint, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.VpcEndpoint
if *v == nil {
cv = []types.VpcEndpoint{}
} else {
cv = *v
}
for _, value := range shape {
var col types.VpcEndpoint
destAddr := &col
if err := awsAwsjson11_deserializeDocumentVpcEndpoint(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentVpcSecurityGroupMembership(v **types.VpcSecurityGroupMembership, 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.VpcSecurityGroupMembership
if *v == nil {
sv = &types.VpcSecurityGroupMembership{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
case "vpcSecurityGroupId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected VpcSecurityGroupId to be of type string, got %T instead", value)
}
sv.VpcSecurityGroupId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentVpcSecurityGroupMembershipList(v *[]types.VpcSecurityGroupMembership, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.VpcSecurityGroupMembership
if *v == nil {
cv = []types.VpcSecurityGroupMembership{}
} else {
cv = *v
}
for _, value := range shape {
var col types.VpcSecurityGroupMembership
destAddr := &col
if err := awsAwsjson11_deserializeDocumentVpcSecurityGroupMembership(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeDocumentWorkgroup(v **types.Workgroup, 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.Workgroup
if *v == nil {
sv = &types.Workgroup{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "baseCapacity":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.BaseCapacity = ptr.Int32(int32(i64))
}
case "configParameters":
if err := awsAwsjson11_deserializeDocumentConfigParameterList(&sv.ConfigParameters, value); err != nil {
return err
}
case "creationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.CreationDate = ptr.Time(t)
}
case "endpoint":
if err := awsAwsjson11_deserializeDocumentEndpoint(&sv.Endpoint, value); err != nil {
return err
}
case "enhancedVpcRouting":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.EnhancedVpcRouting = ptr.Bool(jtv)
}
case "namespaceName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NamespaceName = ptr.String(jtv)
}
case "port":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Integer to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Port = ptr.Int32(int32(i64))
}
case "publiclyAccessible":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.PubliclyAccessible = ptr.Bool(jtv)
}
case "securityGroupIds":
if err := awsAwsjson11_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil {
return err
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected WorkgroupStatus to be of type string, got %T instead", value)
}
sv.Status = types.WorkgroupStatus(jtv)
}
case "subnetIds":
if err := awsAwsjson11_deserializeDocumentSubnetIdList(&sv.SubnetIds, value); err != nil {
return err
}
case "workgroupArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.WorkgroupArn = ptr.String(jtv)
}
case "workgroupId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.WorkgroupId = ptr.String(jtv)
}
case "workgroupName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected WorkgroupName to be of type string, got %T instead", value)
}
sv.WorkgroupName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeDocumentWorkgroupList(v *[]types.Workgroup, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Workgroup
if *v == nil {
cv = []types.Workgroup{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Workgroup
destAddr := &col
if err := awsAwsjson11_deserializeDocumentWorkgroup(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsAwsjson11_deserializeOpDocumentConvertRecoveryPointToSnapshotOutput(v **ConvertRecoveryPointToSnapshotOutput, 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 *ConvertRecoveryPointToSnapshotOutput
if *v == nil {
sv = &ConvertRecoveryPointToSnapshotOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "snapshot":
if err := awsAwsjson11_deserializeDocumentSnapshot(&sv.Snapshot, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentCreateEndpointAccessOutput(v **CreateEndpointAccessOutput, 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 *CreateEndpointAccessOutput
if *v == nil {
sv = &CreateEndpointAccessOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "endpoint":
if err := awsAwsjson11_deserializeDocumentEndpointAccess(&sv.Endpoint, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentCreateNamespaceOutput(v **CreateNamespaceOutput, 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 *CreateNamespaceOutput
if *v == nil {
sv = &CreateNamespaceOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "namespace":
if err := awsAwsjson11_deserializeDocumentNamespace(&sv.Namespace, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentCreateSnapshotOutput(v **CreateSnapshotOutput, 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 *CreateSnapshotOutput
if *v == nil {
sv = &CreateSnapshotOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "snapshot":
if err := awsAwsjson11_deserializeDocumentSnapshot(&sv.Snapshot, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentCreateUsageLimitOutput(v **CreateUsageLimitOutput, 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 *CreateUsageLimitOutput
if *v == nil {
sv = &CreateUsageLimitOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "usageLimit":
if err := awsAwsjson11_deserializeDocumentUsageLimit(&sv.UsageLimit, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentCreateWorkgroupOutput(v **CreateWorkgroupOutput, 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 *CreateWorkgroupOutput
if *v == nil {
sv = &CreateWorkgroupOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "workgroup":
if err := awsAwsjson11_deserializeDocumentWorkgroup(&sv.Workgroup, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentDeleteEndpointAccessOutput(v **DeleteEndpointAccessOutput, 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 *DeleteEndpointAccessOutput
if *v == nil {
sv = &DeleteEndpointAccessOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "endpoint":
if err := awsAwsjson11_deserializeDocumentEndpointAccess(&sv.Endpoint, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentDeleteNamespaceOutput(v **DeleteNamespaceOutput, 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 *DeleteNamespaceOutput
if *v == nil {
sv = &DeleteNamespaceOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "namespace":
if err := awsAwsjson11_deserializeDocumentNamespace(&sv.Namespace, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentDeleteResourcePolicyOutput(v **DeleteResourcePolicyOutput, 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 *DeleteResourcePolicyOutput
if *v == nil {
sv = &DeleteResourcePolicyOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentDeleteSnapshotOutput(v **DeleteSnapshotOutput, 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 *DeleteSnapshotOutput
if *v == nil {
sv = &DeleteSnapshotOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "snapshot":
if err := awsAwsjson11_deserializeDocumentSnapshot(&sv.Snapshot, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentDeleteUsageLimitOutput(v **DeleteUsageLimitOutput, 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 *DeleteUsageLimitOutput
if *v == nil {
sv = &DeleteUsageLimitOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "usageLimit":
if err := awsAwsjson11_deserializeDocumentUsageLimit(&sv.UsageLimit, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentDeleteWorkgroupOutput(v **DeleteWorkgroupOutput, 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 *DeleteWorkgroupOutput
if *v == nil {
sv = &DeleteWorkgroupOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "workgroup":
if err := awsAwsjson11_deserializeDocumentWorkgroup(&sv.Workgroup, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentGetCredentialsOutput(v **GetCredentialsOutput, 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 *GetCredentialsOutput
if *v == nil {
sv = &GetCredentialsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "dbPassword":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DbPassword to be of type string, got %T instead", value)
}
sv.DbPassword = ptr.String(jtv)
}
case "dbUser":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DbUser to be of type string, got %T instead", value)
}
sv.DbUser = ptr.String(jtv)
}
case "expiration":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.Expiration = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
case "nextRefreshTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.NextRefreshTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value)
}
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentGetEndpointAccessOutput(v **GetEndpointAccessOutput, 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 *GetEndpointAccessOutput
if *v == nil {
sv = &GetEndpointAccessOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "endpoint":
if err := awsAwsjson11_deserializeDocumentEndpointAccess(&sv.Endpoint, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentGetNamespaceOutput(v **GetNamespaceOutput, 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 *GetNamespaceOutput
if *v == nil {
sv = &GetNamespaceOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "namespace":
if err := awsAwsjson11_deserializeDocumentNamespace(&sv.Namespace, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentGetRecoveryPointOutput(v **GetRecoveryPointOutput, 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 *GetRecoveryPointOutput
if *v == nil {
sv = &GetRecoveryPointOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "recoveryPoint":
if err := awsAwsjson11_deserializeDocumentRecoveryPoint(&sv.RecoveryPoint, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
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 "resourcePolicy":
if err := awsAwsjson11_deserializeDocumentResourcePolicy(&sv.ResourcePolicy, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentGetSnapshotOutput(v **GetSnapshotOutput, 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 *GetSnapshotOutput
if *v == nil {
sv = &GetSnapshotOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "snapshot":
if err := awsAwsjson11_deserializeDocumentSnapshot(&sv.Snapshot, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentGetTableRestoreStatusOutput(v **GetTableRestoreStatusOutput, 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 *GetTableRestoreStatusOutput
if *v == nil {
sv = &GetTableRestoreStatusOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "tableRestoreStatus":
if err := awsAwsjson11_deserializeDocumentTableRestoreStatus(&sv.TableRestoreStatus, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentGetUsageLimitOutput(v **GetUsageLimitOutput, 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 *GetUsageLimitOutput
if *v == nil {
sv = &GetUsageLimitOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "usageLimit":
if err := awsAwsjson11_deserializeDocumentUsageLimit(&sv.UsageLimit, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentGetWorkgroupOutput(v **GetWorkgroupOutput, 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 *GetWorkgroupOutput
if *v == nil {
sv = &GetWorkgroupOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "workgroup":
if err := awsAwsjson11_deserializeDocumentWorkgroup(&sv.Workgroup, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentListEndpointAccessOutput(v **ListEndpointAccessOutput, 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 *ListEndpointAccessOutput
if *v == nil {
sv = &ListEndpointAccessOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "endpoints":
if err := awsAwsjson11_deserializeDocumentEndpointAccessList(&sv.Endpoints, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentListNamespacesOutput(v **ListNamespacesOutput, 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 *ListNamespacesOutput
if *v == nil {
sv = &ListNamespacesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "namespaces":
if err := awsAwsjson11_deserializeDocumentNamespaceList(&sv.Namespaces, value); err != nil {
return err
}
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentListRecoveryPointsOutput(v **ListRecoveryPointsOutput, 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 *ListRecoveryPointsOutput
if *v == nil {
sv = &ListRecoveryPointsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "recoveryPoints":
if err := awsAwsjson11_deserializeDocumentRecoveryPointList(&sv.RecoveryPoints, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentListSnapshotsOutput(v **ListSnapshotsOutput, 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 *ListSnapshotsOutput
if *v == nil {
sv = &ListSnapshotsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "snapshots":
if err := awsAwsjson11_deserializeDocumentSnapshotList(&sv.Snapshots, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentListTableRestoreStatusOutput(v **ListTableRestoreStatusOutput, 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 *ListTableRestoreStatusOutput
if *v == nil {
sv = &ListTableRestoreStatusOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "tableRestoreStatuses":
if err := awsAwsjson11_deserializeDocumentTableRestoreStatusList(&sv.TableRestoreStatuses, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, 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 *ListTagsForResourceOutput
if *v == nil {
sv = &ListTagsForResourceOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "tags":
if err := awsAwsjson11_deserializeDocumentTagList(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentListUsageLimitsOutput(v **ListUsageLimitsOutput, 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 *ListUsageLimitsOutput
if *v == nil {
sv = &ListUsageLimitsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "usageLimits":
if err := awsAwsjson11_deserializeDocumentUsageLimits(&sv.UsageLimits, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentListWorkgroupsOutput(v **ListWorkgroupsOutput, 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 *ListWorkgroupsOutput
if *v == nil {
sv = &ListWorkgroupsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "workgroups":
if err := awsAwsjson11_deserializeDocumentWorkgroupList(&sv.Workgroups, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentPutResourcePolicyOutput(v **PutResourcePolicyOutput, 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 *PutResourcePolicyOutput
if *v == nil {
sv = &PutResourcePolicyOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "resourcePolicy":
if err := awsAwsjson11_deserializeDocumentResourcePolicy(&sv.ResourcePolicy, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentRestoreFromRecoveryPointOutput(v **RestoreFromRecoveryPointOutput, 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 *RestoreFromRecoveryPointOutput
if *v == nil {
sv = &RestoreFromRecoveryPointOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "namespace":
if err := awsAwsjson11_deserializeDocumentNamespace(&sv.Namespace, value); err != nil {
return err
}
case "recoveryPointId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.RecoveryPointId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentRestoreFromSnapshotOutput(v **RestoreFromSnapshotOutput, 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 *RestoreFromSnapshotOutput
if *v == nil {
sv = &RestoreFromSnapshotOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "namespace":
if err := awsAwsjson11_deserializeDocumentNamespace(&sv.Namespace, value); err != nil {
return err
}
case "ownerAccount":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.OwnerAccount = ptr.String(jtv)
}
case "snapshotName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SnapshotName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentRestoreTableFromSnapshotOutput(v **RestoreTableFromSnapshotOutput, 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 *RestoreTableFromSnapshotOutput
if *v == nil {
sv = &RestoreTableFromSnapshotOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "tableRestoreStatus":
if err := awsAwsjson11_deserializeDocumentTableRestoreStatus(&sv.TableRestoreStatus, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentTagResourceOutput(v **TagResourceOutput, 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 *TagResourceOutput
if *v == nil {
sv = &TagResourceOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentUntagResourceOutput(v **UntagResourceOutput, 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 *UntagResourceOutput
if *v == nil {
sv = &UntagResourceOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentUpdateEndpointAccessOutput(v **UpdateEndpointAccessOutput, 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 *UpdateEndpointAccessOutput
if *v == nil {
sv = &UpdateEndpointAccessOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "endpoint":
if err := awsAwsjson11_deserializeDocumentEndpointAccess(&sv.Endpoint, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentUpdateNamespaceOutput(v **UpdateNamespaceOutput, 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 *UpdateNamespaceOutput
if *v == nil {
sv = &UpdateNamespaceOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "namespace":
if err := awsAwsjson11_deserializeDocumentNamespace(&sv.Namespace, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentUpdateSnapshotOutput(v **UpdateSnapshotOutput, 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 *UpdateSnapshotOutput
if *v == nil {
sv = &UpdateSnapshotOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "snapshot":
if err := awsAwsjson11_deserializeDocumentSnapshot(&sv.Snapshot, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentUpdateUsageLimitOutput(v **UpdateUsageLimitOutput, 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 *UpdateUsageLimitOutput
if *v == nil {
sv = &UpdateUsageLimitOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "usageLimit":
if err := awsAwsjson11_deserializeDocumentUsageLimit(&sv.UsageLimit, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsAwsjson11_deserializeOpDocumentUpdateWorkgroupOutput(v **UpdateWorkgroupOutput, 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 *UpdateWorkgroupOutput
if *v == nil {
sv = &UpdateWorkgroupOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "workgroup":
if err := awsAwsjson11_deserializeDocumentWorkgroup(&sv.Workgroup, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
| 9,244 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
// Package redshiftserverless provides the API client, operations, and parameter
// types for Redshift Serverless.
//
// This is an interface reference for Amazon Redshift Serverless. It contains
// documentation for one of the programming or command line interfaces you can use
// to manage Amazon Redshift Serverless. Amazon Redshift Serverless automatically
// provisions data warehouse capacity and intelligently scales the underlying
// resources based on workload demands. Amazon Redshift Serverless adjusts capacity
// in seconds to deliver consistently high performance and simplified operations
// for even the most demanding and volatile workloads. Amazon Redshift Serverless
// lets you focus on using your data to acquire new insights for your business and
// customers. To learn more about Amazon Redshift Serverless, see What is Amazon
// Redshift Serverless (https://docs.aws.amazon.com/redshift/latest/mgmt/serverless-whatis.html)
// .
package redshiftserverless
| 18 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"errors"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
internalendpoints "github.com/aws/aws-sdk-go-v2/service/redshiftserverless/internal/endpoints"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net/url"
"strings"
)
// EndpointResolverOptions is the service endpoint resolver options
type EndpointResolverOptions = internalendpoints.Options
// EndpointResolver interface for resolving service endpoints.
type EndpointResolver interface {
ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error)
}
var _ EndpointResolver = &internalendpoints.Resolver{}
// NewDefaultEndpointResolver constructs a new service endpoint resolver
func NewDefaultEndpointResolver() *internalendpoints.Resolver {
return internalendpoints.New()
}
// EndpointResolverFunc is a helper utility that wraps a function so it satisfies
// the EndpointResolver interface. This is useful when you want to add additional
// endpoint resolving logic, or stub out specific endpoints with custom values.
type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error)
func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
return fn(region, options)
}
func resolveDefaultEndpointConfiguration(o *Options) {
if o.EndpointResolver != nil {
return
}
o.EndpointResolver = NewDefaultEndpointResolver()
}
// EndpointResolverFromURL returns an EndpointResolver configured using the
// provided endpoint url. By default, the resolved endpoint resolver uses the
// client region as signing region, and the endpoint source is set to
// EndpointSourceCustom.You can provide functional options to configure endpoint
// values for the resolved endpoint.
func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver {
e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom}
for _, fn := range optFns {
fn(&e)
}
return EndpointResolverFunc(
func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
if len(e.SigningRegion) == 0 {
e.SigningRegion = region
}
return e, nil
},
)
}
type ResolveEndpoint struct {
Resolver EndpointResolver
Options EndpointResolverOptions
}
func (*ResolveEndpoint) ID() string {
return "ResolveEndpoint"
}
func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
req, ok := in.Request.(*smithyhttp.Request)
if !ok {
return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
}
if m.Resolver == nil {
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
}
eo := m.Options
eo.Logger = middleware.GetLogger(ctx)
var endpoint aws.Endpoint
endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo)
if err != nil {
return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
}
req.URL, err = url.Parse(endpoint.URL)
if err != nil {
return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err)
}
if len(awsmiddleware.GetSigningName(ctx)) == 0 {
signingName := endpoint.SigningName
if len(signingName) == 0 {
signingName = "redshift-serverless"
}
ctx = awsmiddleware.SetSigningName(ctx, signingName)
}
ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source)
ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable)
ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion)
ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID)
return next.HandleSerialize(ctx, in)
}
func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error {
return stack.Serialize.Insert(&ResolveEndpoint{
Resolver: o.EndpointResolver,
Options: o.EndpointOptions,
}, "OperationSerializer", middleware.Before)
}
func removeResolveEndpointMiddleware(stack *middleware.Stack) error {
_, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID())
return err
}
type wrappedEndpointResolver struct {
awsResolver aws.EndpointResolverWithOptions
resolver EndpointResolver
}
func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
if w.awsResolver == nil {
goto fallback
}
endpoint, err = w.awsResolver.ResolveEndpoint(ServiceID, region, options)
if err == nil {
return endpoint, nil
}
if nf := (&aws.EndpointNotFoundError{}); !errors.As(err, &nf) {
return endpoint, err
}
fallback:
if w.resolver == nil {
return endpoint, fmt.Errorf("default endpoint resolver provided was nil")
}
return w.resolver.ResolveEndpoint(region, options)
}
type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error)
func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) {
return a(service, region)
}
var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil)
// withEndpointResolver returns an EndpointResolver that first delegates endpoint resolution to the awsResolver.
// If awsResolver returns aws.EndpointNotFoundError error, the resolver will use the the provided
// fallbackResolver for resolution.
//
// fallbackResolver must not be nil
func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions, fallbackResolver EndpointResolver) EndpointResolver {
var resolver aws.EndpointResolverWithOptions
if awsResolverWithOptions != nil {
resolver = awsResolverWithOptions
} else if awsResolver != nil {
resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint)
}
return &wrappedEndpointResolver{
awsResolver: resolver,
resolver: fallbackResolver,
}
}
func finalizeClientEndpointResolverOptions(options *Options) {
options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage()
if len(options.EndpointOptions.ResolvedRegion) == 0 {
const fipsInfix = "-fips-"
const fipsPrefix = "fips-"
const fipsSuffix = "-fips"
if strings.Contains(options.Region, fipsInfix) ||
strings.Contains(options.Region, fipsPrefix) ||
strings.Contains(options.Region, fipsSuffix) {
options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(
options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "")
options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled
}
}
}
| 201 |
aws-sdk-go-v2 | aws | Go | // Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT.
package redshiftserverless
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.4.14"
| 7 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
| 4 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"bytes"
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/encoding/httpbinding"
smithyjson "github.com/aws/smithy-go/encoding/json"
"github.com/aws/smithy-go/middleware"
smithytime "github.com/aws/smithy-go/time"
smithyhttp "github.com/aws/smithy-go/transport/http"
"path"
)
type awsAwsjson11_serializeOpConvertRecoveryPointToSnapshot struct {
}
func (*awsAwsjson11_serializeOpConvertRecoveryPointToSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpConvertRecoveryPointToSnapshot) 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.(*ConvertRecoveryPointToSnapshotInput)
_ = 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("RedshiftServerless.ConvertRecoveryPointToSnapshot")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentConvertRecoveryPointToSnapshotInput(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_serializeOpCreateEndpointAccess struct {
}
func (*awsAwsjson11_serializeOpCreateEndpointAccess) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpCreateEndpointAccess) 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.(*CreateEndpointAccessInput)
_ = 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("RedshiftServerless.CreateEndpointAccess")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentCreateEndpointAccessInput(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_serializeOpCreateNamespace struct {
}
func (*awsAwsjson11_serializeOpCreateNamespace) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpCreateNamespace) 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.(*CreateNamespaceInput)
_ = 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("RedshiftServerless.CreateNamespace")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentCreateNamespaceInput(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_serializeOpCreateSnapshot struct {
}
func (*awsAwsjson11_serializeOpCreateSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpCreateSnapshot) 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.(*CreateSnapshotInput)
_ = 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("RedshiftServerless.CreateSnapshot")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentCreateSnapshotInput(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_serializeOpCreateUsageLimit struct {
}
func (*awsAwsjson11_serializeOpCreateUsageLimit) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpCreateUsageLimit) 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.(*CreateUsageLimitInput)
_ = 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("RedshiftServerless.CreateUsageLimit")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentCreateUsageLimitInput(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_serializeOpCreateWorkgroup struct {
}
func (*awsAwsjson11_serializeOpCreateWorkgroup) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpCreateWorkgroup) 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.(*CreateWorkgroupInput)
_ = 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("RedshiftServerless.CreateWorkgroup")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentCreateWorkgroupInput(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_serializeOpDeleteEndpointAccess struct {
}
func (*awsAwsjson11_serializeOpDeleteEndpointAccess) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpDeleteEndpointAccess) 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.(*DeleteEndpointAccessInput)
_ = 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("RedshiftServerless.DeleteEndpointAccess")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentDeleteEndpointAccessInput(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_serializeOpDeleteNamespace struct {
}
func (*awsAwsjson11_serializeOpDeleteNamespace) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpDeleteNamespace) 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.(*DeleteNamespaceInput)
_ = 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("RedshiftServerless.DeleteNamespace")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentDeleteNamespaceInput(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_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("RedshiftServerless.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_serializeOpDeleteSnapshot struct {
}
func (*awsAwsjson11_serializeOpDeleteSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpDeleteSnapshot) 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.(*DeleteSnapshotInput)
_ = 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("RedshiftServerless.DeleteSnapshot")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentDeleteSnapshotInput(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_serializeOpDeleteUsageLimit struct {
}
func (*awsAwsjson11_serializeOpDeleteUsageLimit) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpDeleteUsageLimit) 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.(*DeleteUsageLimitInput)
_ = 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("RedshiftServerless.DeleteUsageLimit")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentDeleteUsageLimitInput(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_serializeOpDeleteWorkgroup struct {
}
func (*awsAwsjson11_serializeOpDeleteWorkgroup) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpDeleteWorkgroup) 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.(*DeleteWorkgroupInput)
_ = 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("RedshiftServerless.DeleteWorkgroup")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentDeleteWorkgroupInput(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_serializeOpGetCredentials struct {
}
func (*awsAwsjson11_serializeOpGetCredentials) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpGetCredentials) 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.(*GetCredentialsInput)
_ = 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("RedshiftServerless.GetCredentials")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentGetCredentialsInput(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_serializeOpGetEndpointAccess struct {
}
func (*awsAwsjson11_serializeOpGetEndpointAccess) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpGetEndpointAccess) 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.(*GetEndpointAccessInput)
_ = 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("RedshiftServerless.GetEndpointAccess")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentGetEndpointAccessInput(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_serializeOpGetNamespace struct {
}
func (*awsAwsjson11_serializeOpGetNamespace) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpGetNamespace) 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.(*GetNamespaceInput)
_ = 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("RedshiftServerless.GetNamespace")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentGetNamespaceInput(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_serializeOpGetRecoveryPoint struct {
}
func (*awsAwsjson11_serializeOpGetRecoveryPoint) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpGetRecoveryPoint) 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.(*GetRecoveryPointInput)
_ = 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("RedshiftServerless.GetRecoveryPoint")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentGetRecoveryPointInput(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_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("RedshiftServerless.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_serializeOpGetSnapshot struct {
}
func (*awsAwsjson11_serializeOpGetSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpGetSnapshot) 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.(*GetSnapshotInput)
_ = 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("RedshiftServerless.GetSnapshot")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentGetSnapshotInput(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_serializeOpGetTableRestoreStatus struct {
}
func (*awsAwsjson11_serializeOpGetTableRestoreStatus) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpGetTableRestoreStatus) 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.(*GetTableRestoreStatusInput)
_ = 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("RedshiftServerless.GetTableRestoreStatus")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentGetTableRestoreStatusInput(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_serializeOpGetUsageLimit struct {
}
func (*awsAwsjson11_serializeOpGetUsageLimit) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpGetUsageLimit) 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.(*GetUsageLimitInput)
_ = 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("RedshiftServerless.GetUsageLimit")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentGetUsageLimitInput(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_serializeOpGetWorkgroup struct {
}
func (*awsAwsjson11_serializeOpGetWorkgroup) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpGetWorkgroup) 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.(*GetWorkgroupInput)
_ = 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("RedshiftServerless.GetWorkgroup")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentGetWorkgroupInput(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_serializeOpListEndpointAccess struct {
}
func (*awsAwsjson11_serializeOpListEndpointAccess) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpListEndpointAccess) 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.(*ListEndpointAccessInput)
_ = 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("RedshiftServerless.ListEndpointAccess")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentListEndpointAccessInput(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_serializeOpListNamespaces struct {
}
func (*awsAwsjson11_serializeOpListNamespaces) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpListNamespaces) 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.(*ListNamespacesInput)
_ = 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("RedshiftServerless.ListNamespaces")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentListNamespacesInput(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_serializeOpListRecoveryPoints struct {
}
func (*awsAwsjson11_serializeOpListRecoveryPoints) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpListRecoveryPoints) 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.(*ListRecoveryPointsInput)
_ = 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("RedshiftServerless.ListRecoveryPoints")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentListRecoveryPointsInput(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_serializeOpListSnapshots struct {
}
func (*awsAwsjson11_serializeOpListSnapshots) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpListSnapshots) 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.(*ListSnapshotsInput)
_ = 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("RedshiftServerless.ListSnapshots")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentListSnapshotsInput(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_serializeOpListTableRestoreStatus struct {
}
func (*awsAwsjson11_serializeOpListTableRestoreStatus) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpListTableRestoreStatus) 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.(*ListTableRestoreStatusInput)
_ = 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("RedshiftServerless.ListTableRestoreStatus")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentListTableRestoreStatusInput(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_serializeOpListTagsForResource struct {
}
func (*awsAwsjson11_serializeOpListTagsForResource) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpListTagsForResource) 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.(*ListTagsForResourceInput)
_ = 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("RedshiftServerless.ListTagsForResource")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentListTagsForResourceInput(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_serializeOpListUsageLimits struct {
}
func (*awsAwsjson11_serializeOpListUsageLimits) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpListUsageLimits) 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.(*ListUsageLimitsInput)
_ = 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("RedshiftServerless.ListUsageLimits")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentListUsageLimitsInput(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_serializeOpListWorkgroups struct {
}
func (*awsAwsjson11_serializeOpListWorkgroups) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpListWorkgroups) 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.(*ListWorkgroupsInput)
_ = 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("RedshiftServerless.ListWorkgroups")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentListWorkgroupsInput(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_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("RedshiftServerless.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_serializeOpRestoreFromRecoveryPoint struct {
}
func (*awsAwsjson11_serializeOpRestoreFromRecoveryPoint) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpRestoreFromRecoveryPoint) 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.(*RestoreFromRecoveryPointInput)
_ = 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("RedshiftServerless.RestoreFromRecoveryPoint")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentRestoreFromRecoveryPointInput(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_serializeOpRestoreFromSnapshot struct {
}
func (*awsAwsjson11_serializeOpRestoreFromSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpRestoreFromSnapshot) 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.(*RestoreFromSnapshotInput)
_ = 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("RedshiftServerless.RestoreFromSnapshot")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentRestoreFromSnapshotInput(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_serializeOpRestoreTableFromSnapshot struct {
}
func (*awsAwsjson11_serializeOpRestoreTableFromSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpRestoreTableFromSnapshot) 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.(*RestoreTableFromSnapshotInput)
_ = 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("RedshiftServerless.RestoreTableFromSnapshot")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentRestoreTableFromSnapshotInput(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_serializeOpTagResource struct {
}
func (*awsAwsjson11_serializeOpTagResource) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpTagResource) 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.(*TagResourceInput)
_ = 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("RedshiftServerless.TagResource")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentTagResourceInput(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_serializeOpUntagResource struct {
}
func (*awsAwsjson11_serializeOpUntagResource) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpUntagResource) 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.(*UntagResourceInput)
_ = 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("RedshiftServerless.UntagResource")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentUntagResourceInput(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_serializeOpUpdateEndpointAccess struct {
}
func (*awsAwsjson11_serializeOpUpdateEndpointAccess) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpUpdateEndpointAccess) 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.(*UpdateEndpointAccessInput)
_ = 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("RedshiftServerless.UpdateEndpointAccess")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentUpdateEndpointAccessInput(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_serializeOpUpdateNamespace struct {
}
func (*awsAwsjson11_serializeOpUpdateNamespace) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpUpdateNamespace) 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.(*UpdateNamespaceInput)
_ = 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("RedshiftServerless.UpdateNamespace")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentUpdateNamespaceInput(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_serializeOpUpdateSnapshot struct {
}
func (*awsAwsjson11_serializeOpUpdateSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpUpdateSnapshot) 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.(*UpdateSnapshotInput)
_ = 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("RedshiftServerless.UpdateSnapshot")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentUpdateSnapshotInput(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_serializeOpUpdateUsageLimit struct {
}
func (*awsAwsjson11_serializeOpUpdateUsageLimit) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpUpdateUsageLimit) 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.(*UpdateUsageLimitInput)
_ = 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("RedshiftServerless.UpdateUsageLimit")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentUpdateUsageLimitInput(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_serializeOpUpdateWorkgroup struct {
}
func (*awsAwsjson11_serializeOpUpdateWorkgroup) ID() string {
return "OperationSerializer"
}
func (m *awsAwsjson11_serializeOpUpdateWorkgroup) 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.(*UpdateWorkgroupInput)
_ = 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("RedshiftServerless.UpdateWorkgroup")
jsonEncoder := smithyjson.NewEncoder()
if err := awsAwsjson11_serializeOpDocumentUpdateWorkgroupInput(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)
}
func awsAwsjson11_serializeDocumentConfigParameter(v *types.ConfigParameter, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ParameterKey != nil {
ok := object.Key("parameterKey")
ok.String(*v.ParameterKey)
}
if v.ParameterValue != nil {
ok := object.Key("parameterValue")
ok.String(*v.ParameterValue)
}
return nil
}
func awsAwsjson11_serializeDocumentConfigParameterList(v []types.ConfigParameter, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsAwsjson11_serializeDocumentConfigParameter(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsAwsjson11_serializeDocumentIamRoleArnList(v []string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(v[i])
}
return nil
}
func awsAwsjson11_serializeDocumentLogExportList(v []types.LogExport, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(string(v[i]))
}
return nil
}
func awsAwsjson11_serializeDocumentSecurityGroupIdList(v []string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(v[i])
}
return nil
}
func awsAwsjson11_serializeDocumentSubnetIdList(v []string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(v[i])
}
return nil
}
func awsAwsjson11_serializeDocumentTag(v *types.Tag, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Key != nil {
ok := object.Key("key")
ok.String(*v.Key)
}
if v.Value != nil {
ok := object.Key("value")
ok.String(*v.Value)
}
return nil
}
func awsAwsjson11_serializeDocumentTagKeyList(v []string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(v[i])
}
return nil
}
func awsAwsjson11_serializeDocumentTagList(v []types.Tag, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsAwsjson11_serializeDocumentTag(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsAwsjson11_serializeDocumentVpcSecurityGroupIdList(v []string, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
av.String(v[i])
}
return nil
}
func awsAwsjson11_serializeOpDocumentConvertRecoveryPointToSnapshotInput(v *ConvertRecoveryPointToSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.RecoveryPointId != nil {
ok := object.Key("recoveryPointId")
ok.String(*v.RecoveryPointId)
}
if v.RetentionPeriod != nil {
ok := object.Key("retentionPeriod")
ok.Integer(*v.RetentionPeriod)
}
if v.SnapshotName != nil {
ok := object.Key("snapshotName")
ok.String(*v.SnapshotName)
}
if v.Tags != nil {
ok := object.Key("tags")
if err := awsAwsjson11_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
return nil
}
func awsAwsjson11_serializeOpDocumentCreateEndpointAccessInput(v *CreateEndpointAccessInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.EndpointName != nil {
ok := object.Key("endpointName")
ok.String(*v.EndpointName)
}
if v.SubnetIds != nil {
ok := object.Key("subnetIds")
if err := awsAwsjson11_serializeDocumentSubnetIdList(v.SubnetIds, ok); err != nil {
return err
}
}
if v.VpcSecurityGroupIds != nil {
ok := object.Key("vpcSecurityGroupIds")
if err := awsAwsjson11_serializeDocumentVpcSecurityGroupIdList(v.VpcSecurityGroupIds, ok); err != nil {
return err
}
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentCreateNamespaceInput(v *CreateNamespaceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.AdminUsername != nil {
ok := object.Key("adminUsername")
ok.String(*v.AdminUsername)
}
if v.AdminUserPassword != nil {
ok := object.Key("adminUserPassword")
ok.String(*v.AdminUserPassword)
}
if v.DbName != nil {
ok := object.Key("dbName")
ok.String(*v.DbName)
}
if v.DefaultIamRoleArn != nil {
ok := object.Key("defaultIamRoleArn")
ok.String(*v.DefaultIamRoleArn)
}
if v.IamRoles != nil {
ok := object.Key("iamRoles")
if err := awsAwsjson11_serializeDocumentIamRoleArnList(v.IamRoles, ok); err != nil {
return err
}
}
if v.KmsKeyId != nil {
ok := object.Key("kmsKeyId")
ok.String(*v.KmsKeyId)
}
if v.LogExports != nil {
ok := object.Key("logExports")
if err := awsAwsjson11_serializeDocumentLogExportList(v.LogExports, ok); err != nil {
return err
}
}
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.Tags != nil {
ok := object.Key("tags")
if err := awsAwsjson11_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
return nil
}
func awsAwsjson11_serializeOpDocumentCreateSnapshotInput(v *CreateSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.RetentionPeriod != nil {
ok := object.Key("retentionPeriod")
ok.Integer(*v.RetentionPeriod)
}
if v.SnapshotName != nil {
ok := object.Key("snapshotName")
ok.String(*v.SnapshotName)
}
if v.Tags != nil {
ok := object.Key("tags")
if err := awsAwsjson11_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
return nil
}
func awsAwsjson11_serializeOpDocumentCreateUsageLimitInput(v *CreateUsageLimitInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Amount != nil {
ok := object.Key("amount")
ok.Long(*v.Amount)
}
if len(v.BreachAction) > 0 {
ok := object.Key("breachAction")
ok.String(string(v.BreachAction))
}
if len(v.Period) > 0 {
ok := object.Key("period")
ok.String(string(v.Period))
}
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if len(v.UsageType) > 0 {
ok := object.Key("usageType")
ok.String(string(v.UsageType))
}
return nil
}
func awsAwsjson11_serializeOpDocumentCreateWorkgroupInput(v *CreateWorkgroupInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.BaseCapacity != nil {
ok := object.Key("baseCapacity")
ok.Integer(*v.BaseCapacity)
}
if v.ConfigParameters != nil {
ok := object.Key("configParameters")
if err := awsAwsjson11_serializeDocumentConfigParameterList(v.ConfigParameters, ok); err != nil {
return err
}
}
if v.EnhancedVpcRouting != nil {
ok := object.Key("enhancedVpcRouting")
ok.Boolean(*v.EnhancedVpcRouting)
}
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.Port != nil {
ok := object.Key("port")
ok.Integer(*v.Port)
}
if v.PubliclyAccessible != nil {
ok := object.Key("publiclyAccessible")
ok.Boolean(*v.PubliclyAccessible)
}
if v.SecurityGroupIds != nil {
ok := object.Key("securityGroupIds")
if err := awsAwsjson11_serializeDocumentSecurityGroupIdList(v.SecurityGroupIds, ok); err != nil {
return err
}
}
if v.SubnetIds != nil {
ok := object.Key("subnetIds")
if err := awsAwsjson11_serializeDocumentSubnetIdList(v.SubnetIds, ok); err != nil {
return err
}
}
if v.Tags != nil {
ok := object.Key("tags")
if err := awsAwsjson11_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentDeleteEndpointAccessInput(v *DeleteEndpointAccessInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.EndpointName != nil {
ok := object.Key("endpointName")
ok.String(*v.EndpointName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentDeleteNamespaceInput(v *DeleteNamespaceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.FinalSnapshotName != nil {
ok := object.Key("finalSnapshotName")
ok.String(*v.FinalSnapshotName)
}
if v.FinalSnapshotRetentionPeriod != nil {
ok := object.Key("finalSnapshotRetentionPeriod")
ok.Integer(*v.FinalSnapshotRetentionPeriod)
}
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
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_serializeOpDocumentDeleteSnapshotInput(v *DeleteSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.SnapshotName != nil {
ok := object.Key("snapshotName")
ok.String(*v.SnapshotName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentDeleteUsageLimitInput(v *DeleteUsageLimitInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.UsageLimitId != nil {
ok := object.Key("usageLimitId")
ok.String(*v.UsageLimitId)
}
return nil
}
func awsAwsjson11_serializeOpDocumentDeleteWorkgroupInput(v *DeleteWorkgroupInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentGetCredentialsInput(v *GetCredentialsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.DbName != nil {
ok := object.Key("dbName")
ok.String(*v.DbName)
}
if v.DurationSeconds != nil {
ok := object.Key("durationSeconds")
ok.Integer(*v.DurationSeconds)
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentGetEndpointAccessInput(v *GetEndpointAccessInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.EndpointName != nil {
ok := object.Key("endpointName")
ok.String(*v.EndpointName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentGetNamespaceInput(v *GetNamespaceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentGetRecoveryPointInput(v *GetRecoveryPointInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.RecoveryPointId != nil {
ok := object.Key("recoveryPointId")
ok.String(*v.RecoveryPointId)
}
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_serializeOpDocumentGetSnapshotInput(v *GetSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.OwnerAccount != nil {
ok := object.Key("ownerAccount")
ok.String(*v.OwnerAccount)
}
if v.SnapshotArn != nil {
ok := object.Key("snapshotArn")
ok.String(*v.SnapshotArn)
}
if v.SnapshotName != nil {
ok := object.Key("snapshotName")
ok.String(*v.SnapshotName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentGetTableRestoreStatusInput(v *GetTableRestoreStatusInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.TableRestoreRequestId != nil {
ok := object.Key("tableRestoreRequestId")
ok.String(*v.TableRestoreRequestId)
}
return nil
}
func awsAwsjson11_serializeOpDocumentGetUsageLimitInput(v *GetUsageLimitInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.UsageLimitId != nil {
ok := object.Key("usageLimitId")
ok.String(*v.UsageLimitId)
}
return nil
}
func awsAwsjson11_serializeOpDocumentGetWorkgroupInput(v *GetWorkgroupInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentListEndpointAccessInput(v *ListEndpointAccessInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.VpcId != nil {
ok := object.Key("vpcId")
ok.String(*v.VpcId)
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentListNamespacesInput(v *ListNamespacesInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
return nil
}
func awsAwsjson11_serializeOpDocumentListRecoveryPointsInput(v *ListRecoveryPointsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.EndTime != nil {
ok := object.Key("endTime")
ok.Double(smithytime.FormatEpochSeconds(*v.EndTime))
}
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NamespaceArn != nil {
ok := object.Key("namespaceArn")
ok.String(*v.NamespaceArn)
}
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.StartTime != nil {
ok := object.Key("startTime")
ok.Double(smithytime.FormatEpochSeconds(*v.StartTime))
}
return nil
}
func awsAwsjson11_serializeOpDocumentListSnapshotsInput(v *ListSnapshotsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.EndTime != nil {
ok := object.Key("endTime")
ok.Double(smithytime.FormatEpochSeconds(*v.EndTime))
}
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NamespaceArn != nil {
ok := object.Key("namespaceArn")
ok.String(*v.NamespaceArn)
}
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.OwnerAccount != nil {
ok := object.Key("ownerAccount")
ok.String(*v.OwnerAccount)
}
if v.StartTime != nil {
ok := object.Key("startTime")
ok.Double(smithytime.FormatEpochSeconds(*v.StartTime))
}
return nil
}
func awsAwsjson11_serializeOpDocumentListTableRestoreStatusInput(v *ListTableRestoreStatusInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentListTagsForResourceInput(v *ListTagsForResourceInput, 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_serializeOpDocumentListUsageLimitsInput(v *ListUsageLimitsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if len(v.UsageType) > 0 {
ok := object.Key("usageType")
ok.String(string(v.UsageType))
}
return nil
}
func awsAwsjson11_serializeOpDocumentListWorkgroupsInput(v *ListWorkgroupsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
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_serializeOpDocumentRestoreFromRecoveryPointInput(v *RestoreFromRecoveryPointInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.RecoveryPointId != nil {
ok := object.Key("recoveryPointId")
ok.String(*v.RecoveryPointId)
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentRestoreFromSnapshotInput(v *RestoreFromSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.OwnerAccount != nil {
ok := object.Key("ownerAccount")
ok.String(*v.OwnerAccount)
}
if v.SnapshotArn != nil {
ok := object.Key("snapshotArn")
ok.String(*v.SnapshotArn)
}
if v.SnapshotName != nil {
ok := object.Key("snapshotName")
ok.String(*v.SnapshotName)
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentRestoreTableFromSnapshotInput(v *RestoreTableFromSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ActivateCaseSensitiveIdentifier != nil {
ok := object.Key("activateCaseSensitiveIdentifier")
ok.Boolean(*v.ActivateCaseSensitiveIdentifier)
}
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
if v.NewTableName != nil {
ok := object.Key("newTableName")
ok.String(*v.NewTableName)
}
if v.SnapshotName != nil {
ok := object.Key("snapshotName")
ok.String(*v.SnapshotName)
}
if v.SourceDatabaseName != nil {
ok := object.Key("sourceDatabaseName")
ok.String(*v.SourceDatabaseName)
}
if v.SourceSchemaName != nil {
ok := object.Key("sourceSchemaName")
ok.String(*v.SourceSchemaName)
}
if v.SourceTableName != nil {
ok := object.Key("sourceTableName")
ok.String(*v.SourceTableName)
}
if v.TargetDatabaseName != nil {
ok := object.Key("targetDatabaseName")
ok.String(*v.TargetDatabaseName)
}
if v.TargetSchemaName != nil {
ok := object.Key("targetSchemaName")
ok.String(*v.TargetSchemaName)
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentTagResourceInput(v *TagResourceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.Tags != nil {
ok := object.Key("tags")
if err := awsAwsjson11_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
return nil
}
func awsAwsjson11_serializeOpDocumentUntagResourceInput(v *UntagResourceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.TagKeys != nil {
ok := object.Key("tagKeys")
if err := awsAwsjson11_serializeDocumentTagKeyList(v.TagKeys, ok); err != nil {
return err
}
}
return nil
}
func awsAwsjson11_serializeOpDocumentUpdateEndpointAccessInput(v *UpdateEndpointAccessInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.EndpointName != nil {
ok := object.Key("endpointName")
ok.String(*v.EndpointName)
}
if v.VpcSecurityGroupIds != nil {
ok := object.Key("vpcSecurityGroupIds")
if err := awsAwsjson11_serializeDocumentVpcSecurityGroupIdList(v.VpcSecurityGroupIds, ok); err != nil {
return err
}
}
return nil
}
func awsAwsjson11_serializeOpDocumentUpdateNamespaceInput(v *UpdateNamespaceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.AdminUsername != nil {
ok := object.Key("adminUsername")
ok.String(*v.AdminUsername)
}
if v.AdminUserPassword != nil {
ok := object.Key("adminUserPassword")
ok.String(*v.AdminUserPassword)
}
if v.DefaultIamRoleArn != nil {
ok := object.Key("defaultIamRoleArn")
ok.String(*v.DefaultIamRoleArn)
}
if v.IamRoles != nil {
ok := object.Key("iamRoles")
if err := awsAwsjson11_serializeDocumentIamRoleArnList(v.IamRoles, ok); err != nil {
return err
}
}
if v.KmsKeyId != nil {
ok := object.Key("kmsKeyId")
ok.String(*v.KmsKeyId)
}
if v.LogExports != nil {
ok := object.Key("logExports")
if err := awsAwsjson11_serializeDocumentLogExportList(v.LogExports, ok); err != nil {
return err
}
}
if v.NamespaceName != nil {
ok := object.Key("namespaceName")
ok.String(*v.NamespaceName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentUpdateSnapshotInput(v *UpdateSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.RetentionPeriod != nil {
ok := object.Key("retentionPeriod")
ok.Integer(*v.RetentionPeriod)
}
if v.SnapshotName != nil {
ok := object.Key("snapshotName")
ok.String(*v.SnapshotName)
}
return nil
}
func awsAwsjson11_serializeOpDocumentUpdateUsageLimitInput(v *UpdateUsageLimitInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Amount != nil {
ok := object.Key("amount")
ok.Long(*v.Amount)
}
if len(v.BreachAction) > 0 {
ok := object.Key("breachAction")
ok.String(string(v.BreachAction))
}
if v.UsageLimitId != nil {
ok := object.Key("usageLimitId")
ok.String(*v.UsageLimitId)
}
return nil
}
func awsAwsjson11_serializeOpDocumentUpdateWorkgroupInput(v *UpdateWorkgroupInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.BaseCapacity != nil {
ok := object.Key("baseCapacity")
ok.Integer(*v.BaseCapacity)
}
if v.ConfigParameters != nil {
ok := object.Key("configParameters")
if err := awsAwsjson11_serializeDocumentConfigParameterList(v.ConfigParameters, ok); err != nil {
return err
}
}
if v.EnhancedVpcRouting != nil {
ok := object.Key("enhancedVpcRouting")
ok.Boolean(*v.EnhancedVpcRouting)
}
if v.Port != nil {
ok := object.Key("port")
ok.Integer(*v.Port)
}
if v.PubliclyAccessible != nil {
ok := object.Key("publiclyAccessible")
ok.Boolean(*v.PubliclyAccessible)
}
if v.SecurityGroupIds != nil {
ok := object.Key("securityGroupIds")
if err := awsAwsjson11_serializeDocumentSecurityGroupIdList(v.SecurityGroupIds, ok); err != nil {
return err
}
}
if v.SubnetIds != nil {
ok := object.Key("subnetIds")
if err := awsAwsjson11_serializeDocumentSubnetIdList(v.SubnetIds, ok); err != nil {
return err
}
}
if v.WorkgroupName != nil {
ok := object.Key("workgroupName")
ok.String(*v.WorkgroupName)
}
return nil
}
| 3,326 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package redshiftserverless
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/redshiftserverless/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
)
type validateOpConvertRecoveryPointToSnapshot struct {
}
func (*validateOpConvertRecoveryPointToSnapshot) ID() string {
return "OperationInputValidation"
}
func (m *validateOpConvertRecoveryPointToSnapshot) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ConvertRecoveryPointToSnapshotInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpConvertRecoveryPointToSnapshotInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreateEndpointAccess struct {
}
func (*validateOpCreateEndpointAccess) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateEndpointAccess) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateEndpointAccessInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateEndpointAccessInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreateNamespace struct {
}
func (*validateOpCreateNamespace) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateNamespace) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateNamespaceInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateNamespaceInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreateSnapshot struct {
}
func (*validateOpCreateSnapshot) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateSnapshot) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateSnapshotInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateSnapshotInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreateUsageLimit struct {
}
func (*validateOpCreateUsageLimit) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateUsageLimit) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateUsageLimitInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateUsageLimitInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreateWorkgroup struct {
}
func (*validateOpCreateWorkgroup) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateWorkgroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateWorkgroupInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateWorkgroupInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteEndpointAccess struct {
}
func (*validateOpDeleteEndpointAccess) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteEndpointAccess) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteEndpointAccessInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteEndpointAccessInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteNamespace struct {
}
func (*validateOpDeleteNamespace) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteNamespace) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteNamespaceInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteNamespaceInput(input); err != nil {
return out, metadata, err
}
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 validateOpDeleteSnapshot struct {
}
func (*validateOpDeleteSnapshot) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteSnapshot) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteSnapshotInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteSnapshotInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteUsageLimit struct {
}
func (*validateOpDeleteUsageLimit) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteUsageLimit) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteUsageLimitInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteUsageLimitInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteWorkgroup struct {
}
func (*validateOpDeleteWorkgroup) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteWorkgroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteWorkgroupInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteWorkgroupInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetCredentials struct {
}
func (*validateOpGetCredentials) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetCredentials) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetCredentialsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetCredentialsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetEndpointAccess struct {
}
func (*validateOpGetEndpointAccess) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetEndpointAccess) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetEndpointAccessInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetEndpointAccessInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetNamespace struct {
}
func (*validateOpGetNamespace) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetNamespace) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetNamespaceInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetNamespaceInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetRecoveryPoint struct {
}
func (*validateOpGetRecoveryPoint) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetRecoveryPoint) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetRecoveryPointInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetRecoveryPointInput(input); err != nil {
return out, metadata, err
}
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 validateOpGetTableRestoreStatus struct {
}
func (*validateOpGetTableRestoreStatus) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetTableRestoreStatus) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetTableRestoreStatusInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetTableRestoreStatusInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetUsageLimit struct {
}
func (*validateOpGetUsageLimit) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetUsageLimit) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetUsageLimitInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetUsageLimitInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetWorkgroup struct {
}
func (*validateOpGetWorkgroup) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetWorkgroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetWorkgroupInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetWorkgroupInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListTagsForResource struct {
}
func (*validateOpListTagsForResource) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListTagsForResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListTagsForResourceInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListTagsForResourceInput(input); err != nil {
return out, metadata, err
}
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 validateOpRestoreFromRecoveryPoint struct {
}
func (*validateOpRestoreFromRecoveryPoint) ID() string {
return "OperationInputValidation"
}
func (m *validateOpRestoreFromRecoveryPoint) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*RestoreFromRecoveryPointInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpRestoreFromRecoveryPointInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpRestoreFromSnapshot struct {
}
func (*validateOpRestoreFromSnapshot) ID() string {
return "OperationInputValidation"
}
func (m *validateOpRestoreFromSnapshot) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*RestoreFromSnapshotInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpRestoreFromSnapshotInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpRestoreTableFromSnapshot struct {
}
func (*validateOpRestoreTableFromSnapshot) ID() string {
return "OperationInputValidation"
}
func (m *validateOpRestoreTableFromSnapshot) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*RestoreTableFromSnapshotInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpRestoreTableFromSnapshotInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpTagResource struct {
}
func (*validateOpTagResource) ID() string {
return "OperationInputValidation"
}
func (m *validateOpTagResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*TagResourceInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpTagResourceInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUntagResource struct {
}
func (*validateOpUntagResource) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUntagResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UntagResourceInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUntagResourceInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUpdateEndpointAccess struct {
}
func (*validateOpUpdateEndpointAccess) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateEndpointAccess) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateEndpointAccessInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateEndpointAccessInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUpdateNamespace struct {
}
func (*validateOpUpdateNamespace) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateNamespace) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateNamespaceInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateNamespaceInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUpdateSnapshot struct {
}
func (*validateOpUpdateSnapshot) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateSnapshot) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateSnapshotInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateSnapshotInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUpdateUsageLimit struct {
}
func (*validateOpUpdateUsageLimit) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateUsageLimit) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateUsageLimitInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateUsageLimitInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUpdateWorkgroup struct {
}
func (*validateOpUpdateWorkgroup) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateWorkgroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateWorkgroupInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateWorkgroupInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
func addOpConvertRecoveryPointToSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpConvertRecoveryPointToSnapshot{}, middleware.After)
}
func addOpCreateEndpointAccessValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateEndpointAccess{}, middleware.After)
}
func addOpCreateNamespaceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateNamespace{}, middleware.After)
}
func addOpCreateSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateSnapshot{}, middleware.After)
}
func addOpCreateUsageLimitValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateUsageLimit{}, middleware.After)
}
func addOpCreateWorkgroupValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateWorkgroup{}, middleware.After)
}
func addOpDeleteEndpointAccessValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteEndpointAccess{}, middleware.After)
}
func addOpDeleteNamespaceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteNamespace{}, middleware.After)
}
func addOpDeleteResourcePolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteResourcePolicy{}, middleware.After)
}
func addOpDeleteSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteSnapshot{}, middleware.After)
}
func addOpDeleteUsageLimitValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteUsageLimit{}, middleware.After)
}
func addOpDeleteWorkgroupValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteWorkgroup{}, middleware.After)
}
func addOpGetCredentialsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetCredentials{}, middleware.After)
}
func addOpGetEndpointAccessValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetEndpointAccess{}, middleware.After)
}
func addOpGetNamespaceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetNamespace{}, middleware.After)
}
func addOpGetRecoveryPointValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetRecoveryPoint{}, middleware.After)
}
func addOpGetResourcePolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetResourcePolicy{}, middleware.After)
}
func addOpGetTableRestoreStatusValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetTableRestoreStatus{}, middleware.After)
}
func addOpGetUsageLimitValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetUsageLimit{}, middleware.After)
}
func addOpGetWorkgroupValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetWorkgroup{}, middleware.After)
}
func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After)
}
func addOpPutResourcePolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpPutResourcePolicy{}, middleware.After)
}
func addOpRestoreFromRecoveryPointValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpRestoreFromRecoveryPoint{}, middleware.After)
}
func addOpRestoreFromSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpRestoreFromSnapshot{}, middleware.After)
}
func addOpRestoreTableFromSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpRestoreTableFromSnapshot{}, middleware.After)
}
func addOpTagResourceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpTagResource{}, middleware.After)
}
func addOpUntagResourceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUntagResource{}, middleware.After)
}
func addOpUpdateEndpointAccessValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateEndpointAccess{}, middleware.After)
}
func addOpUpdateNamespaceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateNamespace{}, middleware.After)
}
func addOpUpdateSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateSnapshot{}, middleware.After)
}
func addOpUpdateUsageLimitValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateUsageLimit{}, middleware.After)
}
func addOpUpdateWorkgroupValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateWorkgroup{}, middleware.After)
}
func validateTag(v *types.Tag) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "Tag"}
if v.Key == nil {
invalidParams.Add(smithy.NewErrParamRequired("Key"))
}
if v.Value == nil {
invalidParams.Add(smithy.NewErrParamRequired("Value"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateTagList(v []types.Tag) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "TagList"}
for i := range v {
if err := validateTag(&v[i]); err != nil {
invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpConvertRecoveryPointToSnapshotInput(v *ConvertRecoveryPointToSnapshotInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ConvertRecoveryPointToSnapshotInput"}
if v.RecoveryPointId == nil {
invalidParams.Add(smithy.NewErrParamRequired("RecoveryPointId"))
}
if v.SnapshotName == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotName"))
}
if v.Tags != nil {
if err := validateTagList(v.Tags); err != nil {
invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateEndpointAccessInput(v *CreateEndpointAccessInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateEndpointAccessInput"}
if v.EndpointName == nil {
invalidParams.Add(smithy.NewErrParamRequired("EndpointName"))
}
if v.SubnetIds == nil {
invalidParams.Add(smithy.NewErrParamRequired("SubnetIds"))
}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateNamespaceInput(v *CreateNamespaceInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateNamespaceInput"}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if v.Tags != nil {
if err := validateTagList(v.Tags); err != nil {
invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateSnapshotInput(v *CreateSnapshotInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateSnapshotInput"}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if v.SnapshotName == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotName"))
}
if v.Tags != nil {
if err := validateTagList(v.Tags); err != nil {
invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateUsageLimitInput(v *CreateUsageLimitInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateUsageLimitInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if len(v.UsageType) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("UsageType"))
}
if v.Amount == nil {
invalidParams.Add(smithy.NewErrParamRequired("Amount"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateWorkgroupInput(v *CreateWorkgroupInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateWorkgroupInput"}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if v.Tags != nil {
if err := validateTagList(v.Tags); err != nil {
invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteEndpointAccessInput(v *DeleteEndpointAccessInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteEndpointAccessInput"}
if v.EndpointName == nil {
invalidParams.Add(smithy.NewErrParamRequired("EndpointName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteNamespaceInput(v *DeleteNamespaceInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteNamespaceInput"}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
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 validateOpDeleteSnapshotInput(v *DeleteSnapshotInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteSnapshotInput"}
if v.SnapshotName == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteUsageLimitInput(v *DeleteUsageLimitInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteUsageLimitInput"}
if v.UsageLimitId == nil {
invalidParams.Add(smithy.NewErrParamRequired("UsageLimitId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteWorkgroupInput(v *DeleteWorkgroupInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteWorkgroupInput"}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetCredentialsInput(v *GetCredentialsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetCredentialsInput"}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetEndpointAccessInput(v *GetEndpointAccessInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetEndpointAccessInput"}
if v.EndpointName == nil {
invalidParams.Add(smithy.NewErrParamRequired("EndpointName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetNamespaceInput(v *GetNamespaceInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetNamespaceInput"}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetRecoveryPointInput(v *GetRecoveryPointInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetRecoveryPointInput"}
if v.RecoveryPointId == nil {
invalidParams.Add(smithy.NewErrParamRequired("RecoveryPointId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
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 validateOpGetTableRestoreStatusInput(v *GetTableRestoreStatusInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetTableRestoreStatusInput"}
if v.TableRestoreRequestId == nil {
invalidParams.Add(smithy.NewErrParamRequired("TableRestoreRequestId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetUsageLimitInput(v *GetUsageLimitInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetUsageLimitInput"}
if v.UsageLimitId == nil {
invalidParams.Add(smithy.NewErrParamRequired("UsageLimitId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetWorkgroupInput(v *GetWorkgroupInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetWorkgroupInput"}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListTagsForResourceInput(v *ListTagsForResourceInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListTagsForResourceInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
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 validateOpRestoreFromRecoveryPointInput(v *RestoreFromRecoveryPointInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "RestoreFromRecoveryPointInput"}
if v.RecoveryPointId == nil {
invalidParams.Add(smithy.NewErrParamRequired("RecoveryPointId"))
}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpRestoreFromSnapshotInput(v *RestoreFromSnapshotInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "RestoreFromSnapshotInput"}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpRestoreTableFromSnapshotInput(v *RestoreTableFromSnapshotInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "RestoreTableFromSnapshotInput"}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if v.SnapshotName == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotName"))
}
if v.SourceDatabaseName == nil {
invalidParams.Add(smithy.NewErrParamRequired("SourceDatabaseName"))
}
if v.SourceTableName == nil {
invalidParams.Add(smithy.NewErrParamRequired("SourceTableName"))
}
if v.NewTableName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NewTableName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpTagResourceInput(v *TagResourceInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "TagResourceInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if v.Tags == nil {
invalidParams.Add(smithy.NewErrParamRequired("Tags"))
} else if v.Tags != nil {
if err := validateTagList(v.Tags); err != nil {
invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUntagResourceInput(v *UntagResourceInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UntagResourceInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if v.TagKeys == nil {
invalidParams.Add(smithy.NewErrParamRequired("TagKeys"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUpdateEndpointAccessInput(v *UpdateEndpointAccessInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateEndpointAccessInput"}
if v.EndpointName == nil {
invalidParams.Add(smithy.NewErrParamRequired("EndpointName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUpdateNamespaceInput(v *UpdateNamespaceInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateNamespaceInput"}
if v.NamespaceName == nil {
invalidParams.Add(smithy.NewErrParamRequired("NamespaceName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUpdateSnapshotInput(v *UpdateSnapshotInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateSnapshotInput"}
if v.SnapshotName == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUpdateUsageLimitInput(v *UpdateUsageLimitInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateUsageLimitInput"}
if v.UsageLimitId == nil {
invalidParams.Add(smithy.NewErrParamRequired("UsageLimitId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUpdateWorkgroupInput(v *UpdateWorkgroupInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateWorkgroupInput"}
if v.WorkgroupName == nil {
invalidParams.Add(smithy.NewErrParamRequired("WorkgroupName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
| 1,373 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package endpoints
import (
"github.com/aws/aws-sdk-go-v2/aws"
endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2"
"github.com/aws/smithy-go/logging"
"regexp"
)
// Options is the endpoint resolver configuration options
type Options struct {
// Logger is a logging implementation that log events should be sent to.
Logger logging.Logger
// LogDeprecated indicates that deprecated endpoints should be logged to the
// provided logger.
LogDeprecated bool
// ResolvedRegion is used to override the region to be resolved, rather then the
// using the value passed to the ResolveEndpoint method. This value is used by the
// SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative
// name. You must not set this value directly in your application.
ResolvedRegion string
// DisableHTTPS informs the resolver to return an endpoint that does not use the
// HTTPS scheme.
DisableHTTPS bool
// UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint.
UseDualStackEndpoint aws.DualStackEndpointState
// UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint.
UseFIPSEndpoint aws.FIPSEndpointState
}
func (o Options) GetResolvedRegion() string {
return o.ResolvedRegion
}
func (o Options) GetDisableHTTPS() bool {
return o.DisableHTTPS
}
func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState {
return o.UseDualStackEndpoint
}
func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState {
return o.UseFIPSEndpoint
}
func transformToSharedOptions(options Options) endpoints.Options {
return endpoints.Options{
Logger: options.Logger,
LogDeprecated: options.LogDeprecated,
ResolvedRegion: options.ResolvedRegion,
DisableHTTPS: options.DisableHTTPS,
UseDualStackEndpoint: options.UseDualStackEndpoint,
UseFIPSEndpoint: options.UseFIPSEndpoint,
}
}
// Resolver Redshift Serverless endpoint resolver
type Resolver struct {
partitions endpoints.Partitions
}
// ResolveEndpoint resolves the service endpoint for the given region and options
func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) {
if len(region) == 0 {
return endpoint, &aws.MissingRegionError{}
}
opt := transformToSharedOptions(options)
return r.partitions.ResolveEndpoint(region, opt)
}
// New returns a new Resolver
func New() *Resolver {
return &Resolver{
partitions: defaultPartitions,
}
}
var partitionRegexp = struct {
Aws *regexp.Regexp
AwsCn *regexp.Regexp
AwsIso *regexp.Regexp
AwsIsoB *regexp.Regexp
AwsIsoE *regexp.Regexp
AwsIsoF *regexp.Regexp
AwsUsGov *regexp.Regexp
}{
Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"),
AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"),
AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"),
AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"),
AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"),
AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"),
AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"),
}
var defaultPartitions = endpoints.Partitions{
{
ID: "aws",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "redshift-serverless.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "redshift-serverless.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.Aws,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "ap-northeast-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-northeast-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-south-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-southeast-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-southeast-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-north-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-west-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-west-3",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-2",
}: endpoints.Endpoint{},
},
},
{
ID: "aws-cn",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "redshift-serverless.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.amazonaws.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "redshift-serverless.{region}.amazonaws.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsCn,
IsRegionalized: true,
},
{
ID: "aws-iso",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "redshift-serverless.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIso,
IsRegionalized: true,
},
{
ID: "aws-iso-b",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "redshift-serverless.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoB,
IsRegionalized: true,
},
{
ID: "aws-iso-e",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "redshift-serverless.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoE,
IsRegionalized: true,
},
{
ID: "aws-iso-f",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "redshift-serverless.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoF,
IsRegionalized: true,
},
{
ID: "aws-us-gov",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "redshift-serverless.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "redshift-serverless-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "redshift-serverless.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsUsGov,
IsRegionalized: true,
},
}
| 344 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package endpoints
import (
"testing"
)
func TestRegexCompile(t *testing.T) {
_ = defaultPartitions
}
| 12 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
type LogExport string
// Enum values for LogExport
const (
LogExportUserActivityLog LogExport = "useractivitylog"
LogExportUserLog LogExport = "userlog"
LogExportConnectionLog LogExport = "connectionlog"
)
// Values returns all known values for LogExport. Note that this can be expanded
// in the future, and so it is only as up to date as the client. The ordering of
// this slice is not guaranteed to be stable across updates.
func (LogExport) Values() []LogExport {
return []LogExport{
"useractivitylog",
"userlog",
"connectionlog",
}
}
type NamespaceStatus string
// Enum values for NamespaceStatus
const (
NamespaceStatusAvailable NamespaceStatus = "AVAILABLE"
NamespaceStatusModifying NamespaceStatus = "MODIFYING"
NamespaceStatusDeleting NamespaceStatus = "DELETING"
)
// Values returns all known values for NamespaceStatus. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (NamespaceStatus) Values() []NamespaceStatus {
return []NamespaceStatus{
"AVAILABLE",
"MODIFYING",
"DELETING",
}
}
type SnapshotStatus string
// Enum values for SnapshotStatus
const (
SnapshotStatusAvailable SnapshotStatus = "AVAILABLE"
SnapshotStatusCreating SnapshotStatus = "CREATING"
SnapshotStatusDeleted SnapshotStatus = "DELETED"
SnapshotStatusCancelled SnapshotStatus = "CANCELLED"
SnapshotStatusFailed SnapshotStatus = "FAILED"
SnapshotStatusCopying SnapshotStatus = "COPYING"
)
// Values returns all known values for SnapshotStatus. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (SnapshotStatus) Values() []SnapshotStatus {
return []SnapshotStatus{
"AVAILABLE",
"CREATING",
"DELETED",
"CANCELLED",
"FAILED",
"COPYING",
}
}
type UsageLimitBreachAction string
// Enum values for UsageLimitBreachAction
const (
UsageLimitBreachActionLog UsageLimitBreachAction = "log"
UsageLimitBreachActionEmitMetric UsageLimitBreachAction = "emit-metric"
UsageLimitBreachActionDeactivate UsageLimitBreachAction = "deactivate"
)
// Values returns all known values for UsageLimitBreachAction. Note that this can
// be expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (UsageLimitBreachAction) Values() []UsageLimitBreachAction {
return []UsageLimitBreachAction{
"log",
"emit-metric",
"deactivate",
}
}
type UsageLimitPeriod string
// Enum values for UsageLimitPeriod
const (
UsageLimitPeriodDaily UsageLimitPeriod = "daily"
UsageLimitPeriodWeekly UsageLimitPeriod = "weekly"
UsageLimitPeriodMonthly UsageLimitPeriod = "monthly"
)
// Values returns all known values for UsageLimitPeriod. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (UsageLimitPeriod) Values() []UsageLimitPeriod {
return []UsageLimitPeriod{
"daily",
"weekly",
"monthly",
}
}
type UsageLimitUsageType string
// Enum values for UsageLimitUsageType
const (
UsageLimitUsageTypeServerlessCompute UsageLimitUsageType = "serverless-compute"
UsageLimitUsageTypeCrossRegionDatasharing UsageLimitUsageType = "cross-region-datasharing"
)
// Values returns all known values for UsageLimitUsageType. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (UsageLimitUsageType) Values() []UsageLimitUsageType {
return []UsageLimitUsageType{
"serverless-compute",
"cross-region-datasharing",
}
}
type WorkgroupStatus string
// Enum values for WorkgroupStatus
const (
WorkgroupStatusCreating WorkgroupStatus = "CREATING"
WorkgroupStatusAvailable WorkgroupStatus = "AVAILABLE"
WorkgroupStatusModifying WorkgroupStatus = "MODIFYING"
WorkgroupStatusDeleting WorkgroupStatus = "DELETING"
)
// Values returns all known values for WorkgroupStatus. Note that this can be
// expanded in the future, and so it is only as up to date as the client. The
// ordering of this slice is not guaranteed to be stable across updates.
func (WorkgroupStatus) Values() []WorkgroupStatus {
return []WorkgroupStatus{
"CREATING",
"AVAILABLE",
"MODIFYING",
"DELETING",
}
}
| 150 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
"fmt"
smithy "github.com/aws/smithy-go"
)
// You do not have sufficient access to perform this action.
type AccessDeniedException struct {
Message *string
ErrorCodeOverride *string
Code *string
noSmithyDocumentSerde
}
func (e *AccessDeniedException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *AccessDeniedException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *AccessDeniedException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "AccessDeniedException"
}
return *e.ErrorCodeOverride
}
func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The submitted action has conflicts.
type ConflictException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ConflictException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ConflictException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ConflictException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ConflictException"
}
return *e.ErrorCodeOverride
}
func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// There is an insufficient capacity to perform the action.
type InsufficientCapacityException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InsufficientCapacityException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InsufficientCapacityException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InsufficientCapacityException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InsufficientCapacityException"
}
return *e.ErrorCodeOverride
}
func (e *InsufficientCapacityException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The request processing has failed because of an unknown error, exception or
// failure.
type InternalServerException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InternalServerException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InternalServerException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InternalServerException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InternalServerException"
}
return *e.ErrorCodeOverride
}
func (e *InternalServerException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
// The provided pagination token is invalid.
type InvalidPaginationException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InvalidPaginationException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidPaginationException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidPaginationException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidPaginationException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidPaginationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The resource could not be found.
type ResourceNotFoundException struct {
Message *string
ErrorCodeOverride *string
ResourceName *string
noSmithyDocumentSerde
}
func (e *ResourceNotFoundException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ResourceNotFoundException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ResourceNotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ResourceNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The service limit was exceeded.
type ServiceQuotaExceededException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ServiceQuotaExceededException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ServiceQuotaExceededException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ServiceQuotaExceededException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ServiceQuotaExceededException"
}
return *e.ErrorCodeOverride
}
func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The request was denied due to request throttling.
type ThrottlingException struct {
Message *string
ErrorCodeOverride *string
Code *string
noSmithyDocumentSerde
}
func (e *ThrottlingException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ThrottlingException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ThrottlingException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ThrottlingException"
}
return *e.ErrorCodeOverride
}
func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The request exceeded the number of tags allowed for a resource.
type TooManyTagsException struct {
Message *string
ErrorCodeOverride *string
ResourceName *string
noSmithyDocumentSerde
}
func (e *TooManyTagsException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *TooManyTagsException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *TooManyTagsException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "TooManyTagsException"
}
return *e.ErrorCodeOverride
}
func (e *TooManyTagsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The input failed to satisfy the constraints specified by an AWS service.
type ValidationException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ValidationException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ValidationException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ValidationException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ValidationException"
}
return *e.ErrorCodeOverride
}
func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
| 278 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
smithydocument "github.com/aws/smithy-go/document"
"time"
)
// An array of key-value pairs to set for advanced control over Amazon Redshift
// Serverless.
type ConfigParameter struct {
// The key of the parameter. The options are auto_mv , datestyle ,
// enable_case_sensitivity_identifier , enable_user_activity_logging , query_group
// , search_path , and query monitoring metrics that let you define performance
// boundaries. For more information about query monitoring rules and available
// metrics, see Query monitoring metrics for Amazon Redshift Serverless (https://docs.aws.amazon.com/redshift/latest/dg/cm-c-wlm-query-monitoring-rules.html#cm-c-wlm-query-monitoring-metrics-serverless)
// .
ParameterKey *string
// The value of the parameter to set.
ParameterValue *string
noSmithyDocumentSerde
}
// The VPC endpoint object.
type Endpoint struct {
// The DNS address of the VPC endpoint.
Address *string
// The port that Amazon Redshift Serverless listens on.
Port *int32
// An array of VpcEndpoint objects.
VpcEndpoints []VpcEndpoint
noSmithyDocumentSerde
}
// Information about an Amazon Redshift Serverless VPC endpoint.
type EndpointAccess struct {
// The DNS address of the endpoint.
Address *string
// The Amazon Resource Name (ARN) of the VPC endpoint.
EndpointArn *string
// The time that the endpoint was created.
EndpointCreateTime *time.Time
// The name of the VPC endpoint.
EndpointName *string
// The status of the VPC endpoint.
EndpointStatus *string
// The port number on which Amazon Redshift Serverless accepts incoming
// connections.
Port *int32
// The unique identifier of subnets where Amazon Redshift Serverless choose to
// deploy the VPC endpoint.
SubnetIds []string
// The connection endpoint for connecting to Amazon Redshift Serverless.
VpcEndpoint *VpcEndpoint
// The security groups associated with the endpoint.
VpcSecurityGroups []VpcSecurityGroupMembership
// The name of the workgroup associated with the endpoint.
WorkgroupName *string
noSmithyDocumentSerde
}
// A collection of database objects and users.
type Namespace struct {
// The username of the administrator for the first database created in the
// namespace.
AdminUsername *string
// The date of when the namespace was created.
CreationDate *time.Time
// The name of the first database created in the namespace.
DbName *string
// The Amazon Resource Name (ARN) of the IAM role to set as a default in the
// namespace.
DefaultIamRoleArn *string
// A list of IAM roles to associate with the namespace.
IamRoles []string
// The ID of the Amazon Web Services Key Management Service key used to encrypt
// your data.
KmsKeyId *string
// The types of logs the namespace can export. Available export types are User
// log, Connection log, and User activity log.
LogExports []LogExport
// The Amazon Resource Name (ARN) associated with a namespace.
NamespaceArn *string
// The unique identifier of a namespace.
NamespaceId *string
// The name of the namespace. Must be between 3-64 alphanumeric characters in
// lowercase, and it cannot be a reserved word. A list of reserved words can be
// found in Reserved Words (https://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html)
// in the Amazon Redshift Database Developer Guide.
NamespaceName *string
// The status of the namespace.
Status NamespaceStatus
noSmithyDocumentSerde
}
// Contains information about a network interface in an Amazon Redshift Serverless
// managed VPC endpoint.
type NetworkInterface struct {
// The availability Zone.
AvailabilityZone *string
// The unique identifier of the network interface.
NetworkInterfaceId *string
// The IPv4 address of the network interface within the subnet.
PrivateIpAddress *string
// The unique identifier of the subnet.
SubnetId *string
noSmithyDocumentSerde
}
// The automatically created recovery point of a namespace. Recovery points are
// created every 30 minutes and kept for 24 hours.
type RecoveryPoint struct {
// The Amazon Resource Name (ARN) of the namespace the recovery point is
// associated with.
NamespaceArn *string
// The name of the namespace the recovery point is associated with.
NamespaceName *string
// The time the recovery point is created.
RecoveryPointCreateTime *time.Time
// The unique identifier of the recovery point.
RecoveryPointId *string
// The total size of the data in the recovery point in megabytes.
TotalSizeInMegaBytes *float64
// The name of the workgroup the recovery point is associated with.
WorkgroupName *string
noSmithyDocumentSerde
}
// The resource policy object. Currently, you can use policies to share snapshots
// across Amazon Web Services accounts.
type ResourcePolicy struct {
// The resource policy.
Policy *string
// The Amazon Resource Name (ARN) of the policy.
ResourceArn *string
noSmithyDocumentSerde
}
// A snapshot object that contains databases.
type Snapshot struct {
// All of the Amazon Web Services accounts that have access to restore a snapshot
// to a provisioned cluster.
AccountsWithProvisionedRestoreAccess []string
// All of the Amazon Web Services accounts that have access to restore a snapshot
// to a namespace.
AccountsWithRestoreAccess []string
// The size of the incremental backup in megabytes.
ActualIncrementalBackupSizeInMegaBytes *float64
// The username of the database within a snapshot.
AdminUsername *string
// The size in megabytes of the data that has been backed up to a snapshot.
BackupProgressInMegaBytes *float64
// The rate at which data is backed up into a snapshot in megabytes per second.
CurrentBackupRateInMegaBytesPerSecond *float64
// The amount of time it took to back up data into a snapshot.
ElapsedTimeInSeconds *int64
// The estimated amount of seconds until the snapshot completes backup.
EstimatedSecondsToCompletion *int64
// The unique identifier of the KMS key used to encrypt the snapshot.
KmsKeyId *string
// The Amazon Resource Name (ARN) of the namespace the snapshot was created from.
NamespaceArn *string
// The name of the namepsace.
NamespaceName *string
// The owner Amazon Web Services; account of the snapshot.
OwnerAccount *string
// The Amazon Resource Name (ARN) of the snapshot.
SnapshotArn *string
// The timestamp of when the snapshot was created.
SnapshotCreateTime *time.Time
// The name of the snapshot.
SnapshotName *string
// The amount of days until the snapshot is deleted.
SnapshotRemainingDays *int32
// The period of time, in days, of how long the snapshot is retained.
SnapshotRetentionPeriod *int32
// The timestamp of when data within the snapshot started getting retained.
SnapshotRetentionStartTime *time.Time
// The status of the snapshot.
Status SnapshotStatus
// The total size, in megabytes, of how big the snapshot is.
TotalBackupSizeInMegaBytes *float64
noSmithyDocumentSerde
}
// Contains information about a table restore request.
type TableRestoreStatus struct {
// A description of the status of the table restore request. Status values include
// SUCCEEDED , FAILED , CANCELED , PENDING , IN_PROGRESS .
Message *string
// The namespace of the table being restored from.
NamespaceName *string
// The name of the table to create from the restore operation.
NewTableName *string
// The amount of data restored to the new table so far, in megabytes (MB).
ProgressInMegaBytes *int64
// The time that the table restore request was made, in Universal Coordinated Time
// (UTC).
RequestTime *time.Time
// The name of the snapshot being restored from.
SnapshotName *string
// The name of the source database being restored from.
SourceDatabaseName *string
// The name of the source schema being restored from.
SourceSchemaName *string
// The name of the source table being restored from.
SourceTableName *string
// A value that describes the current state of the table restore request. Possible
// values include SUCCEEDED , FAILED , CANCELED , PENDING , IN_PROGRESS .
Status *string
// The ID of the RestoreTableFromSnapshot request.
TableRestoreRequestId *string
// The name of the database to restore to.
TargetDatabaseName *string
// The name of the schema to restore to.
TargetSchemaName *string
// The total amount of data to restore to the new table, in megabytes (MB).
TotalDataInMegaBytes *int64
// The name of the workgroup being restored from.
WorkgroupName *string
noSmithyDocumentSerde
}
// A map of key-value pairs.
type Tag struct {
// The key to use in the tag.
//
// This member is required.
Key *string
// The value of the tag.
//
// This member is required.
Value *string
noSmithyDocumentSerde
}
// The usage limit object.
type UsageLimit struct {
// The limit amount. If time-based, this amount is in RPUs consumed per hour. If
// data-based, this amount is in terabytes (TB). The value must be a positive
// number.
Amount *int64
// The action that Amazon Redshift Serverless takes when the limit is reached.
BreachAction UsageLimitBreachAction
// The time period that the amount applies to. A weekly period begins on Sunday.
// The default is monthly.
Period UsageLimitPeriod
// The Amazon Resource Name (ARN) that identifies the Amazon Redshift Serverless
// resource.
ResourceArn *string
// The Amazon Resource Name (ARN) of the resource associated with the usage limit.
UsageLimitArn *string
// The identifier of the usage limit.
UsageLimitId *string
// The Amazon Redshift Serverless feature to limit.
UsageType UsageLimitUsageType
noSmithyDocumentSerde
}
// The connection endpoint for connecting to Amazon Redshift Serverless through
// the proxy.
type VpcEndpoint struct {
// One or more network interfaces of the endpoint. Also known as an interface
// endpoint.
NetworkInterfaces []NetworkInterface
// The connection endpoint ID for connecting to Amazon Redshift Serverless.
VpcEndpointId *string
// The VPC identifier that the endpoint is associated with.
VpcId *string
noSmithyDocumentSerde
}
// Describes the members of a VPC security group.
type VpcSecurityGroupMembership struct {
// The status of the VPC security group.
Status *string
// The unique identifier of the VPC security group.
VpcSecurityGroupId *string
noSmithyDocumentSerde
}
// The collection of computing resources from which an endpoint is created.
type Workgroup struct {
// The base data warehouse capacity of the workgroup in Redshift Processing Units
// (RPUs).
BaseCapacity *int32
// An array of parameters to set for advanced control over a database. The options
// are auto_mv , datestyle , enable_case_sensitivity_identifier ,
// enable_user_activity_logging , query_group , , search_path , and query
// monitoring metrics that let you define performance boundaries. For more
// information about query monitoring rules and available metrics, see Query
// monitoring metrics for Amazon Redshift Serverless (https://docs.aws.amazon.com/redshift/latest/dg/cm-c-wlm-query-monitoring-rules.html#cm-c-wlm-query-monitoring-metrics-serverless)
// .
ConfigParameters []ConfigParameter
// The creation date of the workgroup.
CreationDate *time.Time
// The endpoint that is created from the workgroup.
Endpoint *Endpoint
// The value that specifies whether to enable enhanced virtual private cloud (VPC)
// routing, which forces Amazon Redshift Serverless to route traffic through your
// VPC.
EnhancedVpcRouting *bool
// The namespace the workgroup is associated with.
NamespaceName *string
// The custom port to use when connecting to a workgroup. Valid port ranges are
// 5431-5455 and 8191-8215. The default is 5439.
Port *int32
// A value that specifies whether the workgroup can be accessible from a public
// network
PubliclyAccessible *bool
// An array of security group IDs to associate with the workgroup.
SecurityGroupIds []string
// The status of the workgroup.
Status WorkgroupStatus
// An array of subnet IDs the workgroup is associated with.
SubnetIds []string
// The Amazon Resource Name (ARN) that links to the workgroup.
WorkgroupArn *string
// The unique identifier of the workgroup.
WorkgroupId *string
// The name of the workgroup.
WorkgroupName *string
noSmithyDocumentSerde
}
type noSmithyDocumentSerde = smithydocument.NoSerde
| 443 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
cryptorand "crypto/rand"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/aws/defaults"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
smithy "github.com/aws/smithy-go"
smithydocument "github.com/aws/smithy-go/document"
"github.com/aws/smithy-go/logging"
"github.com/aws/smithy-go/middleware"
smithyrand "github.com/aws/smithy-go/rand"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net"
"net/http"
"time"
)
const ServiceID = "Rekognition"
const ServiceAPIVersion = "2016-06-27"
// Client provides the API client to make operations call for Amazon Rekognition.
type Client struct {
options Options
}
// New returns an initialized Client based on the functional options. Provide
// additional functional options to further configure the behavior of the client,
// such as changing the client's endpoint or adding custom middleware behavior.
func New(options Options, optFns ...func(*Options)) *Client {
options = options.Copy()
resolveDefaultLogger(&options)
setResolvedDefaultsMode(&options)
resolveRetryer(&options)
resolveHTTPClient(&options)
resolveHTTPSignerV4(&options)
resolveDefaultEndpointConfiguration(&options)
resolveIdempotencyTokenProvider(&options)
for _, fn := range optFns {
fn(&options)
}
client := &Client{
options: options,
}
return client
}
type Options struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// Configures the events that will be sent to the configured logger.
ClientLogMode aws.ClientLogMode
// The credentials object to use when signing requests.
Credentials aws.CredentialsProvider
// The configuration DefaultsMode that the SDK should use when constructing the
// clients initial default settings.
DefaultsMode aws.DefaultsMode
// The endpoint options to be used when attempting to resolve an endpoint.
EndpointOptions EndpointResolverOptions
// The service endpoint resolver.
EndpointResolver EndpointResolver
// Signature Version 4 (SigV4) Signer
HTTPSignerV4 HTTPSignerV4
// Provides idempotency tokens values that will be automatically populated into
// idempotent API operations.
IdempotencyTokenProvider IdempotencyTokenProvider
// The logger writer interface to write logging messages to.
Logger logging.Logger
// The region to send requests to. (Required)
Region string
// RetryMaxAttempts specifies the maximum number attempts an API client will call
// an operation that fails with a retryable error. A value of 0 is ignored, and
// will not be used to configure the API client created default retryer, or modify
// per operation call's retry max attempts. When creating a new API Clients this
// member will only be used if the Retryer Options member is nil. This value will
// be ignored if Retryer is not nil. If specified in an operation call's functional
// options with a value that is different than the constructed client's Options,
// the Client's Retryer will be wrapped to use the operation's specific
// RetryMaxAttempts value.
RetryMaxAttempts int
// RetryMode specifies the retry mode the API client will be created with, if
// Retryer option is not also specified. When creating a new API Clients this
// member will only be used if the Retryer Options member is nil. This value will
// be ignored if Retryer is not nil. Currently does not support per operation call
// overrides, may in the future.
RetryMode aws.RetryMode
// Retryer guides how HTTP requests should be retried in case of recoverable
// failures. When nil the API client will use a default retryer. The kind of
// default retry created by the API client can be changed with the RetryMode
// option.
Retryer aws.Retryer
// The RuntimeEnvironment configuration, only populated if the DefaultsMode is set
// to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You
// should not populate this structure programmatically, or rely on the values here
// within your applications.
RuntimeEnvironment aws.RuntimeEnvironment
// The initial DefaultsMode used when the client options were constructed. If the
// DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved
// value was at that point in time. Currently does not support per operation call
// overrides, may in the future.
resolvedDefaultsMode aws.DefaultsMode
// The HTTP client to invoke API calls with. Defaults to client's default HTTP
// implementation if nil.
HTTPClient HTTPClient
}
// WithAPIOptions returns a functional option for setting the Client's APIOptions
// option.
func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) {
return func(o *Options) {
o.APIOptions = append(o.APIOptions, optFns...)
}
}
// WithEndpointResolver returns a functional option for setting the Client's
// EndpointResolver option.
func WithEndpointResolver(v EndpointResolver) func(*Options) {
return func(o *Options) {
o.EndpointResolver = v
}
}
type HTTPClient interface {
Do(*http.Request) (*http.Response, error)
}
// Copy creates a clone where the APIOptions list is deep copied.
func (o Options) Copy() Options {
to := o
to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions))
copy(to.APIOptions, o.APIOptions)
return to
}
func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) {
ctx = middleware.ClearStackValues(ctx)
stack := middleware.NewStack(opID, smithyhttp.NewStackRequest)
options := c.options.Copy()
for _, fn := range optFns {
fn(&options)
}
finalizeRetryMaxAttemptOptions(&options, *c)
finalizeClientEndpointResolverOptions(&options)
for _, fn := range stackFns {
if err := fn(stack, options); err != nil {
return nil, metadata, err
}
}
for _, fn := range options.APIOptions {
if err := fn(stack); err != nil {
return nil, metadata, err
}
}
handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack)
result, metadata, err = handler.Handle(ctx, params)
if err != nil {
err = &smithy.OperationError{
ServiceID: ServiceID,
OperationName: opID,
Err: err,
}
}
return result, metadata, err
}
type noSmithyDocumentSerde = smithydocument.NoSerde
func resolveDefaultLogger(o *Options) {
if o.Logger != nil {
return
}
o.Logger = logging.Nop{}
}
func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error {
return middleware.AddSetLoggerMiddleware(stack, o.Logger)
}
func setResolvedDefaultsMode(o *Options) {
if len(o.resolvedDefaultsMode) > 0 {
return
}
var mode aws.DefaultsMode
mode.SetFromString(string(o.DefaultsMode))
if mode == aws.DefaultsModeAuto {
mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment)
}
o.resolvedDefaultsMode = mode
}
// NewFromConfig returns a new client from the provided config.
func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
opts := Options{
Region: cfg.Region,
DefaultsMode: cfg.DefaultsMode,
RuntimeEnvironment: cfg.RuntimeEnvironment,
HTTPClient: cfg.HTTPClient,
Credentials: cfg.Credentials,
APIOptions: cfg.APIOptions,
Logger: cfg.Logger,
ClientLogMode: cfg.ClientLogMode,
}
resolveAWSRetryerProvider(cfg, &opts)
resolveAWSRetryMaxAttempts(cfg, &opts)
resolveAWSRetryMode(cfg, &opts)
resolveAWSEndpointResolver(cfg, &opts)
resolveUseDualStackEndpoint(cfg, &opts)
resolveUseFIPSEndpoint(cfg, &opts)
return New(opts, optFns...)
}
func resolveHTTPClient(o *Options) {
var buildable *awshttp.BuildableClient
if o.HTTPClient != nil {
var ok bool
buildable, ok = o.HTTPClient.(*awshttp.BuildableClient)
if !ok {
return
}
} else {
buildable = awshttp.NewBuildableClient()
}
modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
if err == nil {
buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) {
if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok {
dialer.Timeout = dialerTimeout
}
})
buildable = buildable.WithTransportOptions(func(transport *http.Transport) {
if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok {
transport.TLSHandshakeTimeout = tlsHandshakeTimeout
}
})
}
o.HTTPClient = buildable
}
func resolveRetryer(o *Options) {
if o.Retryer != nil {
return
}
if len(o.RetryMode) == 0 {
modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
if err == nil {
o.RetryMode = modeConfig.RetryMode
}
}
if len(o.RetryMode) == 0 {
o.RetryMode = aws.RetryModeStandard
}
var standardOptions []func(*retry.StandardOptions)
if v := o.RetryMaxAttempts; v != 0 {
standardOptions = append(standardOptions, func(so *retry.StandardOptions) {
so.MaxAttempts = v
})
}
switch o.RetryMode {
case aws.RetryModeAdaptive:
var adaptiveOptions []func(*retry.AdaptiveModeOptions)
if len(standardOptions) != 0 {
adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) {
ao.StandardOptions = append(ao.StandardOptions, standardOptions...)
})
}
o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...)
default:
o.Retryer = retry.NewStandard(standardOptions...)
}
}
func resolveAWSRetryerProvider(cfg aws.Config, o *Options) {
if cfg.Retryer == nil {
return
}
o.Retryer = cfg.Retryer()
}
func resolveAWSRetryMode(cfg aws.Config, o *Options) {
if len(cfg.RetryMode) == 0 {
return
}
o.RetryMode = cfg.RetryMode
}
func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) {
if cfg.RetryMaxAttempts == 0 {
return
}
o.RetryMaxAttempts = cfg.RetryMaxAttempts
}
func finalizeRetryMaxAttemptOptions(o *Options, client Client) {
if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts {
return
}
o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
}
func resolveAWSEndpointResolver(cfg aws.Config, o *Options) {
if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil {
return
}
o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions, NewDefaultEndpointResolver())
}
func addClientUserAgent(stack *middleware.Stack) error {
return awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "rekognition", goModuleVersion)(stack)
}
func addHTTPSignerV4Middleware(stack *middleware.Stack, o Options) error {
mw := v4.NewSignHTTPRequestMiddleware(v4.SignHTTPRequestMiddlewareOptions{
CredentialsProvider: o.Credentials,
Signer: o.HTTPSignerV4,
LogSigning: o.ClientLogMode.IsSigning(),
})
return stack.Finalize.Add(mw, middleware.After)
}
type HTTPSignerV4 interface {
SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error
}
func resolveHTTPSignerV4(o *Options) {
if o.HTTPSignerV4 != nil {
return
}
o.HTTPSignerV4 = newDefaultV4Signer(*o)
}
func newDefaultV4Signer(o Options) *v4.Signer {
return v4.NewSigner(func(so *v4.SignerOptions) {
so.Logger = o.Logger
so.LogSigning = o.ClientLogMode.IsSigning()
})
}
func resolveIdempotencyTokenProvider(o *Options) {
if o.IdempotencyTokenProvider != nil {
return
}
o.IdempotencyTokenProvider = smithyrand.NewUUIDIdempotencyToken(cryptorand.Reader)
}
func addRetryMiddlewares(stack *middleware.Stack, o Options) error {
mo := retry.AddRetryMiddlewaresOptions{
Retryer: o.Retryer,
LogRetryAttempts: o.ClientLogMode.IsRetries(),
}
return retry.AddRetryMiddlewares(stack, mo)
}
// resolves dual-stack endpoint configuration
func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error {
if len(cfg.ConfigSources) == 0 {
return nil
}
value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources)
if err != nil {
return err
}
if found {
o.EndpointOptions.UseDualStackEndpoint = value
}
return nil
}
// resolves FIPS endpoint configuration
func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error {
if len(cfg.ConfigSources) == 0 {
return nil
}
value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources)
if err != nil {
return err
}
if found {
o.EndpointOptions.UseFIPSEndpoint = value
}
return nil
}
// IdempotencyTokenProvider interface for providing idempotency token
type IdempotencyTokenProvider interface {
GetIdempotencyToken() (string, error)
}
func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error {
return awsmiddleware.AddRequestIDRetrieverMiddleware(stack)
}
func addResponseErrorMiddleware(stack *middleware.Stack) error {
return awshttp.AddResponseErrorMiddleware(stack)
}
func addRequestResponseLogging(stack *middleware.Stack, o Options) error {
return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{
LogRequest: o.ClientLogMode.IsRequest(),
LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(),
LogResponse: o.ClientLogMode.IsResponse(),
LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(),
}, middleware.After)
}
| 454 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io/ioutil"
"net/http"
"strings"
"testing"
)
func TestClient_resolveRetryOptions(t *testing.T) {
nopClient := smithyhttp.ClientDoFunc(func(_ *http.Request) (*http.Response, error) {
return &http.Response{
StatusCode: 200,
Header: http.Header{},
Body: ioutil.NopCloser(strings.NewReader("")),
}, nil
})
cases := map[string]struct {
defaultsMode aws.DefaultsMode
retryer aws.Retryer
retryMaxAttempts int
opRetryMaxAttempts *int
retryMode aws.RetryMode
expectClientRetryMode aws.RetryMode
expectClientMaxAttempts int
expectOpMaxAttempts int
}{
"defaults": {
defaultsMode: aws.DefaultsModeStandard,
expectClientRetryMode: aws.RetryModeStandard,
expectClientMaxAttempts: 3,
expectOpMaxAttempts: 3,
},
"custom default retry": {
retryMode: aws.RetryModeAdaptive,
retryMaxAttempts: 10,
expectClientRetryMode: aws.RetryModeAdaptive,
expectClientMaxAttempts: 10,
expectOpMaxAttempts: 10,
},
"custom op max attempts": {
retryMode: aws.RetryModeAdaptive,
retryMaxAttempts: 10,
opRetryMaxAttempts: aws.Int(2),
expectClientRetryMode: aws.RetryModeAdaptive,
expectClientMaxAttempts: 10,
expectOpMaxAttempts: 2,
},
"custom op no change max attempts": {
retryMode: aws.RetryModeAdaptive,
retryMaxAttempts: 10,
opRetryMaxAttempts: aws.Int(10),
expectClientRetryMode: aws.RetryModeAdaptive,
expectClientMaxAttempts: 10,
expectOpMaxAttempts: 10,
},
"custom op 0 max attempts": {
retryMode: aws.RetryModeAdaptive,
retryMaxAttempts: 10,
opRetryMaxAttempts: aws.Int(0),
expectClientRetryMode: aws.RetryModeAdaptive,
expectClientMaxAttempts: 10,
expectOpMaxAttempts: 10,
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
client := NewFromConfig(aws.Config{
DefaultsMode: c.defaultsMode,
Retryer: func() func() aws.Retryer {
if c.retryer == nil {
return nil
}
return func() aws.Retryer { return c.retryer }
}(),
HTTPClient: nopClient,
RetryMaxAttempts: c.retryMaxAttempts,
RetryMode: c.retryMode,
})
if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a {
t.Errorf("expect %v retry mode, got %v", e, a)
}
if e, a := c.expectClientMaxAttempts, client.options.Retryer.MaxAttempts(); e != a {
t.Errorf("expect %v max attempts, got %v", e, a)
}
_, _, err := client.invokeOperation(context.Background(), "mockOperation", struct{}{},
[]func(*Options){
func(o *Options) {
if c.opRetryMaxAttempts == nil {
return
}
o.RetryMaxAttempts = *c.opRetryMaxAttempts
},
},
func(s *middleware.Stack, o Options) error {
s.Initialize.Clear()
s.Serialize.Clear()
s.Build.Clear()
s.Finalize.Clear()
s.Deserialize.Clear()
if e, a := c.expectOpMaxAttempts, o.Retryer.MaxAttempts(); e != a {
t.Errorf("expect %v op max attempts, got %v", e, a)
}
return nil
})
if err != nil {
t.Fatalf("expect no operation error, got %v", err)
}
})
}
}
| 124 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Associates one or more faces with an existing UserID. Takes an array of FaceIds
// . Each FaceId that are present in the FaceIds list is associated with the
// provided UserID. The maximum number of total FaceIds per UserID is 100. The
// UserMatchThreshold parameter specifies the minimum user match confidence
// required for the face to be associated with a UserID that has at least one
// FaceID already associated. This ensures that the FaceIds are associated with
// the right UserID. The value ranges from 0-100 and default value is 75. If
// successful, an array of AssociatedFace objects containing the associated FaceIds
// is returned. If a given face is already associated with the given UserID , it
// will be ignored and will not be returned in the response. If a given face is
// already associated to a different UserID , isn't found in the collection,
// doesn’t meet the UserMatchThreshold , or there are already 100 faces associated
// with the UserID , it will be returned as part of an array of
// UnsuccessfulFaceAssociations. The UserStatus reflects the status of an
// operation which updates a UserID representation with a list of given faces. The
// UserStatus can be:
// - ACTIVE - All associations or disassociations of FaceID(s) for a UserID are
// complete.
// - CREATED - A UserID has been created, but has no FaceID(s) associated with
// it.
// - UPDATING - A UserID is being updated and there are current associations or
// disassociations of FaceID(s) taking place.
func (c *Client) AssociateFaces(ctx context.Context, params *AssociateFacesInput, optFns ...func(*Options)) (*AssociateFacesOutput, error) {
if params == nil {
params = &AssociateFacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AssociateFaces", params, optFns, c.addOperationAssociateFacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AssociateFacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type AssociateFacesInput struct {
// The ID of an existing collection containing the UserID.
//
// This member is required.
CollectionId *string
// An array of FaceIDs to associate with the UserID.
//
// This member is required.
FaceIds []string
// The ID for the existing UserID.
//
// This member is required.
UserId *string
// Idempotent token used to identify the request to AssociateFaces . If you use the
// same token with multiple AssociateFaces requests, the same response is
// returned. Use ClientRequestToken to prevent the same request from being
// processed more than once.
ClientRequestToken *string
// An optional value specifying the minimum confidence in the UserID match to
// return. The default value is 75.
UserMatchThreshold *float32
noSmithyDocumentSerde
}
type AssociateFacesOutput struct {
// An array of AssociatedFace objects containing FaceIDs that are successfully
// associated with the UserID is returned. Returned if the AssociateFaces action is
// successful.
AssociatedFaces []types.AssociatedFace
// An array of UnsuccessfulAssociation objects containing FaceIDs that are not
// successfully associated along with the reasons. Returned if the AssociateFaces
// action is successful.
UnsuccessfulFaceAssociations []types.UnsuccessfulFaceAssociation
// The status of an update made to a UserID. Reflects if the UserID has been
// updated for every requested change.
UserStatus types.UserStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAssociateFacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpAssociateFaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAssociateFaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addIdempotencyToken_opAssociateFacesMiddleware(stack, options); err != nil {
return err
}
if err = addOpAssociateFacesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateFaces(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
}
return nil
}
type idempotencyToken_initializeOpAssociateFaces struct {
tokenProvider IdempotencyTokenProvider
}
func (*idempotencyToken_initializeOpAssociateFaces) ID() string {
return "OperationIdempotencyTokenAutoFill"
}
func (m *idempotencyToken_initializeOpAssociateFaces) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
if m.tokenProvider == nil {
return next.HandleInitialize(ctx, in)
}
input, ok := in.Parameters.(*AssociateFacesInput)
if !ok {
return out, metadata, fmt.Errorf("expected middleware input to be of type *AssociateFacesInput ")
}
if input.ClientRequestToken == nil {
t, err := m.tokenProvider.GetIdempotencyToken()
if err != nil {
return out, metadata, err
}
input.ClientRequestToken = &t
}
return next.HandleInitialize(ctx, in)
}
func addIdempotencyToken_opAssociateFacesMiddleware(stack *middleware.Stack, cfg Options) error {
return stack.Initialize.Add(&idempotencyToken_initializeOpAssociateFaces{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
}
func newServiceMetadataMiddleware_opAssociateFaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "AssociateFaces",
}
}
| 214 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Compares a face in the source input image with each of the 100 largest faces
// detected in the target input image. If the source image contains multiple faces,
// the service detects the largest face and compares it with each face detected in
// the target image. CompareFaces uses machine learning algorithms, which are
// probabilistic. A false negative is an incorrect prediction that a face in the
// target image has a low similarity confidence score when compared to the face in
// the source image. To reduce the probability of false negatives, we recommend
// that you compare the target image against multiple source images. If you plan to
// use CompareFaces to make a decision that impacts an individual's rights,
// privacy, or access to services, we recommend that you pass the result to a human
// for review and further validation before taking action. You pass the input and
// target images either as base64-encoded image bytes or as references to images in
// an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition
// operations, passing image bytes isn't supported. The image must be formatted as
// a PNG or JPEG file. In response, the operation returns an array of face matches
// ordered by similarity score in descending order. For each face match, the
// response provides a bounding box of the face, facial landmarks, pose details
// (pitch, roll, and yaw), quality (brightness and sharpness), and confidence value
// (indicating the level of confidence that the bounding box contains a face). The
// response also provides a similarity score, which indicates how closely the faces
// match. By default, only faces with a similarity score of greater than or equal
// to 80% are returned in the response. You can change this value by specifying the
// SimilarityThreshold parameter. CompareFaces also returns an array of faces that
// don't match the source image. For each face, it returns a bounding box,
// confidence value, landmarks, pose details, and quality. The response also
// returns information about the face in the source image, including the bounding
// box of the face and confidence value. The QualityFilter input parameter allows
// you to filter out detected faces that don’t meet a required quality bar. The
// quality bar is based on a variety of common use cases. Use QualityFilter to set
// the quality bar by specifying LOW , MEDIUM , or HIGH . If you do not want to
// filter detected faces, specify NONE . The default value is NONE . If the image
// doesn't contain Exif metadata, CompareFaces returns orientation information for
// the source and target images. Use these values to display the images with the
// correct image orientation. If no faces are detected in the source or target
// images, CompareFaces returns an InvalidParameterException error. This is a
// stateless API operation. That is, data returned by this operation doesn't
// persist. For an example, see Comparing Faces in Images in the Amazon Rekognition
// Developer Guide. This operation requires permissions to perform the
// rekognition:CompareFaces action.
func (c *Client) CompareFaces(ctx context.Context, params *CompareFacesInput, optFns ...func(*Options)) (*CompareFacesOutput, error) {
if params == nil {
params = &CompareFacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CompareFaces", params, optFns, c.addOperationCompareFacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CompareFacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type CompareFacesInput struct {
// The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI
// to call Amazon Rekognition operations, passing base64-encoded image bytes is not
// supported. If you are using an AWS SDK to call Amazon Rekognition, you might not
// need to base64-encode image bytes passed using the Bytes field. For more
// information, see Images in the Amazon Rekognition developer guide.
//
// This member is required.
SourceImage *types.Image
// The target image as base64-encoded bytes or an S3 object. If you use the AWS
// CLI to call Amazon Rekognition operations, passing base64-encoded image bytes is
// not supported. If you are using an AWS SDK to call Amazon Rekognition, you might
// not need to base64-encode image bytes passed using the Bytes field. For more
// information, see Images in the Amazon Rekognition developer guide.
//
// This member is required.
TargetImage *types.Image
// A filter that specifies a quality bar for how much filtering is done to
// identify faces. Filtered faces aren't compared. If you specify AUTO , Amazon
// Rekognition chooses the quality bar. If you specify LOW , MEDIUM , or HIGH ,
// filtering removes all faces that don’t meet the chosen quality bar. The quality
// bar is based on a variety of common use cases. Low-quality detections can occur
// for a number of reasons. Some examples are an object that's misidentified as a
// face, a face that's too blurry, or a face with a pose that's too extreme to use.
// If you specify NONE , no filtering is performed. The default value is NONE . To
// use quality filtering, the collection you are using must be associated with
// version 3 of the face model or higher.
QualityFilter types.QualityFilter
// The minimum level of confidence in the face matches that a match must meet to
// be included in the FaceMatches array.
SimilarityThreshold *float32
noSmithyDocumentSerde
}
type CompareFacesOutput struct {
// An array of faces in the target image that match the source image face. Each
// CompareFacesMatch object provides the bounding box, the confidence level that
// the bounding box contains a face, and the similarity score for the face in the
// bounding box and the face in the source image.
FaceMatches []types.CompareFacesMatch
// The face in the source image that was used for comparison.
SourceImageFace *types.ComparedSourceImageFace
// The value of SourceImageOrientationCorrection is always null. If the input
// image is in .jpeg format, it might contain exchangeable image file format (Exif)
// metadata that includes the image's orientation. Amazon Rekognition uses this
// orientation information to perform image correction. The bounding box
// coordinates are translated to represent object locations after the orientation
// information in the Exif metadata is used to correct the image orientation.
// Images in .png format don't contain Exif metadata. Amazon Rekognition doesn’t
// perform image correction for images in .png format and .jpeg images without
// orientation information in the image Exif metadata. The bounding box coordinates
// aren't translated and represent the object locations before the image is
// rotated.
SourceImageOrientationCorrection types.OrientationCorrection
// The value of TargetImageOrientationCorrection is always null. If the input
// image is in .jpeg format, it might contain exchangeable image file format (Exif)
// metadata that includes the image's orientation. Amazon Rekognition uses this
// orientation information to perform image correction. The bounding box
// coordinates are translated to represent object locations after the orientation
// information in the Exif metadata is used to correct the image orientation.
// Images in .png format don't contain Exif metadata. Amazon Rekognition doesn’t
// perform image correction for images in .png format and .jpeg images without
// orientation information in the image Exif metadata. The bounding box coordinates
// aren't translated and represent the object locations before the image is
// rotated.
TargetImageOrientationCorrection types.OrientationCorrection
// An array of faces in the target image that did not match the source image face.
UnmatchedFaces []types.ComparedFace
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCompareFacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCompareFaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCompareFaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCompareFacesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCompareFaces(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
}
return nil
}
func newServiceMetadataMiddleware_opCompareFaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CompareFaces",
}
}
| 227 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Copies a version of an Amazon Rekognition Custom Labels model from a source
// project to a destination project. The source and destination projects can be in
// different AWS accounts but must be in the same AWS Region. You can't copy a
// model to another AWS service. To copy a model version to a different AWS
// account, you need to create a resource-based policy known as a project policy.
// You attach the project policy to the source project by calling PutProjectPolicy
// . The project policy gives permission to copy the model version from a trusting
// AWS account to a trusted account. For more information creating and attaching a
// project policy, see Attaching a project policy (SDK) in the Amazon Rekognition
// Custom Labels Developer Guide. If you are copying a model version to a project
// in the same AWS account, you don't need to create a project policy. To copy a
// model, the destination project, source project, and source model version must
// already exist. Copying a model version takes a while to complete. To get the
// current status, call DescribeProjectVersions and check the value of Status in
// the ProjectVersionDescription object. The copy operation has finished when the
// value of Status is COPYING_COMPLETED . This operation requires permissions to
// perform the rekognition:CopyProjectVersion action.
func (c *Client) CopyProjectVersion(ctx context.Context, params *CopyProjectVersionInput, optFns ...func(*Options)) (*CopyProjectVersionOutput, error) {
if params == nil {
params = &CopyProjectVersionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CopyProjectVersion", params, optFns, c.addOperationCopyProjectVersionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CopyProjectVersionOutput)
out.ResultMetadata = metadata
return out, nil
}
type CopyProjectVersionInput struct {
// The ARN of the project in the trusted AWS account that you want to copy the
// model version to.
//
// This member is required.
DestinationProjectArn *string
// The S3 bucket and folder location where the training output for the source
// model version is placed.
//
// This member is required.
OutputConfig *types.OutputConfig
// The ARN of the source project in the trusting AWS account.
//
// This member is required.
SourceProjectArn *string
// The ARN of the model version in the source project that you want to copy to a
// destination project.
//
// This member is required.
SourceProjectVersionArn *string
// A name for the version of the model that's copied to the destination project.
//
// This member is required.
VersionName *string
// The identifier for your AWS Key Management Service key (AWS KMS key). You can
// supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key,
// an alias for your KMS key, or an alias ARN. The key is used to encrypt training
// results and manifest files written to the output Amazon S3 bucket ( OutputConfig
// ). If you choose to use your own KMS key, you need the following permissions on
// the KMS key.
// - kms:CreateGrant
// - kms:DescribeKey
// - kms:GenerateDataKey
// - kms:Decrypt
// If you don't specify a value for KmsKeyId , images copied into the service are
// encrypted using a key that AWS owns and manages.
KmsKeyId *string
// The key-value tags to assign to the model version.
Tags map[string]string
noSmithyDocumentSerde
}
type CopyProjectVersionOutput struct {
// The ARN of the copied model version in the destination project.
ProjectVersionArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCopyProjectVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCopyProjectVersion{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCopyProjectVersion{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCopyProjectVersionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCopyProjectVersion(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
}
return nil
}
func newServiceMetadataMiddleware_opCopyProjectVersion(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CopyProjectVersion",
}
}
| 181 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a collection in an AWS Region. You can add faces to the collection
// using the IndexFaces operation. For example, you might create collections, one
// for each of your application users. A user can then index faces using the
// IndexFaces operation and persist results in a specific collection. Then, a user
// can search the collection for faces in the user-specific container. When you
// create a collection, it is associated with the latest version of the face model
// version. Collection names are case-sensitive. This operation requires
// permissions to perform the rekognition:CreateCollection action. If you want to
// tag your collection, you also require permission to perform the
// rekognition:TagResource operation.
func (c *Client) CreateCollection(ctx context.Context, params *CreateCollectionInput, optFns ...func(*Options)) (*CreateCollectionOutput, error) {
if params == nil {
params = &CreateCollectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateCollection", params, optFns, c.addOperationCreateCollectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateCollectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateCollectionInput struct {
// ID for the collection that you are creating.
//
// This member is required.
CollectionId *string
// A set of tags (key-value pairs) that you want to attach to the collection.
Tags map[string]string
noSmithyDocumentSerde
}
type CreateCollectionOutput struct {
// Amazon Resource Name (ARN) of the collection. You can use this to manage
// permissions on your resources.
CollectionArn *string
// Version number of the face detection model associated with the collection you
// are creating.
FaceModelVersion *string
// HTTP status code indicating the result of the operation.
StatusCode *int32
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateCollectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateCollection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateCollection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateCollectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateCollection(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
}
return nil
}
func newServiceMetadataMiddleware_opCreateCollection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CreateCollection",
}
}
| 144 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new Amazon Rekognition Custom Labels dataset. You can create a
// dataset by using an Amazon Sagemaker format manifest file or by copying an
// existing Amazon Rekognition Custom Labels dataset. To create a training dataset
// for a project, specify train for the value of DatasetType . To create the test
// dataset for a project, specify test for the value of DatasetType . The response
// from CreateDataset is the Amazon Resource Name (ARN) for the dataset. Creating
// a dataset takes a while to complete. Use DescribeDataset to check the current
// status. The dataset created successfully if the value of Status is
// CREATE_COMPLETE . To check if any non-terminal errors occurred, call
// ListDatasetEntries and check for the presence of errors lists in the JSON
// Lines. Dataset creation fails if a terminal error occurs ( Status =
// CREATE_FAILED ). Currently, you can't access the terminal error information. For
// more information, see Creating dataset in the Amazon Rekognition Custom Labels
// Developer Guide. This operation requires permissions to perform the
// rekognition:CreateDataset action. If you want to copy an existing dataset, you
// also require permission to perform the rekognition:ListDatasetEntries action.
func (c *Client) CreateDataset(ctx context.Context, params *CreateDatasetInput, optFns ...func(*Options)) (*CreateDatasetOutput, error) {
if params == nil {
params = &CreateDatasetInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDataset", params, optFns, c.addOperationCreateDatasetMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDatasetOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDatasetInput struct {
// The type of the dataset. Specify train to create a training dataset. Specify
// test to create a test dataset.
//
// This member is required.
DatasetType types.DatasetType
// The ARN of the Amazon Rekognition Custom Labels project to which you want to
// asssign the dataset.
//
// This member is required.
ProjectArn *string
// The source files for the dataset. You can specify the ARN of an existing
// dataset or specify the Amazon S3 bucket location of an Amazon Sagemaker format
// manifest file. If you don't specify datasetSource , an empty dataset is created.
// To add labeled images to the dataset, You can use the console or call
// UpdateDatasetEntries .
DatasetSource *types.DatasetSource
noSmithyDocumentSerde
}
type CreateDatasetOutput struct {
// The ARN of the created Amazon Rekognition Custom Labels dataset.
DatasetArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDatasetMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateDataset{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateDataset{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateDatasetValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDataset(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
}
return nil
}
func newServiceMetadataMiddleware_opCreateDataset(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CreateDataset",
}
}
| 154 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This API operation initiates a Face Liveness session. It returns a SessionId ,
// which you can use to start streaming Face Liveness video and get the results for
// a Face Liveness session. You can use the OutputConfig option in the Settings
// parameter to provide an Amazon S3 bucket location. The Amazon S3 bucket stores
// reference images and audit images. You can use AuditImagesLimit to limit the
// number of audit images returned. This number is between 0 and 4. By default, it
// is set to 0. The limit is best effort and based on the duration of the
// selfie-video.
func (c *Client) CreateFaceLivenessSession(ctx context.Context, params *CreateFaceLivenessSessionInput, optFns ...func(*Options)) (*CreateFaceLivenessSessionOutput, error) {
if params == nil {
params = &CreateFaceLivenessSessionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateFaceLivenessSession", params, optFns, c.addOperationCreateFaceLivenessSessionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateFaceLivenessSessionOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateFaceLivenessSessionInput struct {
// Idempotent token is used to recognize the Face Liveness request. If the same
// token is used with multiple CreateFaceLivenessSession requests, the same
// session is returned. This token is employed to avoid unintentionally creating
// the same session multiple times.
ClientRequestToken *string
// The identifier for your AWS Key Management Service key (AWS KMS key). Used to
// encrypt audit images and reference images.
KmsKeyId *string
// A session settings object. It contains settings for the operation to be
// performed. For Face Liveness, it accepts OutputConfig and AuditImagesLimit .
Settings *types.CreateFaceLivenessSessionRequestSettings
noSmithyDocumentSerde
}
type CreateFaceLivenessSessionOutput struct {
// A unique 128-bit UUID identifying a Face Liveness session.
//
// This member is required.
SessionId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateFaceLivenessSessionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateFaceLivenessSession{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateFaceLivenessSession{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateFaceLivenessSessionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateFaceLivenessSession(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
}
return nil
}
func newServiceMetadataMiddleware_opCreateFaceLivenessSession(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CreateFaceLivenessSession",
}
}
| 143 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new Amazon Rekognition Custom Labels project. A project is a group of
// resources (datasets, model versions) that you use to create and manage Amazon
// Rekognition Custom Labels models. This operation requires permissions to perform
// the rekognition:CreateProject action.
func (c *Client) CreateProject(ctx context.Context, params *CreateProjectInput, optFns ...func(*Options)) (*CreateProjectOutput, error) {
if params == nil {
params = &CreateProjectInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateProject", params, optFns, c.addOperationCreateProjectMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateProjectOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateProjectInput struct {
// The name of the project to create.
//
// This member is required.
ProjectName *string
noSmithyDocumentSerde
}
type CreateProjectOutput struct {
// The Amazon Resource Name (ARN) of the new project. You can use the ARN to
// configure IAM access to the project.
ProjectArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateProjectMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateProject{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateProject{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateProjectValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateProject(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
}
return nil
}
func newServiceMetadataMiddleware_opCreateProject(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CreateProject",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new version of a model and begins training. Models are managed as
// part of an Amazon Rekognition Custom Labels project. The response from
// CreateProjectVersion is an Amazon Resource Name (ARN) for the version of the
// model. Training uses the training and test datasets associated with the project.
// For more information, see Creating training and test dataset in the Amazon
// Rekognition Custom Labels Developer Guide. You can train a model in a project
// that doesn't have associated datasets by specifying manifest files in the
// TrainingData and TestingData fields. If you open the console after training a
// model with manifest files, Amazon Rekognition Custom Labels creates the datasets
// for you using the most recent manifest files. You can no longer train a model
// version for the project by specifying manifest files. Instead of training with a
// project without associated datasets, we recommend that you use the manifest
// files to create training and test datasets for the project. Training takes a
// while to complete. You can get the current status by calling
// DescribeProjectVersions . Training completed successfully if the value of the
// Status field is TRAINING_COMPLETED . If training fails, see Debugging a failed
// model training in the Amazon Rekognition Custom Labels developer guide. Once
// training has successfully completed, call DescribeProjectVersions to get the
// training results and evaluate the model. For more information, see Improving a
// trained Amazon Rekognition Custom Labels model in the Amazon Rekognition Custom
// Labels developers guide. After evaluating the model, you start the model by
// calling StartProjectVersion . This operation requires permissions to perform the
// rekognition:CreateProjectVersion action.
func (c *Client) CreateProjectVersion(ctx context.Context, params *CreateProjectVersionInput, optFns ...func(*Options)) (*CreateProjectVersionOutput, error) {
if params == nil {
params = &CreateProjectVersionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateProjectVersion", params, optFns, c.addOperationCreateProjectVersionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateProjectVersionOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateProjectVersionInput struct {
// The Amazon S3 bucket location to store the results of training. The S3 bucket
// can be in any AWS account as long as the caller has s3:PutObject permissions on
// the S3 bucket.
//
// This member is required.
OutputConfig *types.OutputConfig
// The ARN of the Amazon Rekognition Custom Labels project that manages the model
// that you want to train.
//
// This member is required.
ProjectArn *string
// A name for the version of the model. This value must be unique.
//
// This member is required.
VersionName *string
// The identifier for your AWS Key Management Service key (AWS KMS key). You can
// supply the Amazon Resource Name (ARN) of your KMS key, the ID of your KMS key,
// an alias for your KMS key, or an alias ARN. The key is used to encrypt training
// and test images copied into the service for model training. Your source images
// are unaffected. The key is also used to encrypt training results and manifest
// files written to the output Amazon S3 bucket ( OutputConfig ). If you choose to
// use your own KMS key, you need the following permissions on the KMS key.
// - kms:CreateGrant
// - kms:DescribeKey
// - kms:GenerateDataKey
// - kms:Decrypt
// If you don't specify a value for KmsKeyId , images copied into the service are
// encrypted using a key that AWS owns and manages.
KmsKeyId *string
// A set of tags (key-value pairs) that you want to attach to the model.
Tags map[string]string
// Specifies an external manifest that the service uses to test the model. If you
// specify TestingData you must also specify TrainingData . The project must not
// have any associated datasets.
TestingData *types.TestingData
// Specifies an external manifest that the services uses to train the model. If
// you specify TrainingData you must also specify TestingData . The project must
// not have any associated datasets.
TrainingData *types.TrainingData
noSmithyDocumentSerde
}
type CreateProjectVersionOutput struct {
// The ARN of the model version that was created. Use DescribeProjectVersion to
// get the current status of the training operation.
ProjectVersionArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateProjectVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateProjectVersion{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateProjectVersion{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateProjectVersionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateProjectVersion(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
}
return nil
}
func newServiceMetadataMiddleware_opCreateProjectVersion(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CreateProjectVersion",
}
}
| 189 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an Amazon Rekognition stream processor that you can use to detect and
// recognize faces or to detect labels in a streaming video. Amazon Rekognition
// Video is a consumer of live video from Amazon Kinesis Video Streams. There are
// two different settings for stream processors in Amazon Rekognition: detecting
// faces and detecting labels.
// - If you are creating a stream processor for detecting faces, you provide as
// input a Kinesis video stream ( Input ) and a Kinesis data stream ( Output )
// stream for receiving the output. You must use the FaceSearch option in
// Settings , specifying the collection that contains the faces you want to
// recognize. After you have finished analyzing a streaming video, use
// StopStreamProcessor to stop processing.
// - If you are creating a stream processor to detect labels, you provide as
// input a Kinesis video stream ( Input ), Amazon S3 bucket information ( Output
// ), and an Amazon SNS topic ARN ( NotificationChannel ). You can also provide a
// KMS key ID to encrypt the data sent to your Amazon S3 bucket. You specify what
// you want to detect by using the ConnectedHome option in settings, and
// selecting one of the following: PERSON , PET , PACKAGE , ALL You can also
// specify where in the frame you want Amazon Rekognition to monitor with
// RegionsOfInterest . When you run the StartStreamProcessor operation on a label
// detection stream processor, you input start and stop information to determine
// the length of the processing time.
//
// Use Name to assign an identifier for the stream processor. You use Name to
// manage the stream processor. For example, you can start processing the source
// video by calling StartStreamProcessor with the Name field. This operation
// requires permissions to perform the rekognition:CreateStreamProcessor action.
// If you want to tag your stream processor, you also require permission to perform
// the rekognition:TagResource operation.
func (c *Client) CreateStreamProcessor(ctx context.Context, params *CreateStreamProcessorInput, optFns ...func(*Options)) (*CreateStreamProcessorOutput, error) {
if params == nil {
params = &CreateStreamProcessorInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateStreamProcessor", params, optFns, c.addOperationCreateStreamProcessorMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateStreamProcessorOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateStreamProcessorInput struct {
// Kinesis video stream stream that provides the source streaming video. If you
// are using the AWS CLI, the parameter name is StreamProcessorInput . This is
// required for both face search and label detection stream processors.
//
// This member is required.
Input *types.StreamProcessorInput
// An identifier you assign to the stream processor. You can use Name to manage
// the stream processor. For example, you can get the current status of the stream
// processor by calling DescribeStreamProcessor . Name is idempotent. This is
// required for both face search and label detection stream processors.
//
// This member is required.
Name *string
// Kinesis data stream stream or Amazon S3 bucket location to which Amazon
// Rekognition Video puts the analysis results. If you are using the AWS CLI, the
// parameter name is StreamProcessorOutput . This must be a S3Destination of an
// Amazon S3 bucket that you own for a label detection stream processor or a
// Kinesis data stream ARN for a face search stream processor.
//
// This member is required.
Output *types.StreamProcessorOutput
// The Amazon Resource Number (ARN) of the IAM role that allows access to the
// stream processor. The IAM role provides Rekognition read permissions for a
// Kinesis stream. It also provides write permissions to an Amazon S3 bucket and
// Amazon Simple Notification Service topic for a label detection stream processor.
// This is required for both face search and label detection stream processors.
//
// This member is required.
RoleArn *string
// Input parameters used in a streaming video analyzed by a stream processor. You
// can use FaceSearch to recognize faces in a streaming video, or you can use
// ConnectedHome to detect labels.
//
// This member is required.
Settings *types.StreamProcessorSettings
// Shows whether you are sharing data with Rekognition to improve model
// performance. You can choose this option at the account level or on a per-stream
// basis. Note that if you opt out at the account level this setting is ignored on
// individual streams.
DataSharingPreference *types.StreamProcessorDataSharingPreference
// The identifier for your AWS Key Management Service key (AWS KMS key). This is
// an optional parameter for label detection stream processors and should not be
// used to create a face search stream processor. You can supply the Amazon
// Resource Name (ARN) of your KMS key, the ID of your KMS key, an alias for your
// KMS key, or an alias ARN. The key is used to encrypt results and data published
// to your Amazon S3 bucket, which includes image frames and hero images. Your
// source images are unaffected.
KmsKeyId *string
// The Amazon Simple Notification Service topic to which Amazon Rekognition
// publishes the object detection results and completion status of a video analysis
// operation. Amazon Rekognition publishes a notification the first time an object
// of interest or a person is detected in the video stream. For example, if Amazon
// Rekognition detects a person at second 2, a pet at second 4, and a person again
// at second 5, Amazon Rekognition sends 2 object class detected notifications, one
// for a person at second 2 and one for a pet at second 4. Amazon Rekognition also
// publishes an an end-of-session notification with a summary when the stream
// processing session is complete.
NotificationChannel *types.StreamProcessorNotificationChannel
// Specifies locations in the frames where Amazon Rekognition checks for objects
// or people. You can specify up to 10 regions of interest, and each region has
// either a polygon or a bounding box. This is an optional parameter for label
// detection stream processors and should not be used to create a face search
// stream processor.
RegionsOfInterest []types.RegionOfInterest
// A set of tags (key-value pairs) that you want to attach to the stream processor.
Tags map[string]string
noSmithyDocumentSerde
}
type CreateStreamProcessorOutput struct {
// Amazon Resource Number for the newly created stream processor.
StreamProcessorArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateStreamProcessorMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateStreamProcessor{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateStreamProcessor{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpCreateStreamProcessorValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateStreamProcessor(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
}
return nil
}
func newServiceMetadataMiddleware_opCreateStreamProcessor(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CreateStreamProcessor",
}
}
| 223 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new User within a collection specified by CollectionId . Takes UserId
// as a parameter, which is a user provided ID which should be unique within the
// collection. The provided UserId will alias the system generated UUID to make
// the UserId more user friendly. Uses a ClientToken , an idempotency token that
// ensures a call to CreateUser completes only once. If the value is not supplied,
// the AWS SDK generates an idempotency token for the requests. This prevents
// retries after a network error results from making multiple CreateUser calls.
func (c *Client) CreateUser(ctx context.Context, params *CreateUserInput, optFns ...func(*Options)) (*CreateUserOutput, error) {
if params == nil {
params = &CreateUserInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateUser", params, optFns, c.addOperationCreateUserMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateUserOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateUserInput struct {
// The ID of an existing collection to which the new UserID needs to be created.
//
// This member is required.
CollectionId *string
// ID for the UserID to be created. This ID needs to be unique within the
// collection.
//
// This member is required.
UserId *string
// Idempotent token used to identify the request to CreateUser . If you use the
// same token with multiple CreateUser requests, the same response is returned.
// Use ClientRequestToken to prevent the same request from being processed more
// than once.
ClientRequestToken *string
noSmithyDocumentSerde
}
type CreateUserOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateUserMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateUser{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateUser{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addIdempotencyToken_opCreateUserMiddleware(stack, options); err != nil {
return err
}
if err = addOpCreateUserValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateUser(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
}
return nil
}
type idempotencyToken_initializeOpCreateUser struct {
tokenProvider IdempotencyTokenProvider
}
func (*idempotencyToken_initializeOpCreateUser) ID() string {
return "OperationIdempotencyTokenAutoFill"
}
func (m *idempotencyToken_initializeOpCreateUser) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
if m.tokenProvider == nil {
return next.HandleInitialize(ctx, in)
}
input, ok := in.Parameters.(*CreateUserInput)
if !ok {
return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateUserInput ")
}
if input.ClientRequestToken == nil {
t, err := m.tokenProvider.GetIdempotencyToken()
if err != nil {
return out, metadata, err
}
input.ClientRequestToken = &t
}
return next.HandleInitialize(ctx, in)
}
func addIdempotencyToken_opCreateUserMiddleware(stack *middleware.Stack, cfg Options) error {
return stack.Initialize.Add(&idempotencyToken_initializeOpCreateUser{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
}
func newServiceMetadataMiddleware_opCreateUser(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "CreateUser",
}
}
| 175 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the specified collection. Note that this operation removes all faces in
// the collection. For an example, see Deleting a collection (https://docs.aws.amazon.com/rekognition/latest/dg/delete-collection-procedure.html)
// . This operation requires permissions to perform the
// rekognition:DeleteCollection action.
func (c *Client) DeleteCollection(ctx context.Context, params *DeleteCollectionInput, optFns ...func(*Options)) (*DeleteCollectionOutput, error) {
if params == nil {
params = &DeleteCollectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteCollection", params, optFns, c.addOperationDeleteCollectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteCollectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteCollectionInput struct {
// ID of the collection to delete.
//
// This member is required.
CollectionId *string
noSmithyDocumentSerde
}
type DeleteCollectionOutput struct {
// HTTP status code that indicates the result of the operation.
StatusCode *int32
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteCollectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteCollection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteCollection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteCollectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteCollection(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
}
return nil
}
func newServiceMetadataMiddleware_opDeleteCollection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DeleteCollection",
}
}
| 127 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an existing Amazon Rekognition Custom Labels dataset. Deleting a
// dataset might take while. Use DescribeDataset to check the current status. The
// dataset is still deleting if the value of Status is DELETE_IN_PROGRESS . If you
// try to access the dataset after it is deleted, you get a
// ResourceNotFoundException exception. You can't delete a dataset while it is
// creating ( Status = CREATE_IN_PROGRESS ) or if the dataset is updating ( Status
// = UPDATE_IN_PROGRESS ). This operation requires permissions to perform the
// rekognition:DeleteDataset action.
func (c *Client) DeleteDataset(ctx context.Context, params *DeleteDatasetInput, optFns ...func(*Options)) (*DeleteDatasetOutput, error) {
if params == nil {
params = &DeleteDatasetInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDataset", params, optFns, c.addOperationDeleteDatasetMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDatasetOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDatasetInput struct {
// The ARN of the Amazon Rekognition Custom Labels dataset that you want to delete.
//
// This member is required.
DatasetArn *string
noSmithyDocumentSerde
}
type DeleteDatasetOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDatasetMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteDataset{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteDataset{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteDatasetValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDataset(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
}
return nil
}
func newServiceMetadataMiddleware_opDeleteDataset(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DeleteDataset",
}
}
| 127 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes faces from a collection. You specify a collection ID and an array of
// face IDs to remove from the collection. This operation requires permissions to
// perform the rekognition:DeleteFaces action.
func (c *Client) DeleteFaces(ctx context.Context, params *DeleteFacesInput, optFns ...func(*Options)) (*DeleteFacesOutput, error) {
if params == nil {
params = &DeleteFacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteFaces", params, optFns, c.addOperationDeleteFacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteFacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteFacesInput struct {
// Collection from which to remove the specific faces.
//
// This member is required.
CollectionId *string
// An array of face IDs to delete.
//
// This member is required.
FaceIds []string
noSmithyDocumentSerde
}
type DeleteFacesOutput struct {
// An array of strings (face IDs) of the faces that were deleted.
DeletedFaces []string
// An array of any faces that weren't deleted.
UnsuccessfulFaceDeletions []types.UnsuccessfulFaceDeletion
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteFacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteFaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteFaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteFacesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteFaces(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
}
return nil
}
func newServiceMetadataMiddleware_opDeleteFaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DeleteFaces",
}
}
| 135 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an Amazon Rekognition Custom Labels project. To delete a project you
// must first delete all models associated with the project. To delete a model, see
// DeleteProjectVersion . DeleteProject is an asynchronous operation. To check if
// the project is deleted, call DescribeProjects . The project is deleted when the
// project no longer appears in the response. Be aware that deleting a given
// project will also delete any ProjectPolicies associated with that project. This
// operation requires permissions to perform the rekognition:DeleteProject action.
func (c *Client) DeleteProject(ctx context.Context, params *DeleteProjectInput, optFns ...func(*Options)) (*DeleteProjectOutput, error) {
if params == nil {
params = &DeleteProjectInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteProject", params, optFns, c.addOperationDeleteProjectMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteProjectOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteProjectInput struct {
// The Amazon Resource Name (ARN) of the project that you want to delete.
//
// This member is required.
ProjectArn *string
noSmithyDocumentSerde
}
type DeleteProjectOutput struct {
// The current status of the delete project operation.
Status types.ProjectStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteProjectMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteProject{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteProject{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteProjectValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteProject(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
}
return nil
}
func newServiceMetadataMiddleware_opDeleteProject(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DeleteProject",
}
}
| 131 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an existing project policy. To get a list of project policies attached
// to a project, call ListProjectPolicies . To attach a project policy to a
// project, call PutProjectPolicy . This operation requires permissions to perform
// the rekognition:DeleteProjectPolicy action.
func (c *Client) DeleteProjectPolicy(ctx context.Context, params *DeleteProjectPolicyInput, optFns ...func(*Options)) (*DeleteProjectPolicyOutput, error) {
if params == nil {
params = &DeleteProjectPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteProjectPolicy", params, optFns, c.addOperationDeleteProjectPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteProjectPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteProjectPolicyInput struct {
// The name of the policy that you want to delete.
//
// This member is required.
PolicyName *string
// The Amazon Resource Name (ARN) of the project that the project policy you want
// to delete is attached to.
//
// This member is required.
ProjectArn *string
// The ID of the project policy revision that you want to delete.
PolicyRevisionId *string
noSmithyDocumentSerde
}
type DeleteProjectPolicyOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteProjectPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteProjectPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteProjectPolicy{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteProjectPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteProjectPolicy(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
}
return nil
}
func newServiceMetadataMiddleware_opDeleteProjectPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DeleteProjectPolicy",
}
}
| 132 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an Amazon Rekognition Custom Labels model. You can't delete a model if
// it is running or if it is training. To check the status of a model, use the
// Status field returned from DescribeProjectVersions . To stop a running model
// call StopProjectVersion . If the model is training, wait until it finishes. This
// operation requires permissions to perform the rekognition:DeleteProjectVersion
// action.
func (c *Client) DeleteProjectVersion(ctx context.Context, params *DeleteProjectVersionInput, optFns ...func(*Options)) (*DeleteProjectVersionOutput, error) {
if params == nil {
params = &DeleteProjectVersionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteProjectVersion", params, optFns, c.addOperationDeleteProjectVersionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteProjectVersionOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteProjectVersionInput struct {
// The Amazon Resource Name (ARN) of the model version that you want to delete.
//
// This member is required.
ProjectVersionArn *string
noSmithyDocumentSerde
}
type DeleteProjectVersionOutput struct {
// The status of the deletion operation.
Status types.ProjectVersionStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteProjectVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteProjectVersion{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteProjectVersion{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteProjectVersionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteProjectVersion(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
}
return nil
}
func newServiceMetadataMiddleware_opDeleteProjectVersion(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DeleteProjectVersion",
}
}
| 130 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the stream processor identified by Name . You assign the value for Name
// when you create the stream processor with CreateStreamProcessor . You might not
// be able to use the same name for a stream processor for a few seconds after
// calling DeleteStreamProcessor .
func (c *Client) DeleteStreamProcessor(ctx context.Context, params *DeleteStreamProcessorInput, optFns ...func(*Options)) (*DeleteStreamProcessorOutput, error) {
if params == nil {
params = &DeleteStreamProcessorInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteStreamProcessor", params, optFns, c.addOperationDeleteStreamProcessorMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteStreamProcessorOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteStreamProcessorInput struct {
// The name of the stream processor you want to delete.
//
// This member is required.
Name *string
noSmithyDocumentSerde
}
type DeleteStreamProcessorOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteStreamProcessorMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteStreamProcessor{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteStreamProcessor{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDeleteStreamProcessorValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteStreamProcessor(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
}
return nil
}
func newServiceMetadataMiddleware_opDeleteStreamProcessor(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DeleteStreamProcessor",
}
}
| 123 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes the specified UserID within the collection. Faces that are associated
// with the UserID are disassociated from the UserID before deleting the specified
// UserID. If the specified Collection or UserID is already deleted or not found,
// a ResourceNotFoundException will be thrown. If the action is successful with a
// 200 response, an empty HTTP body is returned.
func (c *Client) DeleteUser(ctx context.Context, params *DeleteUserInput, optFns ...func(*Options)) (*DeleteUserOutput, error) {
if params == nil {
params = &DeleteUserInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteUser", params, optFns, c.addOperationDeleteUserMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteUserOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteUserInput struct {
// The ID of an existing collection from which the UserID needs to be deleted.
//
// This member is required.
CollectionId *string
// ID for the UserID to be deleted.
//
// This member is required.
UserId *string
// Idempotent token used to identify the request to DeleteUser . If you use the
// same token with multiple DeleteUser requests, the same response is returned.
// Use ClientRequestToken to prevent the same request from being processed more
// than once.
ClientRequestToken *string
noSmithyDocumentSerde
}
type DeleteUserOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteUserMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteUser{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteUser{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addIdempotencyToken_opDeleteUserMiddleware(stack, options); err != nil {
return err
}
if err = addOpDeleteUserValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteUser(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
}
return nil
}
type idempotencyToken_initializeOpDeleteUser struct {
tokenProvider IdempotencyTokenProvider
}
func (*idempotencyToken_initializeOpDeleteUser) ID() string {
return "OperationIdempotencyTokenAutoFill"
}
func (m *idempotencyToken_initializeOpDeleteUser) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
if m.tokenProvider == nil {
return next.HandleInitialize(ctx, in)
}
input, ok := in.Parameters.(*DeleteUserInput)
if !ok {
return out, metadata, fmt.Errorf("expected middleware input to be of type *DeleteUserInput ")
}
if input.ClientRequestToken == nil {
t, err := m.tokenProvider.GetIdempotencyToken()
if err != nil {
return out, metadata, err
}
input.ClientRequestToken = &t
}
return next.HandleInitialize(ctx, in)
}
func addIdempotencyToken_opDeleteUserMiddleware(stack *middleware.Stack, cfg Options) error {
return stack.Initialize.Add(&idempotencyToken_initializeOpDeleteUser{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
}
func newServiceMetadataMiddleware_opDeleteUser(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DeleteUser",
}
}
| 172 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Describes the specified collection. You can use DescribeCollection to get
// information, such as the number of faces indexed into a collection and the
// version of the model used by the collection for face detection. For more
// information, see Describing a Collection in the Amazon Rekognition Developer
// Guide.
func (c *Client) DescribeCollection(ctx context.Context, params *DescribeCollectionInput, optFns ...func(*Options)) (*DescribeCollectionOutput, error) {
if params == nil {
params = &DescribeCollectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeCollection", params, optFns, c.addOperationDescribeCollectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeCollectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeCollectionInput struct {
// The ID of the collection to describe.
//
// This member is required.
CollectionId *string
noSmithyDocumentSerde
}
type DescribeCollectionOutput struct {
// The Amazon Resource Name (ARN) of the collection.
CollectionARN *string
// The number of milliseconds since the Unix epoch time until the creation of the
// collection. The Unix epoch time is 00:00:00 Coordinated Universal Time (UTC),
// Thursday, 1 January 1970.
CreationTimestamp *time.Time
// The number of faces that are indexed into the collection. To index faces into a
// collection, use IndexFaces .
FaceCount *int64
// The version of the face model that's used by the collection for face detection.
// For more information, see Model versioning in the Amazon Rekognition Developer
// Guide.
FaceModelVersion *string
// The number of UserIDs assigned to the specified colleciton.
UserCount *int64
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeCollectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeCollection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeCollection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeCollectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeCollection(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
}
return nil
}
func newServiceMetadataMiddleware_opDescribeCollection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DescribeCollection",
}
}
| 146 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Describes an Amazon Rekognition Custom Labels dataset. You can get information
// such as the current status of a dataset and statistics about the images and
// labels in a dataset. This operation requires permissions to perform the
// rekognition:DescribeDataset action.
func (c *Client) DescribeDataset(ctx context.Context, params *DescribeDatasetInput, optFns ...func(*Options)) (*DescribeDatasetOutput, error) {
if params == nil {
params = &DescribeDatasetInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDataset", params, optFns, c.addOperationDescribeDatasetMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDatasetOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDatasetInput struct {
// The Amazon Resource Name (ARN) of the dataset that you want to describe.
//
// This member is required.
DatasetArn *string
noSmithyDocumentSerde
}
type DescribeDatasetOutput struct {
// The description for the dataset.
DatasetDescription *types.DatasetDescription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDatasetMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeDataset{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeDataset{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeDatasetValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDataset(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
}
return nil
}
func newServiceMetadataMiddleware_opDescribeDataset(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DescribeDataset",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets information about your Amazon Rekognition Custom Labels projects. This
// operation requires permissions to perform the rekognition:DescribeProjects
// action.
func (c *Client) DescribeProjects(ctx context.Context, params *DescribeProjectsInput, optFns ...func(*Options)) (*DescribeProjectsOutput, error) {
if params == nil {
params = &DescribeProjectsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeProjects", params, optFns, c.addOperationDescribeProjectsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeProjectsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeProjectsInput struct {
// The maximum number of results to return per paginated call. The largest value
// you can specify is 100. If you specify a value greater than 100, a
// ValidationException error occurs. The default value is 100.
MaxResults *int32
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
// A list of the projects that you want Amazon Rekognition Custom Labels to
// describe. If you don't specify a value, the response includes descriptions for
// all the projects in your AWS account.
ProjectNames []string
noSmithyDocumentSerde
}
type DescribeProjectsOutput struct {
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
// A list of project descriptions. The list is sorted by the date and time the
// projects are created.
ProjectDescriptions []types.ProjectDescription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeProjectsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeProjects{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeProjects{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeProjects(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
}
return nil
}
// DescribeProjectsAPIClient is a client that implements the DescribeProjects
// operation.
type DescribeProjectsAPIClient interface {
DescribeProjects(context.Context, *DescribeProjectsInput, ...func(*Options)) (*DescribeProjectsOutput, error)
}
var _ DescribeProjectsAPIClient = (*Client)(nil)
// DescribeProjectsPaginatorOptions is the paginator options for DescribeProjects
type DescribeProjectsPaginatorOptions struct {
// The maximum number of results to return per paginated call. The largest value
// you can specify is 100. If you specify a value greater than 100, a
// ValidationException error occurs. The default value is 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeProjectsPaginator is a paginator for DescribeProjects
type DescribeProjectsPaginator struct {
options DescribeProjectsPaginatorOptions
client DescribeProjectsAPIClient
params *DescribeProjectsInput
nextToken *string
firstPage bool
}
// NewDescribeProjectsPaginator returns a new DescribeProjectsPaginator
func NewDescribeProjectsPaginator(client DescribeProjectsAPIClient, params *DescribeProjectsInput, optFns ...func(*DescribeProjectsPaginatorOptions)) *DescribeProjectsPaginator {
if params == nil {
params = &DescribeProjectsInput{}
}
options := DescribeProjectsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeProjectsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeProjectsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeProjects page.
func (p *DescribeProjectsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeProjectsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.DescribeProjects(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opDescribeProjects(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DescribeProjects",
}
}
| 233 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithytime "github.com/aws/smithy-go/time"
smithyhttp "github.com/aws/smithy-go/transport/http"
smithywaiter "github.com/aws/smithy-go/waiter"
"github.com/jmespath/go-jmespath"
"time"
)
// Lists and describes the versions of a model in an Amazon Rekognition Custom
// Labels project. You can specify up to 10 model versions in ProjectVersionArns .
// If you don't specify a value, descriptions for all model versions in the project
// are returned. This operation requires permissions to perform the
// rekognition:DescribeProjectVersions action.
func (c *Client) DescribeProjectVersions(ctx context.Context, params *DescribeProjectVersionsInput, optFns ...func(*Options)) (*DescribeProjectVersionsOutput, error) {
if params == nil {
params = &DescribeProjectVersionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeProjectVersions", params, optFns, c.addOperationDescribeProjectVersionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeProjectVersionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeProjectVersionsInput struct {
// The Amazon Resource Name (ARN) of the project that contains the models you want
// to describe.
//
// This member is required.
ProjectArn *string
// The maximum number of results to return per paginated call. The largest value
// you can specify is 100. If you specify a value greater than 100, a
// ValidationException error occurs. The default value is 100.
MaxResults *int32
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
// A list of model version names that you want to describe. You can add up to 10
// model version names to the list. If you don't specify a value, all model
// descriptions are returned. A version name is part of a model (ProjectVersion)
// ARN. For example, my-model.2020-01-21T09.10.15 is the version name in the
// following ARN.
// arn:aws:rekognition:us-east-1:123456789012:project/getting-started/version/my-model.2020-01-21T09.10.15/1234567890123
// .
VersionNames []string
noSmithyDocumentSerde
}
type DescribeProjectVersionsOutput struct {
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
// A list of model descriptions. The list is sorted by the creation date and time
// of the model versions, latest to earliest.
ProjectVersionDescriptions []types.ProjectVersionDescription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeProjectVersionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeProjectVersions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeProjectVersions{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeProjectVersionsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeProjectVersions(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
}
return nil
}
// DescribeProjectVersionsAPIClient is a client that implements the
// DescribeProjectVersions operation.
type DescribeProjectVersionsAPIClient interface {
DescribeProjectVersions(context.Context, *DescribeProjectVersionsInput, ...func(*Options)) (*DescribeProjectVersionsOutput, error)
}
var _ DescribeProjectVersionsAPIClient = (*Client)(nil)
// DescribeProjectVersionsPaginatorOptions is the paginator options for
// DescribeProjectVersions
type DescribeProjectVersionsPaginatorOptions struct {
// The maximum number of results to return per paginated call. The largest value
// you can specify is 100. If you specify a value greater than 100, a
// ValidationException error occurs. The default value is 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeProjectVersionsPaginator is a paginator for DescribeProjectVersions
type DescribeProjectVersionsPaginator struct {
options DescribeProjectVersionsPaginatorOptions
client DescribeProjectVersionsAPIClient
params *DescribeProjectVersionsInput
nextToken *string
firstPage bool
}
// NewDescribeProjectVersionsPaginator returns a new
// DescribeProjectVersionsPaginator
func NewDescribeProjectVersionsPaginator(client DescribeProjectVersionsAPIClient, params *DescribeProjectVersionsInput, optFns ...func(*DescribeProjectVersionsPaginatorOptions)) *DescribeProjectVersionsPaginator {
if params == nil {
params = &DescribeProjectVersionsInput{}
}
options := DescribeProjectVersionsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeProjectVersionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeProjectVersionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeProjectVersions page.
func (p *DescribeProjectVersionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeProjectVersionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.DescribeProjectVersions(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
// ProjectVersionRunningWaiterOptions are waiter options for
// ProjectVersionRunningWaiter
type ProjectVersionRunningWaiterOptions struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// MinDelay is the minimum amount of time to delay between retries. If unset,
// ProjectVersionRunningWaiter will use default minimum delay of 30 seconds. Note
// that MinDelay must resolve to a value lesser than or equal to the MaxDelay.
MinDelay time.Duration
// MaxDelay is the maximum amount of time to delay between retries. If unset or
// set to zero, ProjectVersionRunningWaiter will use default max delay of 120
// seconds. Note that MaxDelay must resolve to value greater than or equal to the
// MinDelay.
MaxDelay time.Duration
// LogWaitAttempts is used to enable logging for waiter retry attempts
LogWaitAttempts bool
// Retryable is function that can be used to override the service defined
// waiter-behavior based on operation output, or returned error. This function is
// used by the waiter to decide if a state is retryable or a terminal state. By
// default service-modeled logic will populate this option. This option can thus be
// used to define a custom waiter state with fall-back to service-modeled waiter
// state mutators.The function returns an error in case of a failure state. In case
// of retry state, this function returns a bool value of true and nil error, while
// in case of success it returns a bool value of false and nil error.
Retryable func(context.Context, *DescribeProjectVersionsInput, *DescribeProjectVersionsOutput, error) (bool, error)
}
// ProjectVersionRunningWaiter defines the waiters for ProjectVersionRunning
type ProjectVersionRunningWaiter struct {
client DescribeProjectVersionsAPIClient
options ProjectVersionRunningWaiterOptions
}
// NewProjectVersionRunningWaiter constructs a ProjectVersionRunningWaiter.
func NewProjectVersionRunningWaiter(client DescribeProjectVersionsAPIClient, optFns ...func(*ProjectVersionRunningWaiterOptions)) *ProjectVersionRunningWaiter {
options := ProjectVersionRunningWaiterOptions{}
options.MinDelay = 30 * time.Second
options.MaxDelay = 120 * time.Second
options.Retryable = projectVersionRunningStateRetryable
for _, fn := range optFns {
fn(&options)
}
return &ProjectVersionRunningWaiter{
client: client,
options: options,
}
}
// Wait calls the waiter function for ProjectVersionRunning waiter. The maxWaitDur
// is the maximum wait duration the waiter will wait. The maxWaitDur is required
// and must be greater than zero.
func (w *ProjectVersionRunningWaiter) Wait(ctx context.Context, params *DescribeProjectVersionsInput, maxWaitDur time.Duration, optFns ...func(*ProjectVersionRunningWaiterOptions)) error {
_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)
return err
}
// WaitForOutput calls the waiter function for ProjectVersionRunning waiter and
// returns the output of the successful operation. The maxWaitDur is the maximum
// wait duration the waiter will wait. The maxWaitDur is required and must be
// greater than zero.
func (w *ProjectVersionRunningWaiter) WaitForOutput(ctx context.Context, params *DescribeProjectVersionsInput, maxWaitDur time.Duration, optFns ...func(*ProjectVersionRunningWaiterOptions)) (*DescribeProjectVersionsOutput, error) {
if maxWaitDur <= 0 {
return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero")
}
options := w.options
for _, fn := range optFns {
fn(&options)
}
if options.MaxDelay <= 0 {
options.MaxDelay = 120 * time.Second
}
if options.MinDelay > options.MaxDelay {
return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay)
}
ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur)
defer cancelFn()
logger := smithywaiter.Logger{}
remainingTime := maxWaitDur
var attempt int64
for {
attempt++
apiOptions := options.APIOptions
start := time.Now()
if options.LogWaitAttempts {
logger.Attempt = attempt
apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...)
apiOptions = append(apiOptions, logger.AddLogger)
}
out, err := w.client.DescribeProjectVersions(ctx, params, func(o *Options) {
o.APIOptions = append(o.APIOptions, apiOptions...)
})
retryable, err := options.Retryable(ctx, params, out, err)
if err != nil {
return nil, err
}
if !retryable {
return out, nil
}
remainingTime -= time.Since(start)
if remainingTime < options.MinDelay || remainingTime <= 0 {
break
}
// compute exponential backoff between waiter retries
delay, err := smithywaiter.ComputeDelay(
attempt, options.MinDelay, options.MaxDelay, remainingTime,
)
if err != nil {
return nil, fmt.Errorf("error computing waiter delay, %w", err)
}
remainingTime -= delay
// sleep for the delay amount before invoking a request
if err := smithytime.SleepWithContext(ctx, delay); err != nil {
return nil, fmt.Errorf("request cancelled while waiting, %w", err)
}
}
return nil, fmt.Errorf("exceeded max wait time for ProjectVersionRunning waiter")
}
func projectVersionRunningStateRetryable(ctx context.Context, input *DescribeProjectVersionsInput, output *DescribeProjectVersionsOutput, err error) (bool, error) {
if err == nil {
pathValue, err := jmespath.Search("ProjectVersionDescriptions[].Status", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "RUNNING"
var match = true
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
if len(listOfValues) == 0 {
match = false
}
for _, v := range listOfValues {
value, ok := v.(types.ProjectVersionStatus)
if !ok {
return false, fmt.Errorf("waiter comparator expected types.ProjectVersionStatus value, got %T", pathValue)
}
if string(value) != expectedValue {
match = false
}
}
if match {
return false, nil
}
}
if err == nil {
pathValue, err := jmespath.Search("ProjectVersionDescriptions[].Status", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "FAILED"
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
for _, v := range listOfValues {
value, ok := v.(types.ProjectVersionStatus)
if !ok {
return false, fmt.Errorf("waiter comparator expected types.ProjectVersionStatus value, got %T", pathValue)
}
if string(value) == expectedValue {
return false, fmt.Errorf("waiter state transitioned to Failure")
}
}
}
return true, nil
}
// ProjectVersionTrainingCompletedWaiterOptions are waiter options for
// ProjectVersionTrainingCompletedWaiter
type ProjectVersionTrainingCompletedWaiterOptions struct {
// Set of options to modify how an operation is invoked. These apply to all
// operations invoked for this client. Use functional options on operation call to
// modify this list for per operation behavior.
APIOptions []func(*middleware.Stack) error
// MinDelay is the minimum amount of time to delay between retries. If unset,
// ProjectVersionTrainingCompletedWaiter will use default minimum delay of 120
// seconds. Note that MinDelay must resolve to a value lesser than or equal to the
// MaxDelay.
MinDelay time.Duration
// MaxDelay is the maximum amount of time to delay between retries. If unset or
// set to zero, ProjectVersionTrainingCompletedWaiter will use default max delay of
// 120 seconds. Note that MaxDelay must resolve to value greater than or equal to
// the MinDelay.
MaxDelay time.Duration
// LogWaitAttempts is used to enable logging for waiter retry attempts
LogWaitAttempts bool
// Retryable is function that can be used to override the service defined
// waiter-behavior based on operation output, or returned error. This function is
// used by the waiter to decide if a state is retryable or a terminal state. By
// default service-modeled logic will populate this option. This option can thus be
// used to define a custom waiter state with fall-back to service-modeled waiter
// state mutators.The function returns an error in case of a failure state. In case
// of retry state, this function returns a bool value of true and nil error, while
// in case of success it returns a bool value of false and nil error.
Retryable func(context.Context, *DescribeProjectVersionsInput, *DescribeProjectVersionsOutput, error) (bool, error)
}
// ProjectVersionTrainingCompletedWaiter defines the waiters for
// ProjectVersionTrainingCompleted
type ProjectVersionTrainingCompletedWaiter struct {
client DescribeProjectVersionsAPIClient
options ProjectVersionTrainingCompletedWaiterOptions
}
// NewProjectVersionTrainingCompletedWaiter constructs a
// ProjectVersionTrainingCompletedWaiter.
func NewProjectVersionTrainingCompletedWaiter(client DescribeProjectVersionsAPIClient, optFns ...func(*ProjectVersionTrainingCompletedWaiterOptions)) *ProjectVersionTrainingCompletedWaiter {
options := ProjectVersionTrainingCompletedWaiterOptions{}
options.MinDelay = 120 * time.Second
options.MaxDelay = 120 * time.Second
options.Retryable = projectVersionTrainingCompletedStateRetryable
for _, fn := range optFns {
fn(&options)
}
return &ProjectVersionTrainingCompletedWaiter{
client: client,
options: options,
}
}
// Wait calls the waiter function for ProjectVersionTrainingCompleted waiter. The
// maxWaitDur is the maximum wait duration the waiter will wait. The maxWaitDur is
// required and must be greater than zero.
func (w *ProjectVersionTrainingCompletedWaiter) Wait(ctx context.Context, params *DescribeProjectVersionsInput, maxWaitDur time.Duration, optFns ...func(*ProjectVersionTrainingCompletedWaiterOptions)) error {
_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)
return err
}
// WaitForOutput calls the waiter function for ProjectVersionTrainingCompleted
// waiter and returns the output of the successful operation. The maxWaitDur is the
// maximum wait duration the waiter will wait. The maxWaitDur is required and must
// be greater than zero.
func (w *ProjectVersionTrainingCompletedWaiter) WaitForOutput(ctx context.Context, params *DescribeProjectVersionsInput, maxWaitDur time.Duration, optFns ...func(*ProjectVersionTrainingCompletedWaiterOptions)) (*DescribeProjectVersionsOutput, error) {
if maxWaitDur <= 0 {
return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero")
}
options := w.options
for _, fn := range optFns {
fn(&options)
}
if options.MaxDelay <= 0 {
options.MaxDelay = 120 * time.Second
}
if options.MinDelay > options.MaxDelay {
return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay)
}
ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur)
defer cancelFn()
logger := smithywaiter.Logger{}
remainingTime := maxWaitDur
var attempt int64
for {
attempt++
apiOptions := options.APIOptions
start := time.Now()
if options.LogWaitAttempts {
logger.Attempt = attempt
apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...)
apiOptions = append(apiOptions, logger.AddLogger)
}
out, err := w.client.DescribeProjectVersions(ctx, params, func(o *Options) {
o.APIOptions = append(o.APIOptions, apiOptions...)
})
retryable, err := options.Retryable(ctx, params, out, err)
if err != nil {
return nil, err
}
if !retryable {
return out, nil
}
remainingTime -= time.Since(start)
if remainingTime < options.MinDelay || remainingTime <= 0 {
break
}
// compute exponential backoff between waiter retries
delay, err := smithywaiter.ComputeDelay(
attempt, options.MinDelay, options.MaxDelay, remainingTime,
)
if err != nil {
return nil, fmt.Errorf("error computing waiter delay, %w", err)
}
remainingTime -= delay
// sleep for the delay amount before invoking a request
if err := smithytime.SleepWithContext(ctx, delay); err != nil {
return nil, fmt.Errorf("request cancelled while waiting, %w", err)
}
}
return nil, fmt.Errorf("exceeded max wait time for ProjectVersionTrainingCompleted waiter")
}
func projectVersionTrainingCompletedStateRetryable(ctx context.Context, input *DescribeProjectVersionsInput, output *DescribeProjectVersionsOutput, err error) (bool, error) {
if err == nil {
pathValue, err := jmespath.Search("ProjectVersionDescriptions[].Status", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "TRAINING_COMPLETED"
var match = true
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
if len(listOfValues) == 0 {
match = false
}
for _, v := range listOfValues {
value, ok := v.(types.ProjectVersionStatus)
if !ok {
return false, fmt.Errorf("waiter comparator expected types.ProjectVersionStatus value, got %T", pathValue)
}
if string(value) != expectedValue {
match = false
}
}
if match {
return false, nil
}
}
if err == nil {
pathValue, err := jmespath.Search("ProjectVersionDescriptions[].Status", output)
if err != nil {
return false, fmt.Errorf("error evaluating waiter state: %w", err)
}
expectedValue := "TRAINING_FAILED"
listOfValues, ok := pathValue.([]interface{})
if !ok {
return false, fmt.Errorf("waiter comparator expected list got %T", pathValue)
}
for _, v := range listOfValues {
value, ok := v.(types.ProjectVersionStatus)
if !ok {
return false, fmt.Errorf("waiter comparator expected types.ProjectVersionStatus value, got %T", pathValue)
}
if string(value) == expectedValue {
return false, fmt.Errorf("waiter state transitioned to Failure")
}
}
}
return true, nil
}
func newServiceMetadataMiddleware_opDescribeProjectVersions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DescribeProjectVersions",
}
}
| 659 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Provides information about a stream processor created by CreateStreamProcessor .
// You can get information about the input and output streams, the input parameters
// for the face recognition being performed, and the current status of the stream
// processor.
func (c *Client) DescribeStreamProcessor(ctx context.Context, params *DescribeStreamProcessorInput, optFns ...func(*Options)) (*DescribeStreamProcessorOutput, error) {
if params == nil {
params = &DescribeStreamProcessorInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeStreamProcessor", params, optFns, c.addOperationDescribeStreamProcessorMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeStreamProcessorOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeStreamProcessorInput struct {
// Name of the stream processor for which you want information.
//
// This member is required.
Name *string
noSmithyDocumentSerde
}
type DescribeStreamProcessorOutput struct {
// Date and time the stream processor was created
CreationTimestamp *time.Time
// Shows whether you are sharing data with Rekognition to improve model
// performance. You can choose this option at the account level or on a per-stream
// basis. Note that if you opt out at the account level this setting is ignored on
// individual streams.
DataSharingPreference *types.StreamProcessorDataSharingPreference
// Kinesis video stream that provides the source streaming video.
Input *types.StreamProcessorInput
// The identifier for your AWS Key Management Service key (AWS KMS key). This is
// an optional parameter for label detection stream processors.
KmsKeyId *string
// The time, in Unix format, the stream processor was last updated. For example,
// when the stream processor moves from a running state to a failed state, or when
// the user starts or stops the stream processor.
LastUpdateTimestamp *time.Time
// Name of the stream processor.
Name *string
// The Amazon Simple Notification Service topic to which Amazon Rekognition
// publishes the object detection results and completion status of a video analysis
// operation. Amazon Rekognition publishes a notification the first time an object
// of interest or a person is detected in the video stream. For example, if Amazon
// Rekognition detects a person at second 2, a pet at second 4, and a person again
// at second 5, Amazon Rekognition sends 2 object class detected notifications, one
// for a person at second 2 and one for a pet at second 4. Amazon Rekognition also
// publishes an an end-of-session notification with a summary when the stream
// processing session is complete.
NotificationChannel *types.StreamProcessorNotificationChannel
// Kinesis data stream to which Amazon Rekognition Video puts the analysis results.
Output *types.StreamProcessorOutput
// Specifies locations in the frames where Amazon Rekognition checks for objects
// or people. This is an optional parameter for label detection stream processors.
RegionsOfInterest []types.RegionOfInterest
// ARN of the IAM role that allows access to the stream processor.
RoleArn *string
// Input parameters used in a streaming video analyzed by a stream processor. You
// can use FaceSearch to recognize faces in a streaming video, or you can use
// ConnectedHome to detect labels.
Settings *types.StreamProcessorSettings
// Current status of the stream processor.
Status types.StreamProcessorStatus
// Detailed status message about the stream processor.
StatusMessage *string
// ARN of the stream processor.
StreamProcessorArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeStreamProcessorMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDescribeStreamProcessor{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDescribeStreamProcessor{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDescribeStreamProcessorValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeStreamProcessor(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
}
return nil
}
func newServiceMetadataMiddleware_opDescribeStreamProcessor(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DescribeStreamProcessor",
}
}
| 185 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Detects custom labels in a supplied image by using an Amazon Rekognition Custom
// Labels model. You specify which version of a model version to use by using the
// ProjectVersionArn input parameter. You pass the input image as base64-encoded
// image bytes or as a reference to an image in an Amazon S3 bucket. If you use the
// AWS CLI to call Amazon Rekognition operations, passing image bytes is not
// supported. The image must be either a PNG or JPEG formatted file. For each
// object that the model version detects on an image, the API returns a (
// CustomLabel ) object in an array ( CustomLabels ). Each CustomLabel object
// provides the label name ( Name ), the level of confidence that the image
// contains the object ( Confidence ), and object location information, if it
// exists, for the label on the image ( Geometry ). To filter labels that are
// returned, specify a value for MinConfidence . DetectCustomLabelsLabels only
// returns labels with a confidence that's higher than the specified value. The
// value of MinConfidence maps to the assumed threshold values created during
// training. For more information, see Assumed threshold in the Amazon Rekognition
// Custom Labels Developer Guide. Amazon Rekognition Custom Labels metrics
// expresses an assumed threshold as a floating point value between 0-1. The range
// of MinConfidence normalizes the threshold value to a percentage value (0-100).
// Confidence responses from DetectCustomLabels are also returned as a percentage.
// You can use MinConfidence to change the precision and recall or your model. For
// more information, see Analyzing an image in the Amazon Rekognition Custom Labels
// Developer Guide. If you don't specify a value for MinConfidence ,
// DetectCustomLabels returns labels based on the assumed threshold of each label.
// This is a stateless API operation. That is, the operation does not persist any
// data. This operation requires permissions to perform the
// rekognition:DetectCustomLabels action. For more information, see Analyzing an
// image in the Amazon Rekognition Custom Labels Developer Guide.
func (c *Client) DetectCustomLabels(ctx context.Context, params *DetectCustomLabelsInput, optFns ...func(*Options)) (*DetectCustomLabelsOutput, error) {
if params == nil {
params = &DetectCustomLabelsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DetectCustomLabels", params, optFns, c.addOperationDetectCustomLabelsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DetectCustomLabelsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DetectCustomLabelsInput struct {
// Provides the input image either as bytes or an S3 object. You pass image bytes
// to an Amazon Rekognition API operation by using the Bytes property. For
// example, you would use the Bytes property to pass an image loaded from a local
// file system. Image bytes passed by using the Bytes property must be
// base64-encoded. Your code may not need to encode image bytes if you are using an
// AWS SDK to call Amazon Rekognition API operations. For more information, see
// Analyzing an Image Loaded from a Local File System in the Amazon Rekognition
// Developer Guide. You pass images stored in an S3 bucket to an Amazon Rekognition
// API operation by using the S3Object property. Images stored in an S3 bucket do
// not need to be base64-encoded. The region for the S3 bucket containing the S3
// object must match the region you use for Amazon Rekognition operations. If you
// use the AWS CLI to call Amazon Rekognition operations, passing image bytes using
// the Bytes property is not supported. You must first upload the image to an
// Amazon S3 bucket and then call the operation using the S3Object property. For
// Amazon Rekognition to process an S3 object, the user must have permission to
// access the S3 object. For more information, see How Amazon Rekognition works
// with IAM in the Amazon Rekognition Developer Guide.
//
// This member is required.
Image *types.Image
// The ARN of the model version that you want to use.
//
// This member is required.
ProjectVersionArn *string
// Maximum number of results you want the service to return in the response. The
// service returns the specified number of highest confidence labels ranked from
// highest confidence to lowest.
MaxResults *int32
// Specifies the minimum confidence level for the labels to return.
// DetectCustomLabels doesn't return any labels with a confidence value that's
// lower than this specified value. If you specify a value of 0, DetectCustomLabels
// returns all labels, regardless of the assumed threshold applied to each label.
// If you don't specify a value for MinConfidence , DetectCustomLabels returns
// labels based on the assumed threshold of each label.
MinConfidence *float32
noSmithyDocumentSerde
}
type DetectCustomLabelsOutput struct {
// An array of custom labels detected in the input image.
CustomLabels []types.CustomLabel
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDetectCustomLabelsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectCustomLabels{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectCustomLabels{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDetectCustomLabelsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectCustomLabels(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
}
return nil
}
func newServiceMetadataMiddleware_opDetectCustomLabels(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DetectCustomLabels",
}
}
| 185 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Detects faces within an image that is provided as input. DetectFaces detects
// the 100 largest faces in the image. For each face detected, the operation
// returns face details. These details include a bounding box of the face, a
// confidence value (that the bounding box contains a face), and a fixed set of
// attributes such as facial landmarks (for example, coordinates of eye and mouth),
// pose, presence of facial occlusion, and so on. The face-detection algorithm is
// most effective on frontal faces. For non-frontal or obscured faces, the
// algorithm might not detect the faces or might detect faces with lower
// confidence. You pass the input image either as base64-encoded image bytes or as
// a reference to an image in an Amazon S3 bucket. If you use the AWS CLI to call
// Amazon Rekognition operations, passing image bytes is not supported. The image
// must be either a PNG or JPEG formatted file. This is a stateless API operation.
// That is, the operation does not persist any data. This operation requires
// permissions to perform the rekognition:DetectFaces action.
func (c *Client) DetectFaces(ctx context.Context, params *DetectFacesInput, optFns ...func(*Options)) (*DetectFacesOutput, error) {
if params == nil {
params = &DetectFacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DetectFaces", params, optFns, c.addOperationDetectFacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DetectFacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DetectFacesInput struct {
// The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI
// to call Amazon Rekognition operations, passing base64-encoded image bytes is not
// supported. If you are using an AWS SDK to call Amazon Rekognition, you might not
// need to base64-encode image bytes passed using the Bytes field. For more
// information, see Images in the Amazon Rekognition developer guide.
//
// This member is required.
Image *types.Image
// An array of facial attributes you want to be returned. A DEFAULT subset of
// facial attributes - BoundingBox , Confidence , Pose , Quality , and Landmarks -
// will always be returned. You can request for specific facial attributes (in
// addition to the default list) - by using [ "DEFAULT", "FACE_OCCLUDED" ] or just [
// "FACE_OCCLUDED" ]. You can request for all facial attributes by using [ "ALL"] .
// Requesting more attributes may increase response time. If you provide both,
// ["ALL", "DEFAULT"] , the service uses a logical "AND" operator to determine
// which attributes to return (in this case, all attributes).
Attributes []types.Attribute
noSmithyDocumentSerde
}
type DetectFacesOutput struct {
// Details of each face found in the image.
FaceDetails []types.FaceDetail
// The value of OrientationCorrection is always null. If the input image is in
// .jpeg format, it might contain exchangeable image file format (Exif) metadata
// that includes the image's orientation. Amazon Rekognition uses this orientation
// information to perform image correction. The bounding box coordinates are
// translated to represent object locations after the orientation information in
// the Exif metadata is used to correct the image orientation. Images in .png
// format don't contain Exif metadata. Amazon Rekognition doesn’t perform image
// correction for images in .png format and .jpeg images without orientation
// information in the image Exif metadata. The bounding box coordinates aren't
// translated and represent the object locations before the image is rotated.
OrientationCorrection types.OrientationCorrection
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDetectFacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectFaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectFaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDetectFacesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectFaces(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
}
return nil
}
func newServiceMetadataMiddleware_opDetectFaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DetectFaces",
}
}
| 164 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Detects instances of real-world entities within an image (JPEG or PNG) provided
// as input. This includes objects like flower, tree, and table; events like
// wedding, graduation, and birthday party; and concepts like landscape, evening,
// and nature. For an example, see Analyzing images stored in an Amazon S3 bucket
// in the Amazon Rekognition Developer Guide. You pass the input image as
// base64-encoded image bytes or as a reference to an image in an Amazon S3 bucket.
// If you use the AWS CLI to call Amazon Rekognition operations, passing image
// bytes is not supported. The image must be either a PNG or JPEG formatted file.
// Optional Parameters You can specify one or both of the GENERAL_LABELS and
// IMAGE_PROPERTIES feature types when calling the DetectLabels API. Including
// GENERAL_LABELS will ensure the response includes the labels detected in the
// input image, while including IMAGE_PROPERTIES will ensure the response includes
// information about the image quality and color. When using GENERAL_LABELS and/or
// IMAGE_PROPERTIES you can provide filtering criteria to the Settings parameter.
// You can filter with sets of individual labels or with label categories. You can
// specify inclusive filters, exclusive filters, or a combination of inclusive and
// exclusive filters. For more information on filtering see Detecting Labels in an
// Image (https://docs.aws.amazon.com/rekognition/latest/dg/labels-detect-labels-image.html)
// . You can specify MinConfidence to control the confidence threshold for the
// labels returned. The default is 55%. You can also add the MaxLabels parameter
// to limit the number of labels returned. The default and upper limit is 1000
// labels. Response Elements For each object, scene, and concept the API returns
// one or more labels. The API returns the following types of information about
// labels:
// - Name - The name of the detected label.
// - Confidence - The level of confidence in the label assigned to a detected
// object.
// - Parents - The ancestor labels for a detected label. DetectLabels returns a
// hierarchical taxonomy of detected labels. For example, a detected car might be
// assigned the label car. The label car has two parent labels: Vehicle (its
// parent) and Transportation (its grandparent). The response includes the all
// ancestors for a label, where every ancestor is a unique label. In the previous
// example, Car, Vehicle, and Transportation are returned as unique labels in the
// response.
// - Aliases - Possible Aliases for the label.
// - Categories - The label categories that the detected label belongs to.
// - BoundingBox — Bounding boxes are described for all instances of detected
// common object labels, returned in an array of Instance objects. An Instance
// object contains a BoundingBox object, describing the location of the label on
// the input image. It also includes the confidence for the accuracy of the
// detected bounding box.
//
// The API returns the following information regarding the image, as part of the
// ImageProperties structure:
// - Quality - Information about the Sharpness, Brightness, and Contrast of the
// input image, scored between 0 to 100. Image quality is returned for the entire
// image, as well as the background and the foreground.
// - Dominant Color - An array of the dominant colors in the image.
// - Foreground - Information about the sharpness, brightness, and dominant
// colors of the input image’s foreground.
// - Background - Information about the sharpness, brightness, and dominant
// colors of the input image’s background.
//
// The list of returned labels will include at least one label for every detected
// object, along with information about that label. In the following example,
// suppose the input image has a lighthouse, the sea, and a rock. The response
// includes all three labels, one for each object, as well as the confidence in the
// label: {Name: lighthouse, Confidence: 98.4629}
//
// {Name: rock,Confidence: 79.2097}
//
// {Name: sea,Confidence: 75.061} The list of labels can include multiple labels
// for the same object. For example, if the input image shows a flower (for
// example, a tulip), the operation might return the following three labels.
// {Name: flower,Confidence: 99.0562}
//
// {Name: plant,Confidence: 99.0562}
//
// {Name: tulip,Confidence: 99.0562} In this example, the detection algorithm more
// precisely identifies the flower as a tulip. If the object detected is a person,
// the operation doesn't provide the same facial details that the DetectFaces
// operation provides. This is a stateless API operation that doesn't return any
// data. This operation requires permissions to perform the
// rekognition:DetectLabels action.
func (c *Client) DetectLabels(ctx context.Context, params *DetectLabelsInput, optFns ...func(*Options)) (*DetectLabelsOutput, error) {
if params == nil {
params = &DetectLabelsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DetectLabels", params, optFns, c.addOperationDetectLabelsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DetectLabelsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DetectLabelsInput struct {
// The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI
// to call Amazon Rekognition operations, passing image bytes is not supported.
// Images stored in an S3 Bucket do not need to be base64-encoded. If you are using
// an AWS SDK to call Amazon Rekognition, you might not need to base64-encode image
// bytes passed using the Bytes field. For more information, see Images in the
// Amazon Rekognition developer guide.
//
// This member is required.
Image *types.Image
// A list of the types of analysis to perform. Specifying GENERAL_LABELS uses the
// label detection feature, while specifying IMAGE_PROPERTIES returns information
// regarding image color and quality. If no option is specified GENERAL_LABELS is
// used by default.
Features []types.DetectLabelsFeatureName
// Maximum number of labels you want the service to return in the response. The
// service returns the specified number of highest confidence labels.
MaxLabels *int32
// Specifies the minimum confidence level for the labels to return. Amazon
// Rekognition doesn't return any labels with confidence lower than this specified
// value. If MinConfidence is not specified, the operation returns labels with a
// confidence values greater than or equal to 55 percent.
MinConfidence *float32
// A list of the filters to be applied to returned detected labels and image
// properties. Specified filters can be inclusive, exclusive, or a combination of
// both. Filters can be used for individual labels or label categories. The exact
// label names or label categories must be supplied. For a full list of labels and
// label categories, see Detecting labels (https://docs.aws.amazon.com/rekognition/latest/dg/labels.html)
// .
Settings *types.DetectLabelsSettings
noSmithyDocumentSerde
}
type DetectLabelsOutput struct {
// Information about the properties of the input image, such as brightness,
// sharpness, contrast, and dominant colors.
ImageProperties *types.DetectLabelsImageProperties
// Version number of the label detection model that was used to detect labels.
LabelModelVersion *string
// An array of labels for the real-world objects detected.
Labels []types.Label
// The value of OrientationCorrection is always null. If the input image is in
// .jpeg format, it might contain exchangeable image file format (Exif) metadata
// that includes the image's orientation. Amazon Rekognition uses this orientation
// information to perform image correction. The bounding box coordinates are
// translated to represent object locations after the orientation information in
// the Exif metadata is used to correct the image orientation. Images in .png
// format don't contain Exif metadata. Amazon Rekognition doesn’t perform image
// correction for images in .png format and .jpeg images without orientation
// information in the image Exif metadata. The bounding box coordinates aren't
// translated and represent the object locations before the image is rotated.
OrientationCorrection types.OrientationCorrection
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDetectLabelsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectLabels{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectLabels{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDetectLabelsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectLabels(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
}
return nil
}
func newServiceMetadataMiddleware_opDetectLabels(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DetectLabels",
}
}
| 246 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Detects unsafe content in a specified JPEG or PNG format image. Use
// DetectModerationLabels to moderate images depending on your requirements. For
// example, you might want to filter images that contain nudity, but not images
// containing suggestive content. To filter images, use the labels returned by
// DetectModerationLabels to determine which types of content are appropriate. For
// information about moderation labels, see Detecting Unsafe Content in the Amazon
// Rekognition Developer Guide. You pass the input image either as base64-encoded
// image bytes or as a reference to an image in an Amazon S3 bucket. If you use the
// AWS CLI to call Amazon Rekognition operations, passing image bytes is not
// supported. The image must be either a PNG or JPEG formatted file.
func (c *Client) DetectModerationLabels(ctx context.Context, params *DetectModerationLabelsInput, optFns ...func(*Options)) (*DetectModerationLabelsOutput, error) {
if params == nil {
params = &DetectModerationLabelsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DetectModerationLabels", params, optFns, c.addOperationDetectModerationLabelsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DetectModerationLabelsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DetectModerationLabelsInput struct {
// The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI
// to call Amazon Rekognition operations, passing base64-encoded image bytes is not
// supported. If you are using an AWS SDK to call Amazon Rekognition, you might not
// need to base64-encode image bytes passed using the Bytes field. For more
// information, see Images in the Amazon Rekognition developer guide.
//
// This member is required.
Image *types.Image
// Sets up the configuration for human evaluation, including the FlowDefinition
// the image will be sent to.
HumanLoopConfig *types.HumanLoopConfig
// Specifies the minimum confidence level for the labels to return. Amazon
// Rekognition doesn't return any labels with a confidence level lower than this
// specified value. If you don't specify MinConfidence , the operation returns
// labels with confidence values greater than or equal to 50 percent.
MinConfidence *float32
noSmithyDocumentSerde
}
type DetectModerationLabelsOutput struct {
// Shows the results of the human in the loop evaluation.
HumanLoopActivationOutput *types.HumanLoopActivationOutput
// Array of detected Moderation labels and the time, in milliseconds from the
// start of the video, they were detected.
ModerationLabels []types.ModerationLabel
// Version number of the moderation detection model that was used to detect unsafe
// content.
ModerationModelVersion *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDetectModerationLabelsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectModerationLabels{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectModerationLabels{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDetectModerationLabelsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectModerationLabels(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
}
return nil
}
func newServiceMetadataMiddleware_opDetectModerationLabels(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DetectModerationLabels",
}
}
| 156 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Detects Personal Protective Equipment (PPE) worn by people detected in an
// image. Amazon Rekognition can detect the following types of PPE.
// - Face cover
// - Hand cover
// - Head cover
//
// You pass the input image as base64-encoded image bytes or as a reference to an
// image in an Amazon S3 bucket. The image must be either a PNG or JPG formatted
// file. DetectProtectiveEquipment detects PPE worn by up to 15 persons detected
// in an image. For each person detected in the image the API returns an array of
// body parts (face, head, left-hand, right-hand). For each body part, an array of
// detected items of PPE is returned, including an indicator of whether or not the
// PPE covers the body part. The API returns the confidence it has in each
// detection (person, PPE, body part and body part coverage). It also returns a
// bounding box ( BoundingBox ) for each detected person and each detected item of
// PPE. You can optionally request a summary of detected PPE items with the
// SummarizationAttributes input parameter. The summary provides the following
// information.
// - The persons detected as wearing all of the types of PPE that you specify.
// - The persons detected as not wearing all of the types PPE that you specify.
// - The persons detected where PPE adornment could not be determined.
//
// This is a stateless API operation. That is, the operation does not persist any
// data. This operation requires permissions to perform the
// rekognition:DetectProtectiveEquipment action.
func (c *Client) DetectProtectiveEquipment(ctx context.Context, params *DetectProtectiveEquipmentInput, optFns ...func(*Options)) (*DetectProtectiveEquipmentOutput, error) {
if params == nil {
params = &DetectProtectiveEquipmentInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DetectProtectiveEquipment", params, optFns, c.addOperationDetectProtectiveEquipmentMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DetectProtectiveEquipmentOutput)
out.ResultMetadata = metadata
return out, nil
}
type DetectProtectiveEquipmentInput struct {
// The image in which you want to detect PPE on detected persons. The image can be
// passed as image bytes or you can reference an image stored in an Amazon S3
// bucket.
//
// This member is required.
Image *types.Image
// An array of PPE types that you want to summarize.
SummarizationAttributes *types.ProtectiveEquipmentSummarizationAttributes
noSmithyDocumentSerde
}
type DetectProtectiveEquipmentOutput struct {
// An array of persons detected in the image (including persons not wearing PPE).
Persons []types.ProtectiveEquipmentPerson
// The version number of the PPE detection model used to detect PPE in the image.
ProtectiveEquipmentModelVersion *string
// Summary information for the types of PPE specified in the
// SummarizationAttributes input parameter.
Summary *types.ProtectiveEquipmentSummary
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDetectProtectiveEquipmentMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectProtectiveEquipment{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectProtectiveEquipment{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDetectProtectiveEquipmentValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectProtectiveEquipment(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
}
return nil
}
func newServiceMetadataMiddleware_opDetectProtectiveEquipment(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DetectProtectiveEquipment",
}
}
| 161 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Detects text in the input image and converts it into machine-readable text.
// Pass the input image as base64-encoded image bytes or as a reference to an image
// in an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition
// operations, you must pass it as a reference to an image in an Amazon S3 bucket.
// For the AWS CLI, passing image bytes is not supported. The image must be either
// a .png or .jpeg formatted file. The DetectText operation returns text in an
// array of TextDetection elements, TextDetections . Each TextDetection element
// provides information about a single word or line of text that was detected in
// the image. A word is one or more script characters that are not separated by
// spaces. DetectText can detect up to 100 words in an image. A line is a string
// of equally spaced words. A line isn't necessarily a complete sentence. For
// example, a driver's license number is detected as a line. A line ends when there
// is no aligned text after it. Also, a line ends when there is a large gap between
// words, relative to the length of the words. This means, depending on the gap
// between words, Amazon Rekognition may detect multiple lines in text aligned in
// the same direction. Periods don't represent the end of a line. If a sentence
// spans multiple lines, the DetectText operation returns multiple lines. To
// determine whether a TextDetection element is a line of text or a word, use the
// TextDetection object Type field. To be detected, text must be within +/- 90
// degrees orientation of the horizontal axis. For more information, see Detecting
// text in the Amazon Rekognition Developer Guide.
func (c *Client) DetectText(ctx context.Context, params *DetectTextInput, optFns ...func(*Options)) (*DetectTextOutput, error) {
if params == nil {
params = &DetectTextInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DetectText", params, optFns, c.addOperationDetectTextMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DetectTextOutput)
out.ResultMetadata = metadata
return out, nil
}
type DetectTextInput struct {
// The input image as base64-encoded bytes or an Amazon S3 object. If you use the
// AWS CLI to call Amazon Rekognition operations, you can't pass image bytes. If
// you are using an AWS SDK to call Amazon Rekognition, you might not need to
// base64-encode image bytes passed using the Bytes field. For more information,
// see Images in the Amazon Rekognition developer guide.
//
// This member is required.
Image *types.Image
// Optional parameters that let you set the criteria that the text must meet to be
// included in your response.
Filters *types.DetectTextFilters
noSmithyDocumentSerde
}
type DetectTextOutput struct {
// An array of text that was detected in the input image.
TextDetections []types.TextDetection
// The model version used to detect text.
TextModelVersion *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDetectTextMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectText{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectText{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDetectTextValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectText(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
}
return nil
}
func newServiceMetadataMiddleware_opDetectText(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DetectText",
}
}
| 156 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Removes the association between a Face supplied in an array of FaceIds and the
// User. If the User is not present already, then a ResourceNotFound exception is
// thrown. If successful, an array of faces that are disassociated from the User is
// returned. If a given face is already disassociated from the given UserID, it
// will be ignored and not be returned in the response. If a given face is already
// associated with a different User or not found in the collection it will be
// returned as part of UnsuccessfulDisassociations . You can remove 1 - 100 face
// IDs from a user at one time.
func (c *Client) DisassociateFaces(ctx context.Context, params *DisassociateFacesInput, optFns ...func(*Options)) (*DisassociateFacesOutput, error) {
if params == nil {
params = &DisassociateFacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DisassociateFaces", params, optFns, c.addOperationDisassociateFacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DisassociateFacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DisassociateFacesInput struct {
// The ID of an existing collection containing the UserID.
//
// This member is required.
CollectionId *string
// An array of face IDs to disassociate from the UserID.
//
// This member is required.
FaceIds []string
// ID for the existing UserID.
//
// This member is required.
UserId *string
// Idempotent token used to identify the request to DisassociateFaces . If you use
// the same token with multiple DisassociateFaces requests, the same response is
// returned. Use ClientRequestToken to prevent the same request from being
// processed more than once.
ClientRequestToken *string
noSmithyDocumentSerde
}
type DisassociateFacesOutput struct {
// An array of DissociatedFace objects containing FaceIds that are successfully
// disassociated with the UserID is returned. Returned if the DisassociatedFaces
// action is successful.
DisassociatedFaces []types.DisassociatedFace
// An array of UnsuccessfulDisassociation objects containing FaceIds that are not
// successfully associated, along with the reasons for the failure to associate.
// Returned if the DisassociateFaces action is successful.
UnsuccessfulFaceDisassociations []types.UnsuccessfulFaceDisassociation
// The status of an update made to a User. Reflects if the User has been updated
// for every requested change.
UserStatus types.UserStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDisassociateFacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDisassociateFaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDisassociateFaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addIdempotencyToken_opDisassociateFacesMiddleware(stack, options); err != nil {
return err
}
if err = addOpDisassociateFacesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateFaces(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
}
return nil
}
type idempotencyToken_initializeOpDisassociateFaces struct {
tokenProvider IdempotencyTokenProvider
}
func (*idempotencyToken_initializeOpDisassociateFaces) ID() string {
return "OperationIdempotencyTokenAutoFill"
}
func (m *idempotencyToken_initializeOpDisassociateFaces) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
if m.tokenProvider == nil {
return next.HandleInitialize(ctx, in)
}
input, ok := in.Parameters.(*DisassociateFacesInput)
if !ok {
return out, metadata, fmt.Errorf("expected middleware input to be of type *DisassociateFacesInput ")
}
if input.ClientRequestToken == nil {
t, err := m.tokenProvider.GetIdempotencyToken()
if err != nil {
return out, metadata, err
}
input.ClientRequestToken = &t
}
return next.HandleInitialize(ctx, in)
}
func addIdempotencyToken_opDisassociateFacesMiddleware(stack *middleware.Stack, cfg Options) error {
return stack.Initialize.Add(&idempotencyToken_initializeOpDisassociateFaces{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before)
}
func newServiceMetadataMiddleware_opDisassociateFaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DisassociateFaces",
}
}
| 196 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Distributes the entries (images) in a training dataset across the training
// dataset and the test dataset for a project. DistributeDatasetEntries moves 20%
// of the training dataset images to the test dataset. An entry is a JSON Line that
// describes an image. You supply the Amazon Resource Names (ARN) of a project's
// training dataset and test dataset. The training dataset must contain the images
// that you want to split. The test dataset must be empty. The datasets must belong
// to the same project. To create training and test datasets for a project, call
// CreateDataset . Distributing a dataset takes a while to complete. To check the
// status call DescribeDataset . The operation is complete when the Status field
// for the training dataset and the test dataset is UPDATE_COMPLETE . If the
// dataset split fails, the value of Status is UPDATE_FAILED . This operation
// requires permissions to perform the rekognition:DistributeDatasetEntries action.
func (c *Client) DistributeDatasetEntries(ctx context.Context, params *DistributeDatasetEntriesInput, optFns ...func(*Options)) (*DistributeDatasetEntriesOutput, error) {
if params == nil {
params = &DistributeDatasetEntriesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DistributeDatasetEntries", params, optFns, c.addOperationDistributeDatasetEntriesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DistributeDatasetEntriesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DistributeDatasetEntriesInput struct {
// The ARNS for the training dataset and test dataset that you want to use. The
// datasets must belong to the same project. The test dataset must be empty.
//
// This member is required.
Datasets []types.DistributeDataset
noSmithyDocumentSerde
}
type DistributeDatasetEntriesOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDistributeDatasetEntriesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpDistributeDatasetEntries{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDistributeDatasetEntries{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpDistributeDatasetEntriesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDistributeDatasetEntries(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
}
return nil
}
func newServiceMetadataMiddleware_opDistributeDatasetEntries(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "DistributeDatasetEntries",
}
}
| 133 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the name and additional information about a celebrity based on their
// Amazon Rekognition ID. The additional information is returned as an array of
// URLs. If there is no additional information about the celebrity, this list is
// empty. For more information, see Getting information about a celebrity in the
// Amazon Rekognition Developer Guide. This operation requires permissions to
// perform the rekognition:GetCelebrityInfo action.
func (c *Client) GetCelebrityInfo(ctx context.Context, params *GetCelebrityInfoInput, optFns ...func(*Options)) (*GetCelebrityInfoOutput, error) {
if params == nil {
params = &GetCelebrityInfoInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetCelebrityInfo", params, optFns, c.addOperationGetCelebrityInfoMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetCelebrityInfoOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetCelebrityInfoInput struct {
// The ID for the celebrity. You get the celebrity ID from a call to the
// RecognizeCelebrities operation, which recognizes celebrities in an image.
//
// This member is required.
Id *string
noSmithyDocumentSerde
}
type GetCelebrityInfoOutput struct {
// Retrieves the known gender for the celebrity.
KnownGender *types.KnownGender
// The name of the celebrity.
Name *string
// An array of URLs pointing to additional celebrity information.
Urls []string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetCelebrityInfoMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetCelebrityInfo{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetCelebrityInfo{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetCelebrityInfoValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetCelebrityInfo(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
}
return nil
}
func newServiceMetadataMiddleware_opGetCelebrityInfo(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetCelebrityInfo",
}
}
| 137 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the celebrity recognition results for a Amazon Rekognition Video analysis
// started by StartCelebrityRecognition . Celebrity recognition in a video is an
// asynchronous operation. Analysis is started by a call to
// StartCelebrityRecognition which returns a job identifier ( JobId ). When the
// celebrity recognition operation finishes, Amazon Rekognition Video publishes a
// completion status to the Amazon Simple Notification Service topic registered in
// the initial call to StartCelebrityRecognition . To get the results of the
// celebrity recognition analysis, first check that the status value published to
// the Amazon SNS topic is SUCCEEDED . If so, call GetCelebrityDetection and pass
// the job identifier ( JobId ) from the initial call to StartCelebrityDetection .
// For more information, see Working With Stored Videos in the Amazon Rekognition
// Developer Guide. GetCelebrityRecognition returns detected celebrities and the
// time(s) they are detected in an array ( Celebrities ) of CelebrityRecognition
// objects. Each CelebrityRecognition contains information about the celebrity in
// a CelebrityDetail object and the time, Timestamp , the celebrity was detected.
// This CelebrityDetail object stores information about the detected celebrity's
// face attributes, a face bounding box, known gender, the celebrity's name, and a
// confidence estimate. GetCelebrityRecognition only returns the default facial
// attributes ( BoundingBox , Confidence , Landmarks , Pose , and Quality ). The
// BoundingBox field only applies to the detected face instance. The other facial
// attributes listed in the Face object of the following response syntax are not
// returned. For more information, see FaceDetail in the Amazon Rekognition
// Developer Guide. By default, the Celebrities array is sorted by time
// (milliseconds from the start of the video). You can also sort the array by
// celebrity by specifying the value ID in the SortBy input parameter. The
// CelebrityDetail object includes the celebrity identifer and additional
// information urls. If you don't store the additional information urls, you can
// get them later by calling GetCelebrityInfo with the celebrity identifer. No
// information is returned for faces not recognized as celebrities. Use MaxResults
// parameter to limit the number of labels returned. If there are more results than
// specified in MaxResults , the value of NextToken in the operation response
// contains a pagination token for getting the next set of results. To get the next
// page of results, call GetCelebrityDetection and populate the NextToken request
// parameter with the token value returned from the previous call to
// GetCelebrityRecognition .
func (c *Client) GetCelebrityRecognition(ctx context.Context, params *GetCelebrityRecognitionInput, optFns ...func(*Options)) (*GetCelebrityRecognitionOutput, error) {
if params == nil {
params = &GetCelebrityRecognitionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetCelebrityRecognition", params, optFns, c.addOperationGetCelebrityRecognitionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetCelebrityRecognitionOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetCelebrityRecognitionInput struct {
// Job identifier for the required celebrity recognition analysis. You can get the
// job identifer from a call to StartCelebrityRecognition .
//
// This member is required.
JobId *string
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
MaxResults *int32
// If the previous response was incomplete (because there is more recognized
// celebrities to retrieve), Amazon Rekognition Video returns a pagination token in
// the response. You can use this pagination token to retrieve the next set of
// celebrities.
NextToken *string
// Sort to use for celebrities returned in Celebrities field. Specify ID to sort
// by the celebrity identifier, specify TIMESTAMP to sort by the time the
// celebrity was recognized.
SortBy types.CelebrityRecognitionSortBy
noSmithyDocumentSerde
}
type GetCelebrityRecognitionOutput struct {
// Array of celebrities recognized in the video.
Celebrities []types.CelebrityRecognition
// Job identifier for the celebrity recognition operation for which you want to
// obtain results. The job identifer is returned by an initial call to
// StartCelebrityRecognition.
JobId *string
// The current status of the celebrity recognition job.
JobStatus types.VideoJobStatus
// A job identifier specified in the call to StartCelebrityRecognition and
// returned in the job completion notification sent to your Amazon Simple
// Notification Service topic.
JobTag *string
// If the response is truncated, Amazon Rekognition Video returns this token that
// you can use in the subsequent request to retrieve the next set of celebrities.
NextToken *string
// If the job fails, StatusMessage provides a descriptive error message.
StatusMessage *string
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
Video *types.Video
// Information about a video that Amazon Rekognition Video analyzed. Videometadata
// is returned in every page of paginated responses from a Amazon Rekognition Video
// operation.
VideoMetadata *types.VideoMetadata
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetCelebrityRecognitionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetCelebrityRecognition{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetCelebrityRecognition{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetCelebrityRecognitionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetCelebrityRecognition(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
}
return nil
}
// GetCelebrityRecognitionAPIClient is a client that implements the
// GetCelebrityRecognition operation.
type GetCelebrityRecognitionAPIClient interface {
GetCelebrityRecognition(context.Context, *GetCelebrityRecognitionInput, ...func(*Options)) (*GetCelebrityRecognitionOutput, error)
}
var _ GetCelebrityRecognitionAPIClient = (*Client)(nil)
// GetCelebrityRecognitionPaginatorOptions is the paginator options for
// GetCelebrityRecognition
type GetCelebrityRecognitionPaginatorOptions struct {
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// GetCelebrityRecognitionPaginator is a paginator for GetCelebrityRecognition
type GetCelebrityRecognitionPaginator struct {
options GetCelebrityRecognitionPaginatorOptions
client GetCelebrityRecognitionAPIClient
params *GetCelebrityRecognitionInput
nextToken *string
firstPage bool
}
// NewGetCelebrityRecognitionPaginator returns a new
// GetCelebrityRecognitionPaginator
func NewGetCelebrityRecognitionPaginator(client GetCelebrityRecognitionAPIClient, params *GetCelebrityRecognitionInput, optFns ...func(*GetCelebrityRecognitionPaginatorOptions)) *GetCelebrityRecognitionPaginator {
if params == nil {
params = &GetCelebrityRecognitionInput{}
}
options := GetCelebrityRecognitionPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &GetCelebrityRecognitionPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *GetCelebrityRecognitionPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next GetCelebrityRecognition page.
func (p *GetCelebrityRecognitionPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetCelebrityRecognitionOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.GetCelebrityRecognition(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opGetCelebrityRecognition(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetCelebrityRecognition",
}
}
| 301 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the inappropriate, unwanted, or offensive content analysis results for a
// Amazon Rekognition Video analysis started by StartContentModeration . For a list
// of moderation labels in Amazon Rekognition, see Using the image and video
// moderation APIs (https://docs.aws.amazon.com/rekognition/latest/dg/moderation.html#moderation-api)
// . Amazon Rekognition Video inappropriate or offensive content detection in a
// stored video is an asynchronous operation. You start analysis by calling
// StartContentModeration which returns a job identifier ( JobId ). When analysis
// finishes, Amazon Rekognition Video publishes a completion status to the Amazon
// Simple Notification Service topic registered in the initial call to
// StartContentModeration . To get the results of the content analysis, first check
// that the status value published to the Amazon SNS topic is SUCCEEDED . If so,
// call GetContentModeration and pass the job identifier ( JobId ) from the initial
// call to StartContentModeration . For more information, see Working with Stored
// Videos in the Amazon Rekognition Devlopers Guide. GetContentModeration returns
// detected inappropriate, unwanted, or offensive content moderation labels, and
// the time they are detected, in an array, ModerationLabels , of
// ContentModerationDetection objects. By default, the moderated labels are
// returned sorted by time, in milliseconds from the start of the video. You can
// also sort them by moderated label by specifying NAME for the SortBy input
// parameter. Since video analysis can return a large number of results, use the
// MaxResults parameter to limit the number of labels returned in a single call to
// GetContentModeration . If there are more results than specified in MaxResults ,
// the value of NextToken in the operation response contains a pagination token
// for getting the next set of results. To get the next page of results, call
// GetContentModeration and populate the NextToken request parameter with the
// value of NextToken returned from the previous call to GetContentModeration . For
// more information, see moderating content in the Amazon Rekognition Developer
// Guide.
func (c *Client) GetContentModeration(ctx context.Context, params *GetContentModerationInput, optFns ...func(*Options)) (*GetContentModerationOutput, error) {
if params == nil {
params = &GetContentModerationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetContentModeration", params, optFns, c.addOperationGetContentModerationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetContentModerationOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetContentModerationInput struct {
// The identifier for the inappropriate, unwanted, or offensive content moderation
// job. Use JobId to identify the job in a subsequent call to GetContentModeration .
//
// This member is required.
JobId *string
// Defines how to aggregate results of the StartContentModeration request. Default
// aggregation option is TIMESTAMPS. SEGMENTS mode aggregates moderation labels
// over time.
AggregateBy types.ContentModerationAggregateBy
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
MaxResults *int32
// If the previous response was incomplete (because there is more data to
// retrieve), Amazon Rekognition returns a pagination token in the response. You
// can use this pagination token to retrieve the next set of content moderation
// labels.
NextToken *string
// Sort to use for elements in the ModerationLabelDetections array. Use TIMESTAMP
// to sort array elements by the time labels are detected. Use NAME to
// alphabetically group elements for a label together. Within each label group, the
// array element are sorted by detection confidence. The default sort is by
// TIMESTAMP .
SortBy types.ContentModerationSortBy
noSmithyDocumentSerde
}
type GetContentModerationOutput struct {
// Information about the paramters used when getting a response. Includes
// information on aggregation and sorting methods.
GetRequestMetadata *types.GetContentModerationRequestMetadata
// Job identifier for the content moderation operation for which you want to
// obtain results. The job identifer is returned by an initial call to
// StartContentModeration.
JobId *string
// The current status of the content moderation analysis job.
JobStatus types.VideoJobStatus
// A job identifier specified in the call to StartContentModeration and returned
// in the job completion notification sent to your Amazon Simple Notification
// Service topic.
JobTag *string
// The detected inappropriate, unwanted, or offensive content moderation labels
// and the time(s) they were detected.
ModerationLabels []types.ContentModerationDetection
// Version number of the moderation detection model that was used to detect
// inappropriate, unwanted, or offensive content.
ModerationModelVersion *string
// If the response is truncated, Amazon Rekognition Video returns this token that
// you can use in the subsequent request to retrieve the next set of content
// moderation labels.
NextToken *string
// If the job fails, StatusMessage provides a descriptive error message.
StatusMessage *string
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
Video *types.Video
// Information about a video that Amazon Rekognition analyzed. Videometadata is
// returned in every page of paginated responses from GetContentModeration .
VideoMetadata *types.VideoMetadata
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetContentModerationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetContentModeration{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetContentModeration{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetContentModerationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetContentModeration(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
}
return nil
}
// GetContentModerationAPIClient is a client that implements the
// GetContentModeration operation.
type GetContentModerationAPIClient interface {
GetContentModeration(context.Context, *GetContentModerationInput, ...func(*Options)) (*GetContentModerationOutput, error)
}
var _ GetContentModerationAPIClient = (*Client)(nil)
// GetContentModerationPaginatorOptions is the paginator options for
// GetContentModeration
type GetContentModerationPaginatorOptions struct {
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// GetContentModerationPaginator is a paginator for GetContentModeration
type GetContentModerationPaginator struct {
options GetContentModerationPaginatorOptions
client GetContentModerationAPIClient
params *GetContentModerationInput
nextToken *string
firstPage bool
}
// NewGetContentModerationPaginator returns a new GetContentModerationPaginator
func NewGetContentModerationPaginator(client GetContentModerationAPIClient, params *GetContentModerationInput, optFns ...func(*GetContentModerationPaginatorOptions)) *GetContentModerationPaginator {
if params == nil {
params = &GetContentModerationInput{}
}
options := GetContentModerationPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &GetContentModerationPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *GetContentModerationPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next GetContentModeration page.
func (p *GetContentModerationPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetContentModerationOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.GetContentModeration(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opGetContentModeration(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetContentModeration",
}
}
| 309 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets face detection results for a Amazon Rekognition Video analysis started by
// StartFaceDetection . Face detection with Amazon Rekognition Video is an
// asynchronous operation. You start face detection by calling StartFaceDetection
// which returns a job identifier ( JobId ). When the face detection operation
// finishes, Amazon Rekognition Video publishes a completion status to the Amazon
// Simple Notification Service topic registered in the initial call to
// StartFaceDetection . To get the results of the face detection operation, first
// check that the status value published to the Amazon SNS topic is SUCCEEDED . If
// so, call GetFaceDetection and pass the job identifier ( JobId ) from the initial
// call to StartFaceDetection . GetFaceDetection returns an array of detected
// faces ( Faces ) sorted by the time the faces were detected. Use MaxResults
// parameter to limit the number of labels returned. If there are more results than
// specified in MaxResults , the value of NextToken in the operation response
// contains a pagination token for getting the next set of results. To get the next
// page of results, call GetFaceDetection and populate the NextToken request
// parameter with the token value returned from the previous call to
// GetFaceDetection .
func (c *Client) GetFaceDetection(ctx context.Context, params *GetFaceDetectionInput, optFns ...func(*Options)) (*GetFaceDetectionOutput, error) {
if params == nil {
params = &GetFaceDetectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetFaceDetection", params, optFns, c.addOperationGetFaceDetectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetFaceDetectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetFaceDetectionInput struct {
// Unique identifier for the face detection job. The JobId is returned from
// StartFaceDetection .
//
// This member is required.
JobId *string
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
MaxResults *int32
// If the previous response was incomplete (because there are more faces to
// retrieve), Amazon Rekognition Video returns a pagination token in the response.
// You can use this pagination token to retrieve the next set of faces.
NextToken *string
noSmithyDocumentSerde
}
type GetFaceDetectionOutput struct {
// An array of faces detected in the video. Each element contains a detected
// face's details and the time, in milliseconds from the start of the video, the
// face was detected.
Faces []types.FaceDetection
// Job identifier for the face detection operation for which you want to obtain
// results. The job identifer is returned by an initial call to StartFaceDetection.
JobId *string
// The current status of the face detection job.
JobStatus types.VideoJobStatus
// A job identifier specified in the call to StartFaceDetection and returned in
// the job completion notification sent to your Amazon Simple Notification Service
// topic.
JobTag *string
// If the response is truncated, Amazon Rekognition returns this token that you
// can use in the subsequent request to retrieve the next set of faces.
NextToken *string
// If the job fails, StatusMessage provides a descriptive error message.
StatusMessage *string
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
Video *types.Video
// Information about a video that Amazon Rekognition Video analyzed. Videometadata
// is returned in every page of paginated responses from a Amazon Rekognition video
// operation.
VideoMetadata *types.VideoMetadata
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetFaceDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetFaceDetection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetFaceDetection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetFaceDetectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetFaceDetection(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
}
return nil
}
// GetFaceDetectionAPIClient is a client that implements the GetFaceDetection
// operation.
type GetFaceDetectionAPIClient interface {
GetFaceDetection(context.Context, *GetFaceDetectionInput, ...func(*Options)) (*GetFaceDetectionOutput, error)
}
var _ GetFaceDetectionAPIClient = (*Client)(nil)
// GetFaceDetectionPaginatorOptions is the paginator options for GetFaceDetection
type GetFaceDetectionPaginatorOptions struct {
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// GetFaceDetectionPaginator is a paginator for GetFaceDetection
type GetFaceDetectionPaginator struct {
options GetFaceDetectionPaginatorOptions
client GetFaceDetectionAPIClient
params *GetFaceDetectionInput
nextToken *string
firstPage bool
}
// NewGetFaceDetectionPaginator returns a new GetFaceDetectionPaginator
func NewGetFaceDetectionPaginator(client GetFaceDetectionAPIClient, params *GetFaceDetectionInput, optFns ...func(*GetFaceDetectionPaginatorOptions)) *GetFaceDetectionPaginator {
if params == nil {
params = &GetFaceDetectionInput{}
}
options := GetFaceDetectionPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &GetFaceDetectionPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *GetFaceDetectionPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next GetFaceDetection page.
func (p *GetFaceDetectionPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetFaceDetectionOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.GetFaceDetection(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opGetFaceDetection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetFaceDetection",
}
}
| 276 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Retrieves the results of a specific Face Liveness session. It requires the
// sessionId as input, which was created using CreateFaceLivenessSession . Returns
// the corresponding Face Liveness confidence score, a reference image that
// includes a face bounding box, and audit images that also contain face bounding
// boxes. The Face Liveness confidence score ranges from 0 to 100. The reference
// image can optionally be returned.
func (c *Client) GetFaceLivenessSessionResults(ctx context.Context, params *GetFaceLivenessSessionResultsInput, optFns ...func(*Options)) (*GetFaceLivenessSessionResultsOutput, error) {
if params == nil {
params = &GetFaceLivenessSessionResultsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetFaceLivenessSessionResults", params, optFns, c.addOperationGetFaceLivenessSessionResultsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetFaceLivenessSessionResultsOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetFaceLivenessSessionResultsInput struct {
// A unique 128-bit UUID. This is used to uniquely identify the session and also
// acts as an idempotency token for all operations associated with the session.
//
// This member is required.
SessionId *string
noSmithyDocumentSerde
}
type GetFaceLivenessSessionResultsOutput struct {
// The sessionId for which this request was called.
//
// This member is required.
SessionId *string
// Represents a status corresponding to the state of the session. Possible
// statuses are: CREATED, IN_PROGRESS, SUCCEEDED, FAILED, EXPIRED.
//
// This member is required.
Status types.LivenessSessionStatus
// A set of images from the Face Liveness video that can be used for audit
// purposes. It includes a bounding box of the face and the Base64-encoded bytes
// that return an image. If the CreateFaceLivenessSession request included an
// OutputConfig argument, the image will be uploaded to an S3Object specified in
// the output configuration.
AuditImages []types.AuditImage
// Probabalistic confidence score for if the person in the given video was live,
// represented as a float value between 0 to 100.
Confidence *float32
// A high-quality image from the Face Liveness video that can be used for face
// comparison or search. It includes a bounding box of the face and the
// Base64-encoded bytes that return an image. If the CreateFaceLivenessSession
// request included an OutputConfig argument, the image will be uploaded to an
// S3Object specified in the output configuration. In case the reference image is
// not returned, it's recommended to retry the Liveness check.
ReferenceImage *types.AuditImage
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetFaceLivenessSessionResultsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetFaceLivenessSessionResults{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetFaceLivenessSessionResults{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetFaceLivenessSessionResultsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetFaceLivenessSessionResults(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
}
return nil
}
func newServiceMetadataMiddleware_opGetFaceLivenessSessionResults(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetFaceLivenessSessionResults",
}
}
| 158 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the face search results for Amazon Rekognition Video face search started
// by StartFaceSearch . The search returns faces in a collection that match the
// faces of persons detected in a video. It also includes the time(s) that faces
// are matched in the video. Face search in a video is an asynchronous operation.
// You start face search by calling to StartFaceSearch which returns a job
// identifier ( JobId ). When the search operation finishes, Amazon Rekognition
// Video publishes a completion status to the Amazon Simple Notification Service
// topic registered in the initial call to StartFaceSearch . To get the search
// results, first check that the status value published to the Amazon SNS topic is
// SUCCEEDED . If so, call GetFaceSearch and pass the job identifier ( JobId ) from
// the initial call to StartFaceSearch . For more information, see Searching Faces
// in a Collection in the Amazon Rekognition Developer Guide. The search results
// are retured in an array, Persons , of PersonMatch objects. Each PersonMatch
// element contains details about the matching faces in the input collection,
// person information (facial attributes, bounding boxes, and person identifer) for
// the matched person, and the time the person was matched in the video.
// GetFaceSearch only returns the default facial attributes ( BoundingBox ,
// Confidence , Landmarks , Pose , and Quality ). The other facial attributes
// listed in the Face object of the following response syntax are not returned.
// For more information, see FaceDetail in the Amazon Rekognition Developer Guide.
// By default, the Persons array is sorted by the time, in milliseconds from the
// start of the video, persons are matched. You can also sort by persons by
// specifying INDEX for the SORTBY input parameter.
func (c *Client) GetFaceSearch(ctx context.Context, params *GetFaceSearchInput, optFns ...func(*Options)) (*GetFaceSearchOutput, error) {
if params == nil {
params = &GetFaceSearchInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetFaceSearch", params, optFns, c.addOperationGetFaceSearchMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetFaceSearchOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetFaceSearchInput struct {
// The job identifer for the search request. You get the job identifier from an
// initial call to StartFaceSearch .
//
// This member is required.
JobId *string
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
MaxResults *int32
// If the previous response was incomplete (because there is more search results
// to retrieve), Amazon Rekognition Video returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of search
// results.
NextToken *string
// Sort to use for grouping faces in the response. Use TIMESTAMP to group faces by
// the time that they are recognized. Use INDEX to sort by recognized faces.
SortBy types.FaceSearchSortBy
noSmithyDocumentSerde
}
type GetFaceSearchOutput struct {
// Job identifier for the face search operation for which you want to obtain
// results. The job identifer is returned by an initial call to StartFaceSearch.
JobId *string
// The current status of the face search job.
JobStatus types.VideoJobStatus
// A job identifier specified in the call to StartFaceSearch and returned in the
// job completion notification sent to your Amazon Simple Notification Service
// topic.
JobTag *string
// If the response is truncated, Amazon Rekognition Video returns this token that
// you can use in the subsequent request to retrieve the next set of search
// results.
NextToken *string
// An array of persons, PersonMatch , in the video whose face(s) match the face(s)
// in an Amazon Rekognition collection. It also includes time information for when
// persons are matched in the video. You specify the input collection in an initial
// call to StartFaceSearch . Each Persons element includes a time the person was
// matched, face match details ( FaceMatches ) for matching faces in the
// collection, and person information ( Person ) for the matched person.
Persons []types.PersonMatch
// If the job fails, StatusMessage provides a descriptive error message.
StatusMessage *string
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
Video *types.Video
// Information about a video that Amazon Rekognition analyzed. Videometadata is
// returned in every page of paginated responses from a Amazon Rekognition Video
// operation.
VideoMetadata *types.VideoMetadata
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetFaceSearchMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetFaceSearch{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetFaceSearch{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetFaceSearchValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetFaceSearch(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
}
return nil
}
// GetFaceSearchAPIClient is a client that implements the GetFaceSearch operation.
type GetFaceSearchAPIClient interface {
GetFaceSearch(context.Context, *GetFaceSearchInput, ...func(*Options)) (*GetFaceSearchOutput, error)
}
var _ GetFaceSearchAPIClient = (*Client)(nil)
// GetFaceSearchPaginatorOptions is the paginator options for GetFaceSearch
type GetFaceSearchPaginatorOptions struct {
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// GetFaceSearchPaginator is a paginator for GetFaceSearch
type GetFaceSearchPaginator struct {
options GetFaceSearchPaginatorOptions
client GetFaceSearchAPIClient
params *GetFaceSearchInput
nextToken *string
firstPage bool
}
// NewGetFaceSearchPaginator returns a new GetFaceSearchPaginator
func NewGetFaceSearchPaginator(client GetFaceSearchAPIClient, params *GetFaceSearchInput, optFns ...func(*GetFaceSearchPaginatorOptions)) *GetFaceSearchPaginator {
if params == nil {
params = &GetFaceSearchInput{}
}
options := GetFaceSearchPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &GetFaceSearchPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *GetFaceSearchPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next GetFaceSearch page.
func (p *GetFaceSearchPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetFaceSearchOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.GetFaceSearch(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opGetFaceSearch(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetFaceSearch",
}
}
| 290 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the path tracking results of a Amazon Rekognition Video analysis started
// by StartPersonTracking . The person path tracking operation is started by a call
// to StartPersonTracking which returns a job identifier ( JobId ). When the
// operation finishes, Amazon Rekognition Video publishes a completion status to
// the Amazon Simple Notification Service topic registered in the initial call to
// StartPersonTracking . To get the results of the person path tracking operation,
// first check that the status value published to the Amazon SNS topic is SUCCEEDED
// . If so, call GetPersonTracking and pass the job identifier ( JobId ) from the
// initial call to StartPersonTracking . GetPersonTracking returns an array,
// Persons , of tracked persons and the time(s) their paths were tracked in the
// video. GetPersonTracking only returns the default facial attributes ( BoundingBox
// , Confidence , Landmarks , Pose , and Quality ). The other facial attributes
// listed in the Face object of the following response syntax are not returned.
// For more information, see FaceDetail in the Amazon Rekognition Developer Guide.
// By default, the array is sorted by the time(s) a person's path is tracked in the
// video. You can sort by tracked persons by specifying INDEX for the SortBy input
// parameter. Use the MaxResults parameter to limit the number of items returned.
// If there are more results than specified in MaxResults , the value of NextToken
// in the operation response contains a pagination token for getting the next set
// of results. To get the next page of results, call GetPersonTracking and
// populate the NextToken request parameter with the token value returned from the
// previous call to GetPersonTracking .
func (c *Client) GetPersonTracking(ctx context.Context, params *GetPersonTrackingInput, optFns ...func(*Options)) (*GetPersonTrackingOutput, error) {
if params == nil {
params = &GetPersonTrackingInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetPersonTracking", params, optFns, c.addOperationGetPersonTrackingMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetPersonTrackingOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetPersonTrackingInput struct {
// The identifier for a job that tracks persons in a video. You get the JobId from
// a call to StartPersonTracking .
//
// This member is required.
JobId *string
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
MaxResults *int32
// If the previous response was incomplete (because there are more persons to
// retrieve), Amazon Rekognition Video returns a pagination token in the response.
// You can use this pagination token to retrieve the next set of persons.
NextToken *string
// Sort to use for elements in the Persons array. Use TIMESTAMP to sort array
// elements by the time persons are detected. Use INDEX to sort by the tracked
// persons. If you sort by INDEX , the array elements for each person are sorted by
// detection confidence. The default sort is by TIMESTAMP .
SortBy types.PersonTrackingSortBy
noSmithyDocumentSerde
}
type GetPersonTrackingOutput struct {
// Job identifier for the person tracking operation for which you want to obtain
// results. The job identifer is returned by an initial call to
// StartPersonTracking.
JobId *string
// The current status of the person tracking job.
JobStatus types.VideoJobStatus
// A job identifier specified in the call to StartCelebrityRecognition and
// returned in the job completion notification sent to your Amazon Simple
// Notification Service topic.
JobTag *string
// If the response is truncated, Amazon Rekognition Video returns this token that
// you can use in the subsequent request to retrieve the next set of persons.
NextToken *string
// An array of the persons detected in the video and the time(s) their path was
// tracked throughout the video. An array element will exist for each time a
// person's path is tracked.
Persons []types.PersonDetection
// If the job fails, StatusMessage provides a descriptive error message.
StatusMessage *string
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
Video *types.Video
// Information about a video that Amazon Rekognition Video analyzed. Videometadata
// is returned in every page of paginated responses from a Amazon Rekognition Video
// operation.
VideoMetadata *types.VideoMetadata
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetPersonTrackingMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetPersonTracking{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetPersonTracking{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetPersonTrackingValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPersonTracking(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
}
return nil
}
// GetPersonTrackingAPIClient is a client that implements the GetPersonTracking
// operation.
type GetPersonTrackingAPIClient interface {
GetPersonTracking(context.Context, *GetPersonTrackingInput, ...func(*Options)) (*GetPersonTrackingOutput, error)
}
var _ GetPersonTrackingAPIClient = (*Client)(nil)
// GetPersonTrackingPaginatorOptions is the paginator options for GetPersonTracking
type GetPersonTrackingPaginatorOptions struct {
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000. If you specify a value greater than 1000, a maximum of 1000
// results is returned. The default value is 1000.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// GetPersonTrackingPaginator is a paginator for GetPersonTracking
type GetPersonTrackingPaginator struct {
options GetPersonTrackingPaginatorOptions
client GetPersonTrackingAPIClient
params *GetPersonTrackingInput
nextToken *string
firstPage bool
}
// NewGetPersonTrackingPaginator returns a new GetPersonTrackingPaginator
func NewGetPersonTrackingPaginator(client GetPersonTrackingAPIClient, params *GetPersonTrackingInput, optFns ...func(*GetPersonTrackingPaginatorOptions)) *GetPersonTrackingPaginator {
if params == nil {
params = &GetPersonTrackingInput{}
}
options := GetPersonTrackingPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &GetPersonTrackingPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *GetPersonTrackingPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next GetPersonTracking page.
func (p *GetPersonTrackingPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetPersonTrackingOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.GetPersonTracking(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opGetPersonTracking(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetPersonTracking",
}
}
| 288 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the segment detection results of a Amazon Rekognition Video analysis
// started by StartSegmentDetection . Segment detection with Amazon Rekognition
// Video is an asynchronous operation. You start segment detection by calling
// StartSegmentDetection which returns a job identifier ( JobId ). When the segment
// detection operation finishes, Amazon Rekognition publishes a completion status
// to the Amazon Simple Notification Service topic registered in the initial call
// to StartSegmentDetection . To get the results of the segment detection
// operation, first check that the status value published to the Amazon SNS topic
// is SUCCEEDED . if so, call GetSegmentDetection and pass the job identifier (
// JobId ) from the initial call of StartSegmentDetection . GetSegmentDetection
// returns detected segments in an array ( Segments ) of SegmentDetection objects.
// Segments is sorted by the segment types specified in the SegmentTypes input
// parameter of StartSegmentDetection . Each element of the array includes the
// detected segment, the precentage confidence in the acuracy of the detected
// segment, the type of the segment, and the frame in which the segment was
// detected. Use SelectedSegmentTypes to find out the type of segment detection
// requested in the call to StartSegmentDetection . Use the MaxResults parameter
// to limit the number of segment detections returned. If there are more results
// than specified in MaxResults , the value of NextToken in the operation response
// contains a pagination token for getting the next set of results. To get the next
// page of results, call GetSegmentDetection and populate the NextToken request
// parameter with the token value returned from the previous call to
// GetSegmentDetection . For more information, see Detecting video segments in
// stored video in the Amazon Rekognition Developer Guide.
func (c *Client) GetSegmentDetection(ctx context.Context, params *GetSegmentDetectionInput, optFns ...func(*Options)) (*GetSegmentDetectionOutput, error) {
if params == nil {
params = &GetSegmentDetectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetSegmentDetection", params, optFns, c.addOperationGetSegmentDetectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetSegmentDetectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetSegmentDetectionInput struct {
// Job identifier for the text detection operation for which you want results
// returned. You get the job identifer from an initial call to
// StartSegmentDetection .
//
// This member is required.
JobId *string
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000.
MaxResults *int32
// If the response is truncated, Amazon Rekognition Video returns this token that
// you can use in the subsequent request to retrieve the next set of text.
NextToken *string
noSmithyDocumentSerde
}
type GetSegmentDetectionOutput struct {
// An array of objects. There can be multiple audio streams. Each AudioMetadata
// object contains metadata for a single audio stream. Audio information in an
// AudioMetadata objects includes the audio codec, the number of audio channels,
// the duration of the audio stream, and the sample rate. Audio metadata is
// returned in each page of information returned by GetSegmentDetection .
AudioMetadata []types.AudioMetadata
// Job identifier for the segment detection operation for which you want to obtain
// results. The job identifer is returned by an initial call to
// StartSegmentDetection.
JobId *string
// Current status of the segment detection job.
JobStatus types.VideoJobStatus
// A job identifier specified in the call to StartSegmentDetection and returned in
// the job completion notification sent to your Amazon Simple Notification Service
// topic.
JobTag *string
// If the previous response was incomplete (because there are more labels to
// retrieve), Amazon Rekognition Video returns a pagination token in the response.
// You can use this pagination token to retrieve the next set of text.
NextToken *string
// An array of segments detected in a video. The array is sorted by the segment
// types (TECHNICAL_CUE or SHOT) specified in the SegmentTypes input parameter of
// StartSegmentDetection . Within each segment type the array is sorted by
// timestamp values.
Segments []types.SegmentDetection
// An array containing the segment types requested in the call to
// StartSegmentDetection .
SelectedSegmentTypes []types.SegmentTypeInfo
// If the job fails, StatusMessage provides a descriptive error message.
StatusMessage *string
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
Video *types.Video
// Currently, Amazon Rekognition Video returns a single object in the VideoMetadata
// array. The object contains information about the video stream in the input file
// that Amazon Rekognition Video chose to analyze. The VideoMetadata object
// includes the video codec, video format and other information. Video metadata is
// returned in each page of information returned by GetSegmentDetection .
VideoMetadata []types.VideoMetadata
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetSegmentDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetSegmentDetection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetSegmentDetection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetSegmentDetectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSegmentDetection(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
}
return nil
}
// GetSegmentDetectionAPIClient is a client that implements the
// GetSegmentDetection operation.
type GetSegmentDetectionAPIClient interface {
GetSegmentDetection(context.Context, *GetSegmentDetectionInput, ...func(*Options)) (*GetSegmentDetectionOutput, error)
}
var _ GetSegmentDetectionAPIClient = (*Client)(nil)
// GetSegmentDetectionPaginatorOptions is the paginator options for
// GetSegmentDetection
type GetSegmentDetectionPaginatorOptions struct {
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// GetSegmentDetectionPaginator is a paginator for GetSegmentDetection
type GetSegmentDetectionPaginator struct {
options GetSegmentDetectionPaginatorOptions
client GetSegmentDetectionAPIClient
params *GetSegmentDetectionInput
nextToken *string
firstPage bool
}
// NewGetSegmentDetectionPaginator returns a new GetSegmentDetectionPaginator
func NewGetSegmentDetectionPaginator(client GetSegmentDetectionAPIClient, params *GetSegmentDetectionInput, optFns ...func(*GetSegmentDetectionPaginatorOptions)) *GetSegmentDetectionPaginator {
if params == nil {
params = &GetSegmentDetectionInput{}
}
options := GetSegmentDetectionPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &GetSegmentDetectionPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *GetSegmentDetectionPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next GetSegmentDetection page.
func (p *GetSegmentDetectionPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetSegmentDetectionOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.GetSegmentDetection(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opGetSegmentDetection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetSegmentDetection",
}
}
| 298 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the text detection results of a Amazon Rekognition Video analysis started
// by StartTextDetection . Text detection with Amazon Rekognition Video is an
// asynchronous operation. You start text detection by calling StartTextDetection
// which returns a job identifier ( JobId ) When the text detection operation
// finishes, Amazon Rekognition publishes a completion status to the Amazon Simple
// Notification Service topic registered in the initial call to StartTextDetection
// . To get the results of the text detection operation, first check that the
// status value published to the Amazon SNS topic is SUCCEEDED . if so, call
// GetTextDetection and pass the job identifier ( JobId ) from the initial call of
// StartLabelDetection . GetTextDetection returns an array of detected text (
// TextDetections ) sorted by the time the text was detected, up to 50 words per
// frame of video. Each element of the array includes the detected text, the
// precentage confidence in the acuracy of the detected text, the time the text was
// detected, bounding box information for where the text was located, and unique
// identifiers for words and their lines. Use MaxResults parameter to limit the
// number of text detections returned. If there are more results than specified in
// MaxResults , the value of NextToken in the operation response contains a
// pagination token for getting the next set of results. To get the next page of
// results, call GetTextDetection and populate the NextToken request parameter
// with the token value returned from the previous call to GetTextDetection .
func (c *Client) GetTextDetection(ctx context.Context, params *GetTextDetectionInput, optFns ...func(*Options)) (*GetTextDetectionOutput, error) {
if params == nil {
params = &GetTextDetectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetTextDetection", params, optFns, c.addOperationGetTextDetectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetTextDetectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetTextDetectionInput struct {
// Job identifier for the text detection operation for which you want results
// returned. You get the job identifer from an initial call to StartTextDetection .
//
// This member is required.
JobId *string
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000.
MaxResults *int32
// If the previous response was incomplete (because there are more labels to
// retrieve), Amazon Rekognition Video returns a pagination token in the response.
// You can use this pagination token to retrieve the next set of text.
NextToken *string
noSmithyDocumentSerde
}
type GetTextDetectionOutput struct {
// Job identifier for the text detection operation for which you want to obtain
// results. The job identifer is returned by an initial call to StartTextDetection.
JobId *string
// Current status of the text detection job.
JobStatus types.VideoJobStatus
// A job identifier specified in the call to StartTextDetection and returned in
// the job completion notification sent to your Amazon Simple Notification Service
// topic.
JobTag *string
// If the response is truncated, Amazon Rekognition Video returns this token that
// you can use in the subsequent request to retrieve the next set of text.
NextToken *string
// If the job fails, StatusMessage provides a descriptive error message.
StatusMessage *string
// An array of text detected in the video. Each element contains the detected
// text, the time in milliseconds from the start of the video that the text was
// detected, and where it was detected on the screen.
TextDetections []types.TextDetectionResult
// Version number of the text detection model that was used to detect text.
TextModelVersion *string
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
Video *types.Video
// Information about a video that Amazon Rekognition analyzed. Videometadata is
// returned in every page of paginated responses from a Amazon Rekognition video
// operation.
VideoMetadata *types.VideoMetadata
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetTextDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetTextDetection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetTextDetection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpGetTextDetectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTextDetection(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
}
return nil
}
// GetTextDetectionAPIClient is a client that implements the GetTextDetection
// operation.
type GetTextDetectionAPIClient interface {
GetTextDetection(context.Context, *GetTextDetectionInput, ...func(*Options)) (*GetTextDetectionOutput, error)
}
var _ GetTextDetectionAPIClient = (*Client)(nil)
// GetTextDetectionPaginatorOptions is the paginator options for GetTextDetection
type GetTextDetectionPaginatorOptions struct {
// Maximum number of results to return per paginated call. The largest value you
// can specify is 1000.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// GetTextDetectionPaginator is a paginator for GetTextDetection
type GetTextDetectionPaginator struct {
options GetTextDetectionPaginatorOptions
client GetTextDetectionAPIClient
params *GetTextDetectionInput
nextToken *string
firstPage bool
}
// NewGetTextDetectionPaginator returns a new GetTextDetectionPaginator
func NewGetTextDetectionPaginator(client GetTextDetectionAPIClient, params *GetTextDetectionInput, optFns ...func(*GetTextDetectionPaginatorOptions)) *GetTextDetectionPaginator {
if params == nil {
params = &GetTextDetectionInput{}
}
options := GetTextDetectionPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &GetTextDetectionPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *GetTextDetectionPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next GetTextDetection page.
func (p *GetTextDetectionPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*GetTextDetectionOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.GetTextDetection(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opGetTextDetection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "GetTextDetection",
}
}
| 280 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Detects faces in the input image and adds them to the specified collection.
// Amazon Rekognition doesn't save the actual faces that are detected. Instead, the
// underlying detection algorithm first detects the faces in the input image. For
// each face, the algorithm extracts facial features into a feature vector, and
// stores it in the backend database. Amazon Rekognition uses feature vectors when
// it performs face match and search operations using the SearchFaces and
// SearchFacesByImage operations. For more information, see Adding faces to a
// collection in the Amazon Rekognition Developer Guide. To get the number of faces
// in a collection, call DescribeCollection . If you're using version 1.0 of the
// face detection model, IndexFaces indexes the 15 largest faces in the input
// image. Later versions of the face detection model index the 100 largest faces in
// the input image. If you're using version 4 or later of the face model, image
// orientation information is not returned in the OrientationCorrection field. To
// determine which version of the model you're using, call DescribeCollection and
// supply the collection ID. You can also get the model version from the value of
// FaceModelVersion in the response from IndexFaces For more information, see
// Model Versioning in the Amazon Rekognition Developer Guide. If you provide the
// optional ExternalImageId for the input image you provided, Amazon Rekognition
// associates this ID with all faces that it detects. When you call the ListFaces
// operation, the response returns the external ID. You can use this external image
// ID to create a client-side index to associate the faces with each image. You can
// then use the index to find all faces in an image. You can specify the maximum
// number of faces to index with the MaxFaces input parameter. This is useful when
// you want to index the largest faces in an image and don't want to index smaller
// faces, such as those belonging to people standing in the background. The
// QualityFilter input parameter allows you to filter out detected faces that don’t
// meet a required quality bar. The quality bar is based on a variety of common use
// cases. By default, IndexFaces chooses the quality bar that's used to filter
// faces. You can also explicitly choose the quality bar. Use QualityFilter , to
// set the quality bar by specifying LOW , MEDIUM , or HIGH . If you do not want to
// filter detected faces, specify NONE . To use quality filtering, you need a
// collection associated with version 3 of the face model or higher. To get the
// version of the face model associated with a collection, call DescribeCollection
// . Information about faces detected in an image, but not indexed, is returned in
// an array of UnindexedFace objects, UnindexedFaces . Faces aren't indexed for
// reasons such as:
// - The number of faces detected exceeds the value of the MaxFaces request
// parameter.
// - The face is too small compared to the image dimensions.
// - The face is too blurry.
// - The image is too dark.
// - The face has an extreme pose.
// - The face doesn’t have enough detail to be suitable for face search.
//
// In response, the IndexFaces operation returns an array of metadata for all
// detected faces, FaceRecords . This includes:
// - The bounding box, BoundingBox , of the detected face.
// - A confidence value, Confidence , which indicates the confidence that the
// bounding box contains a face.
// - A face ID, FaceId , assigned by the service for each face that's detected
// and stored.
// - An image ID, ImageId , assigned by the service for the input image.
//
// If you request ALL or specific facial attributes (e.g., FACE_OCCLUDED ) by using
// the detectionAttributes parameter, Amazon Rekognition returns detailed facial
// attributes, such as facial landmarks (for example, location of eye and mouth),
// facial occlusion, and other facial attributes. If you provide the same image,
// specify the same collection, and use the same external ID in the IndexFaces
// operation, Amazon Rekognition doesn't save duplicate face metadata. The input
// image is passed either as base64-encoded image bytes, or as a reference to an
// image in an Amazon S3 bucket. If you use the AWS CLI to call Amazon Rekognition
// operations, passing image bytes isn't supported. The image must be formatted as
// a PNG or JPEG file. This operation requires permissions to perform the
// rekognition:IndexFaces action.
func (c *Client) IndexFaces(ctx context.Context, params *IndexFacesInput, optFns ...func(*Options)) (*IndexFacesOutput, error) {
if params == nil {
params = &IndexFacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "IndexFaces", params, optFns, c.addOperationIndexFacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*IndexFacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type IndexFacesInput struct {
// The ID of an existing collection to which you want to add the faces that are
// detected in the input images.
//
// This member is required.
CollectionId *string
// The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI
// to call Amazon Rekognition operations, passing base64-encoded image bytes isn't
// supported. If you are using an AWS SDK to call Amazon Rekognition, you might not
// need to base64-encode image bytes passed using the Bytes field. For more
// information, see Images in the Amazon Rekognition developer guide.
//
// This member is required.
Image *types.Image
// An array of facial attributes you want to be returned. A DEFAULT subset of
// facial attributes - BoundingBox , Confidence , Pose , Quality , and Landmarks -
// will always be returned. You can request for specific facial attributes (in
// addition to the default list) - by using ["DEFAULT", "FACE_OCCLUDED"] or just
// ["FACE_OCCLUDED"] . You can request for all facial attributes by using ["ALL"] .
// Requesting more attributes may increase response time. If you provide both,
// ["ALL", "DEFAULT"] , the service uses a logical AND operator to determine which
// attributes to return (in this case, all attributes).
DetectionAttributes []types.Attribute
// The ID you want to assign to all the faces detected in the image.
ExternalImageId *string
// The maximum number of faces to index. The value of MaxFaces must be greater
// than or equal to 1. IndexFaces returns no more than 100 detected faces in an
// image, even if you specify a larger value for MaxFaces . If IndexFaces detects
// more faces than the value of MaxFaces , the faces with the lowest quality are
// filtered out first. If there are still more faces than the value of MaxFaces ,
// the faces with the smallest bounding boxes are filtered out (up to the number
// that's needed to satisfy the value of MaxFaces ). Information about the
// unindexed faces is available in the UnindexedFaces array. The faces that are
// returned by IndexFaces are sorted by the largest face bounding box size to the
// smallest size, in descending order. MaxFaces can be used with a collection
// associated with any version of the face model.
MaxFaces *int32
// A filter that specifies a quality bar for how much filtering is done to
// identify faces. Filtered faces aren't indexed. If you specify AUTO , Amazon
// Rekognition chooses the quality bar. If you specify LOW , MEDIUM , or HIGH ,
// filtering removes all faces that don’t meet the chosen quality bar. The default
// value is AUTO . The quality bar is based on a variety of common use cases.
// Low-quality detections can occur for a number of reasons. Some examples are an
// object that's misidentified as a face, a face that's too blurry, or a face with
// a pose that's too extreme to use. If you specify NONE , no filtering is
// performed. To use quality filtering, the collection you are using must be
// associated with version 3 of the face model or higher.
QualityFilter types.QualityFilter
noSmithyDocumentSerde
}
type IndexFacesOutput struct {
// The version number of the face detection model that's associated with the input
// collection ( CollectionId ).
FaceModelVersion *string
// An array of faces detected and added to the collection. For more information,
// see Searching Faces in a Collection in the Amazon Rekognition Developer Guide.
FaceRecords []types.FaceRecord
// If your collection is associated with a face detection model that's later than
// version 3.0, the value of OrientationCorrection is always null and no
// orientation information is returned. If your collection is associated with a
// face detection model that's version 3.0 or earlier, the following applies:
// - If the input image is in .jpeg format, it might contain exchangeable image
// file format (Exif) metadata that includes the image's orientation. Amazon
// Rekognition uses this orientation information to perform image correction - the
// bounding box coordinates are translated to represent object locations after the
// orientation information in the Exif metadata is used to correct the image
// orientation. Images in .png format don't contain Exif metadata. The value of
// OrientationCorrection is null.
// - If the image doesn't contain orientation information in its Exif metadata,
// Amazon Rekognition returns an estimated orientation (ROTATE_0, ROTATE_90,
// ROTATE_180, ROTATE_270). Amazon Rekognition doesn’t perform image correction for
// images. The bounding box coordinates aren't translated and represent the object
// locations before the image is rotated.
// Bounding box information is returned in the FaceRecords array. You can get the
// version of the face detection model by calling DescribeCollection .
OrientationCorrection types.OrientationCorrection
// An array of faces that were detected in the image but weren't indexed. They
// weren't indexed because the quality filter identified them as low quality, or
// the MaxFaces request parameter filtered them out. To use the quality filter,
// you specify the QualityFilter request parameter.
UnindexedFaces []types.UnindexedFace
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationIndexFacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpIndexFaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpIndexFaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpIndexFacesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opIndexFaces(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
}
return nil
}
func newServiceMetadataMiddleware_opIndexFaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "IndexFaces",
}
}
| 267 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns list of collection IDs in your account. If the result is truncated, the
// response also provides a NextToken that you can use in the subsequent request
// to fetch the next set of collection IDs. For an example, see Listing collections
// in the Amazon Rekognition Developer Guide. This operation requires permissions
// to perform the rekognition:ListCollections action.
func (c *Client) ListCollections(ctx context.Context, params *ListCollectionsInput, optFns ...func(*Options)) (*ListCollectionsOutput, error) {
if params == nil {
params = &ListCollectionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListCollections", params, optFns, c.addOperationListCollectionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListCollectionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListCollectionsInput struct {
// Maximum number of collection IDs to return.
MaxResults *int32
// Pagination token from the previous response.
NextToken *string
noSmithyDocumentSerde
}
type ListCollectionsOutput struct {
// An array of collection IDs.
CollectionIds []string
// Version numbers of the face detection models associated with the collections in
// the array CollectionIds . For example, the value of FaceModelVersions[2] is the
// version number for the face detection model used by the collection in
// CollectionId[2] .
FaceModelVersions []string
// If the result is truncated, the response provides a NextToken that you can use
// in the subsequent request to fetch the next set of collection IDs.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListCollectionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListCollections{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListCollections{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListCollections(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
}
return nil
}
// ListCollectionsAPIClient is a client that implements the ListCollections
// operation.
type ListCollectionsAPIClient interface {
ListCollections(context.Context, *ListCollectionsInput, ...func(*Options)) (*ListCollectionsOutput, error)
}
var _ ListCollectionsAPIClient = (*Client)(nil)
// ListCollectionsPaginatorOptions is the paginator options for ListCollections
type ListCollectionsPaginatorOptions struct {
// Maximum number of collection IDs to return.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListCollectionsPaginator is a paginator for ListCollections
type ListCollectionsPaginator struct {
options ListCollectionsPaginatorOptions
client ListCollectionsAPIClient
params *ListCollectionsInput
nextToken *string
firstPage bool
}
// NewListCollectionsPaginator returns a new ListCollectionsPaginator
func NewListCollectionsPaginator(client ListCollectionsAPIClient, params *ListCollectionsInput, optFns ...func(*ListCollectionsPaginatorOptions)) *ListCollectionsPaginator {
if params == nil {
params = &ListCollectionsInput{}
}
options := ListCollectionsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListCollectionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListCollectionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListCollections page.
func (p *ListCollectionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListCollectionsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListCollections(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListCollections(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "ListCollections",
}
}
| 227 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the entries (images) within a dataset. An entry is a JSON Line that
// contains the information for a single image, including the image location,
// assigned labels, and object location bounding boxes. For more information, see
// Creating a manifest file (https://docs.aws.amazon.com/rekognition/latest/customlabels-dg/md-manifest-files.html)
// . JSON Lines in the response include information about non-terminal errors found
// in the dataset. Non terminal errors are reported in errors lists within each
// JSON Line. The same information is reported in the training and testing
// validation result manifests that Amazon Rekognition Custom Labels creates during
// model training. You can filter the response in variety of ways, such as choosing
// which labels to return and returning JSON Lines created after a specific date.
// This operation requires permissions to perform the
// rekognition:ListDatasetEntries action.
func (c *Client) ListDatasetEntries(ctx context.Context, params *ListDatasetEntriesInput, optFns ...func(*Options)) (*ListDatasetEntriesOutput, error) {
if params == nil {
params = &ListDatasetEntriesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListDatasetEntries", params, optFns, c.addOperationListDatasetEntriesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListDatasetEntriesOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListDatasetEntriesInput struct {
// The Amazon Resource Name (ARN) for the dataset that you want to use.
//
// This member is required.
DatasetArn *string
// Specifies a label filter for the response. The response includes an entry only
// if one or more of the labels in ContainsLabels exist in the entry.
ContainsLabels []string
// Specifies an error filter for the response. Specify True to only include
// entries that have errors.
HasErrors *bool
// Specify true to get only the JSON Lines where the image is labeled. Specify
// false to get only the JSON Lines where the image isn't labeled. If you don't
// specify Labeled , ListDatasetEntries returns JSON Lines for labeled and
// unlabeled images.
Labeled *bool
// The maximum number of results to return per paginated call. The largest value
// you can specify is 100. If you specify a value greater than 100, a
// ValidationException error occurs. The default value is 100.
MaxResults *int32
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
// If specified, ListDatasetEntries only returns JSON Lines where the value of
// SourceRefContains is part of the source-ref field. The source-ref field
// contains the Amazon S3 location of the image. You can use SouceRefContains for
// tasks such as getting the JSON Line for a single image, or gettting JSON Lines
// for all images within a specific folder.
SourceRefContains *string
noSmithyDocumentSerde
}
type ListDatasetEntriesOutput struct {
// A list of entries (images) in the dataset.
DatasetEntries []string
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListDatasetEntriesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListDatasetEntries{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListDatasetEntries{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpListDatasetEntriesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListDatasetEntries(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
}
return nil
}
// ListDatasetEntriesAPIClient is a client that implements the ListDatasetEntries
// operation.
type ListDatasetEntriesAPIClient interface {
ListDatasetEntries(context.Context, *ListDatasetEntriesInput, ...func(*Options)) (*ListDatasetEntriesOutput, error)
}
var _ ListDatasetEntriesAPIClient = (*Client)(nil)
// ListDatasetEntriesPaginatorOptions is the paginator options for
// ListDatasetEntries
type ListDatasetEntriesPaginatorOptions struct {
// The maximum number of results to return per paginated call. The largest value
// you can specify is 100. If you specify a value greater than 100, a
// ValidationException error occurs. The default value is 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListDatasetEntriesPaginator is a paginator for ListDatasetEntries
type ListDatasetEntriesPaginator struct {
options ListDatasetEntriesPaginatorOptions
client ListDatasetEntriesAPIClient
params *ListDatasetEntriesInput
nextToken *string
firstPage bool
}
// NewListDatasetEntriesPaginator returns a new ListDatasetEntriesPaginator
func NewListDatasetEntriesPaginator(client ListDatasetEntriesAPIClient, params *ListDatasetEntriesInput, optFns ...func(*ListDatasetEntriesPaginatorOptions)) *ListDatasetEntriesPaginator {
if params == nil {
params = &ListDatasetEntriesInput{}
}
options := ListDatasetEntriesPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListDatasetEntriesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListDatasetEntriesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListDatasetEntries page.
func (p *ListDatasetEntriesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListDatasetEntriesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListDatasetEntries(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListDatasetEntries(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "ListDatasetEntries",
}
}
| 265 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the labels in a dataset. Amazon Rekognition Custom Labels uses labels to
// describe images. For more information, see Labeling images (https://docs.aws.amazon.com/rekognition/latest/customlabels-dg/md-labeling-images.html)
// . Lists the labels in a dataset. Amazon Rekognition Custom Labels uses labels to
// describe images. For more information, see Labeling images in the Amazon
// Rekognition Custom Labels Developer Guide.
func (c *Client) ListDatasetLabels(ctx context.Context, params *ListDatasetLabelsInput, optFns ...func(*Options)) (*ListDatasetLabelsOutput, error) {
if params == nil {
params = &ListDatasetLabelsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListDatasetLabels", params, optFns, c.addOperationListDatasetLabelsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListDatasetLabelsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListDatasetLabelsInput struct {
// The Amazon Resource Name (ARN) of the dataset that you want to use.
//
// This member is required.
DatasetArn *string
// The maximum number of results to return per paginated call. The largest value
// you can specify is 100. If you specify a value greater than 100, a
// ValidationException error occurs. The default value is 100.
MaxResults *int32
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
noSmithyDocumentSerde
}
type ListDatasetLabelsOutput struct {
// A list of the labels in the dataset.
DatasetLabelDescriptions []types.DatasetLabelDescription
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListDatasetLabelsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListDatasetLabels{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListDatasetLabels{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpListDatasetLabelsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListDatasetLabels(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
}
return nil
}
// ListDatasetLabelsAPIClient is a client that implements the ListDatasetLabels
// operation.
type ListDatasetLabelsAPIClient interface {
ListDatasetLabels(context.Context, *ListDatasetLabelsInput, ...func(*Options)) (*ListDatasetLabelsOutput, error)
}
var _ ListDatasetLabelsAPIClient = (*Client)(nil)
// ListDatasetLabelsPaginatorOptions is the paginator options for ListDatasetLabels
type ListDatasetLabelsPaginatorOptions struct {
// The maximum number of results to return per paginated call. The largest value
// you can specify is 100. If you specify a value greater than 100, a
// ValidationException error occurs. The default value is 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListDatasetLabelsPaginator is a paginator for ListDatasetLabels
type ListDatasetLabelsPaginator struct {
options ListDatasetLabelsPaginatorOptions
client ListDatasetLabelsAPIClient
params *ListDatasetLabelsInput
nextToken *string
firstPage bool
}
// NewListDatasetLabelsPaginator returns a new ListDatasetLabelsPaginator
func NewListDatasetLabelsPaginator(client ListDatasetLabelsAPIClient, params *ListDatasetLabelsInput, optFns ...func(*ListDatasetLabelsPaginatorOptions)) *ListDatasetLabelsPaginator {
if params == nil {
params = &ListDatasetLabelsInput{}
}
options := ListDatasetLabelsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListDatasetLabelsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListDatasetLabelsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListDatasetLabels page.
func (p *ListDatasetLabelsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListDatasetLabelsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListDatasetLabels(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListDatasetLabels(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "ListDatasetLabels",
}
}
| 237 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns metadata for faces in the specified collection. This metadata includes
// information such as the bounding box coordinates, the confidence (that the
// bounding box contains a face), and face ID. For an example, see Listing Faces in
// a Collection in the Amazon Rekognition Developer Guide. This operation requires
// permissions to perform the rekognition:ListFaces action.
func (c *Client) ListFaces(ctx context.Context, params *ListFacesInput, optFns ...func(*Options)) (*ListFacesOutput, error) {
if params == nil {
params = &ListFacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListFaces", params, optFns, c.addOperationListFacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListFacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListFacesInput struct {
// ID of the collection from which to list the faces.
//
// This member is required.
CollectionId *string
// An array of face IDs to match when listing faces in a collection.
FaceIds []string
// Maximum number of faces to return.
MaxResults *int32
// If the previous response was incomplete (because there is more data to
// retrieve), Amazon Rekognition returns a pagination token in the response. You
// can use this pagination token to retrieve the next set of faces.
NextToken *string
// An array of user IDs to match when listing faces in a collection.
UserId *string
noSmithyDocumentSerde
}
type ListFacesOutput struct {
// Version number of the face detection model associated with the input collection
// ( CollectionId ).
FaceModelVersion *string
// An array of Face objects.
Faces []types.Face
// If the response is truncated, Amazon Rekognition returns this token that you
// can use in the subsequent request to retrieve the next set of faces.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListFacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListFaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListFaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpListFacesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListFaces(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
}
return nil
}
// ListFacesAPIClient is a client that implements the ListFaces operation.
type ListFacesAPIClient interface {
ListFaces(context.Context, *ListFacesInput, ...func(*Options)) (*ListFacesOutput, error)
}
var _ ListFacesAPIClient = (*Client)(nil)
// ListFacesPaginatorOptions is the paginator options for ListFaces
type ListFacesPaginatorOptions struct {
// Maximum number of faces to return.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListFacesPaginator is a paginator for ListFaces
type ListFacesPaginator struct {
options ListFacesPaginatorOptions
client ListFacesAPIClient
params *ListFacesInput
nextToken *string
firstPage bool
}
// NewListFacesPaginator returns a new ListFacesPaginator
func NewListFacesPaginator(client ListFacesAPIClient, params *ListFacesInput, optFns ...func(*ListFacesPaginatorOptions)) *ListFacesPaginator {
if params == nil {
params = &ListFacesInput{}
}
options := ListFacesPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListFacesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListFacesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListFaces page.
func (p *ListFacesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListFacesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListFaces(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListFaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "ListFaces",
}
}
| 241 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a list of the project policies attached to a project. To attach a project
// policy to a project, call PutProjectPolicy . To remove a project policy from a
// project, call DeleteProjectPolicy . This operation requires permissions to
// perform the rekognition:ListProjectPolicies action.
func (c *Client) ListProjectPolicies(ctx context.Context, params *ListProjectPoliciesInput, optFns ...func(*Options)) (*ListProjectPoliciesOutput, error) {
if params == nil {
params = &ListProjectPoliciesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListProjectPolicies", params, optFns, c.addOperationListProjectPoliciesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListProjectPoliciesOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListProjectPoliciesInput struct {
// The ARN of the project for which you want to list the project policies.
//
// This member is required.
ProjectArn *string
// The maximum number of results to return per paginated call. The largest value
// you can specify is 5. If you specify a value greater than 5, a
// ValidationException error occurs. The default value is 5.
MaxResults *int32
// If the previous response was incomplete (because there is more results to
// retrieve), Amazon Rekognition Custom Labels returns a pagination token in the
// response. You can use this pagination token to retrieve the next set of results.
NextToken *string
noSmithyDocumentSerde
}
type ListProjectPoliciesOutput struct {
// If the response is truncated, Amazon Rekognition returns this token that you
// can use in the subsequent request to retrieve the next set of project policies.
NextToken *string
// A list of project policies attached to the project.
ProjectPolicies []types.ProjectPolicy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListProjectPoliciesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListProjectPolicies{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListProjectPolicies{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpListProjectPoliciesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListProjectPolicies(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
}
return nil
}
// ListProjectPoliciesAPIClient is a client that implements the
// ListProjectPolicies operation.
type ListProjectPoliciesAPIClient interface {
ListProjectPolicies(context.Context, *ListProjectPoliciesInput, ...func(*Options)) (*ListProjectPoliciesOutput, error)
}
var _ ListProjectPoliciesAPIClient = (*Client)(nil)
// ListProjectPoliciesPaginatorOptions is the paginator options for
// ListProjectPolicies
type ListProjectPoliciesPaginatorOptions struct {
// The maximum number of results to return per paginated call. The largest value
// you can specify is 5. If you specify a value greater than 5, a
// ValidationException error occurs. The default value is 5.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListProjectPoliciesPaginator is a paginator for ListProjectPolicies
type ListProjectPoliciesPaginator struct {
options ListProjectPoliciesPaginatorOptions
client ListProjectPoliciesAPIClient
params *ListProjectPoliciesInput
nextToken *string
firstPage bool
}
// NewListProjectPoliciesPaginator returns a new ListProjectPoliciesPaginator
func NewListProjectPoliciesPaginator(client ListProjectPoliciesAPIClient, params *ListProjectPoliciesInput, optFns ...func(*ListProjectPoliciesPaginatorOptions)) *ListProjectPoliciesPaginator {
if params == nil {
params = &ListProjectPoliciesInput{}
}
options := ListProjectPoliciesPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListProjectPoliciesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListProjectPoliciesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListProjectPolicies page.
func (p *ListProjectPoliciesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListProjectPoliciesOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListProjectPolicies(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListProjectPolicies(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "ListProjectPolicies",
}
}
| 236 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a list of stream processors that you have created with
// CreateStreamProcessor .
func (c *Client) ListStreamProcessors(ctx context.Context, params *ListStreamProcessorsInput, optFns ...func(*Options)) (*ListStreamProcessorsOutput, error) {
if params == nil {
params = &ListStreamProcessorsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListStreamProcessors", params, optFns, c.addOperationListStreamProcessorsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListStreamProcessorsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListStreamProcessorsInput struct {
// Maximum number of stream processors you want Amazon Rekognition Video to return
// in the response. The default is 1000.
MaxResults *int32
// If the previous response was incomplete (because there are more stream
// processors to retrieve), Amazon Rekognition Video returns a pagination token in
// the response. You can use this pagination token to retrieve the next set of
// stream processors.
NextToken *string
noSmithyDocumentSerde
}
type ListStreamProcessorsOutput struct {
// If the response is truncated, Amazon Rekognition Video returns this token that
// you can use in the subsequent request to retrieve the next set of stream
// processors.
NextToken *string
// List of stream processors that you have created.
StreamProcessors []types.StreamProcessor
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListStreamProcessorsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListStreamProcessors{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListStreamProcessors{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListStreamProcessors(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
}
return nil
}
// ListStreamProcessorsAPIClient is a client that implements the
// ListStreamProcessors operation.
type ListStreamProcessorsAPIClient interface {
ListStreamProcessors(context.Context, *ListStreamProcessorsInput, ...func(*Options)) (*ListStreamProcessorsOutput, error)
}
var _ ListStreamProcessorsAPIClient = (*Client)(nil)
// ListStreamProcessorsPaginatorOptions is the paginator options for
// ListStreamProcessors
type ListStreamProcessorsPaginatorOptions struct {
// Maximum number of stream processors you want Amazon Rekognition Video to return
// in the response. The default is 1000.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListStreamProcessorsPaginator is a paginator for ListStreamProcessors
type ListStreamProcessorsPaginator struct {
options ListStreamProcessorsPaginatorOptions
client ListStreamProcessorsAPIClient
params *ListStreamProcessorsInput
nextToken *string
firstPage bool
}
// NewListStreamProcessorsPaginator returns a new ListStreamProcessorsPaginator
func NewListStreamProcessorsPaginator(client ListStreamProcessorsAPIClient, params *ListStreamProcessorsInput, optFns ...func(*ListStreamProcessorsPaginatorOptions)) *ListStreamProcessorsPaginator {
if params == nil {
params = &ListStreamProcessorsInput{}
}
options := ListStreamProcessorsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListStreamProcessorsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListStreamProcessorsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListStreamProcessors page.
func (p *ListStreamProcessorsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListStreamProcessorsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListStreamProcessors(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListStreamProcessors(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "ListStreamProcessors",
}
}
| 226 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of tags in an Amazon Rekognition collection, stream processor,
// or Custom Labels model. This operation requires permissions to perform the
// rekognition:ListTagsForResource action.
func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) {
if params == nil {
params = &ListTagsForResourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListTagsForResourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListTagsForResourceInput struct {
// Amazon Resource Name (ARN) of the model, collection, or stream processor that
// contains the tags that you want a list of.
//
// This member is required.
ResourceArn *string
noSmithyDocumentSerde
}
type ListTagsForResourceOutput struct {
// A list of key-value tags assigned to the resource.
Tags map[string]string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListTagsForResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListTagsForResource{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(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
}
return nil
}
func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "ListTagsForResource",
}
}
| 127 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns metadata of the User such as UserID in the specified collection.
// Anonymous User (to reserve faces without any identity) is not returned as part
// of this request. The results are sorted by system generated primary key ID. If
// the response is truncated, NextToken is returned in the response that can be
// used in the subsequent request to retrieve the next set of identities.
func (c *Client) ListUsers(ctx context.Context, params *ListUsersInput, optFns ...func(*Options)) (*ListUsersOutput, error) {
if params == nil {
params = &ListUsersInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListUsers", params, optFns, c.addOperationListUsersMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListUsersOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListUsersInput struct {
// The ID of an existing collection.
//
// This member is required.
CollectionId *string
// Maximum number of UsersID to return.
MaxResults *int32
// Pagingation token to receive the next set of UsersID.
NextToken *string
noSmithyDocumentSerde
}
type ListUsersOutput struct {
// A pagination token to be used with the subsequent request if the response is
// truncated.
NextToken *string
// List of UsersID associated with the specified collection.
Users []types.User
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListUsersMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpListUsers{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListUsers{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpListUsersValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListUsers(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
}
return nil
}
// ListUsersAPIClient is a client that implements the ListUsers operation.
type ListUsersAPIClient interface {
ListUsers(context.Context, *ListUsersInput, ...func(*Options)) (*ListUsersOutput, error)
}
var _ ListUsersAPIClient = (*Client)(nil)
// ListUsersPaginatorOptions is the paginator options for ListUsers
type ListUsersPaginatorOptions struct {
// Maximum number of UsersID to return.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// ListUsersPaginator is a paginator for ListUsers
type ListUsersPaginator struct {
options ListUsersPaginatorOptions
client ListUsersAPIClient
params *ListUsersInput
nextToken *string
firstPage bool
}
// NewListUsersPaginator returns a new ListUsersPaginator
func NewListUsersPaginator(client ListUsersAPIClient, params *ListUsersInput, optFns ...func(*ListUsersPaginatorOptions)) *ListUsersPaginator {
if params == nil {
params = &ListUsersInput{}
}
options := ListUsersPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListUsersPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListUsersPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListUsers page.
func (p *ListUsersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListUsersOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.NextToken = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.MaxResults = limit
result, err := p.client.ListUsers(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.NextToken
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListUsers(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "ListUsers",
}
}
| 229 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Attaches a project policy to a Amazon Rekognition Custom Labels project in a
// trusting AWS account. A project policy specifies that a trusted AWS account can
// copy a model version from a trusting AWS account to a project in the trusted AWS
// account. To copy a model version you use the CopyProjectVersion operation. For
// more information about the format of a project policy document, see Attaching a
// project policy (SDK) in the Amazon Rekognition Custom Labels Developer Guide.
// The response from PutProjectPolicy is a revision ID for the project policy. You
// can attach multiple project policies to a project. You can also update an
// existing project policy by specifying the policy revision ID of the existing
// policy. To remove a project policy from a project, call DeleteProjectPolicy . To
// get a list of project policies attached to a project, call ListProjectPolicies .
// You copy a model version by calling CopyProjectVersion . This operation requires
// permissions to perform the rekognition:PutProjectPolicy action.
func (c *Client) PutProjectPolicy(ctx context.Context, params *PutProjectPolicyInput, optFns ...func(*Options)) (*PutProjectPolicyOutput, error) {
if params == nil {
params = &PutProjectPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "PutProjectPolicy", params, optFns, c.addOperationPutProjectPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*PutProjectPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
type PutProjectPolicyInput struct {
// A resource policy to add to the model. The policy is a JSON structure that
// contains one or more statements that define the policy. The policy must follow
// the IAM syntax. For more information about the contents of a JSON policy
// document, see IAM JSON policy reference (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies.html)
// .
//
// This member is required.
PolicyDocument *string
// A name for the policy.
//
// This member is required.
PolicyName *string
// The Amazon Resource Name (ARN) of the project that the project policy is
// attached to.
//
// This member is required.
ProjectArn *string
// The revision ID for the Project Policy. Each time you modify a policy, Amazon
// Rekognition Custom Labels generates and assigns a new PolicyRevisionId and then
// deletes the previous version of the policy.
PolicyRevisionId *string
noSmithyDocumentSerde
}
type PutProjectPolicyOutput struct {
// The ID of the project policy.
PolicyRevisionId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPutProjectPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutProjectPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutProjectPolicy{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpPutProjectPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutProjectPolicy(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
}
return nil
}
func newServiceMetadataMiddleware_opPutProjectPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "PutProjectPolicy",
}
}
| 156 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns an array of celebrities recognized in the input image. For more
// information, see Recognizing celebrities in the Amazon Rekognition Developer
// Guide. RecognizeCelebrities returns the 64 largest faces in the image. It lists
// the recognized celebrities in the CelebrityFaces array and any unrecognized
// faces in the UnrecognizedFaces array. RecognizeCelebrities doesn't return
// celebrities whose faces aren't among the largest 64 faces in the image. For each
// celebrity recognized, RecognizeCelebrities returns a Celebrity object. The
// Celebrity object contains the celebrity name, ID, URL links to additional
// information, match confidence, and a ComparedFace object that you can use to
// locate the celebrity's face on the image. Amazon Rekognition doesn't retain
// information about which images a celebrity has been recognized in. Your
// application must store this information and use the Celebrity ID property as a
// unique identifier for the celebrity. If you don't store the celebrity name or
// additional information URLs returned by RecognizeCelebrities , you will need the
// ID to identify the celebrity in a call to the GetCelebrityInfo operation. You
// pass the input image either as base64-encoded image bytes or as a reference to
// an image in an Amazon S3 bucket. If you use the AWS CLI to call Amazon
// Rekognition operations, passing image bytes is not supported. The image must be
// either a PNG or JPEG formatted file. For an example, see Recognizing celebrities
// in an image in the Amazon Rekognition Developer Guide. This operation requires
// permissions to perform the rekognition:RecognizeCelebrities operation.
func (c *Client) RecognizeCelebrities(ctx context.Context, params *RecognizeCelebritiesInput, optFns ...func(*Options)) (*RecognizeCelebritiesOutput, error) {
if params == nil {
params = &RecognizeCelebritiesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "RecognizeCelebrities", params, optFns, c.addOperationRecognizeCelebritiesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*RecognizeCelebritiesOutput)
out.ResultMetadata = metadata
return out, nil
}
type RecognizeCelebritiesInput struct {
// The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI
// to call Amazon Rekognition operations, passing base64-encoded image bytes is not
// supported. If you are using an AWS SDK to call Amazon Rekognition, you might not
// need to base64-encode image bytes passed using the Bytes field. For more
// information, see Images in the Amazon Rekognition developer guide.
//
// This member is required.
Image *types.Image
noSmithyDocumentSerde
}
type RecognizeCelebritiesOutput struct {
// Details about each celebrity found in the image. Amazon Rekognition can detect
// a maximum of 64 celebrities in an image. Each celebrity object includes the
// following attributes: Face , Confidence , Emotions , Landmarks , Pose , Quality
// , Smile , Id , KnownGender , MatchConfidence , Name , Urls .
CelebrityFaces []types.Celebrity
// Support for estimating image orientation using the the OrientationCorrection
// field has ceased as of August 2021. Any returned values for this field included
// in an API response will always be NULL. The orientation of the input image
// (counterclockwise direction). If your application displays the image, you can
// use this value to correct the orientation. The bounding box coordinates returned
// in CelebrityFaces and UnrecognizedFaces represent face locations before the
// image orientation is corrected. If the input image is in .jpeg format, it might
// contain exchangeable image (Exif) metadata that includes the image's
// orientation. If so, and the Exif metadata for the input image populates the
// orientation field, the value of OrientationCorrection is null. The
// CelebrityFaces and UnrecognizedFaces bounding box coordinates represent face
// locations after Exif metadata is used to correct the image orientation. Images
// in .png format don't contain Exif metadata.
OrientationCorrection types.OrientationCorrection
// Details about each unrecognized face in the image.
UnrecognizedFaces []types.ComparedFace
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationRecognizeCelebritiesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpRecognizeCelebrities{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpRecognizeCelebrities{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpRecognizeCelebritiesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRecognizeCelebrities(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
}
return nil
}
func newServiceMetadataMiddleware_opRecognizeCelebrities(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "RecognizeCelebrities",
}
}
| 170 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// For a given input face ID, searches for matching faces in the collection the
// face belongs to. You get a face ID when you add a face to the collection using
// the IndexFaces operation. The operation compares the features of the input face
// with faces in the specified collection. You can also search faces without
// indexing faces by using the SearchFacesByImage operation. The operation
// response returns an array of faces that match, ordered by similarity score with
// the highest similarity first. More specifically, it is an array of metadata for
// each face match that is found. Along with the metadata, the response also
// includes a confidence value for each face match, indicating the confidence that
// the specific face matches the input face. For an example, see Searching for a
// face using its face ID in the Amazon Rekognition Developer Guide. This operation
// requires permissions to perform the rekognition:SearchFaces action.
func (c *Client) SearchFaces(ctx context.Context, params *SearchFacesInput, optFns ...func(*Options)) (*SearchFacesOutput, error) {
if params == nil {
params = &SearchFacesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "SearchFaces", params, optFns, c.addOperationSearchFacesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*SearchFacesOutput)
out.ResultMetadata = metadata
return out, nil
}
type SearchFacesInput struct {
// ID of the collection the face belongs to.
//
// This member is required.
CollectionId *string
// ID of a face to find matches for in the collection.
//
// This member is required.
FaceId *string
// Optional value specifying the minimum confidence in the face match to return.
// For example, don't return any matches where confidence in matches is less than
// 70%. The default value is 80%.
FaceMatchThreshold *float32
// Maximum number of faces to return. The operation returns the maximum number of
// faces with the highest confidence in the match.
MaxFaces *int32
noSmithyDocumentSerde
}
type SearchFacesOutput struct {
// An array of faces that matched the input face, along with the confidence in the
// match.
FaceMatches []types.FaceMatch
// Version number of the face detection model associated with the input collection
// ( CollectionId ).
FaceModelVersion *string
// ID of the face that was searched for matches in a collection.
SearchedFaceId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationSearchFacesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpSearchFaces{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpSearchFaces{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpSearchFacesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchFaces(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
}
return nil
}
func newServiceMetadataMiddleware_opSearchFaces(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "SearchFaces",
}
}
| 158 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// For a given input image, first detects the largest face in the image, and then
// searches the specified collection for matching faces. The operation compares the
// features of the input face with faces in the specified collection. To search for
// all faces in an input image, you might first call the IndexFaces operation, and
// then use the face IDs returned in subsequent calls to the SearchFaces
// operation. You can also call the DetectFaces operation and use the bounding
// boxes in the response to make face crops, which then you can pass in to the
// SearchFacesByImage operation. You pass the input image either as base64-encoded
// image bytes or as a reference to an image in an Amazon S3 bucket. If you use the
// AWS CLI to call Amazon Rekognition operations, passing image bytes is not
// supported. The image must be either a PNG or JPEG formatted file. The response
// returns an array of faces that match, ordered by similarity score with the
// highest similarity first. More specifically, it is an array of metadata for each
// face match found. Along with the metadata, the response also includes a
// similarity indicating how similar the face is to the input face. In the
// response, the operation also returns the bounding box (and a confidence level
// that the bounding box contains a face) of the face that Amazon Rekognition used
// for the input image. If no faces are detected in the input image,
// SearchFacesByImage returns an InvalidParameterException error. For an example,
// Searching for a Face Using an Image in the Amazon Rekognition Developer Guide.
// The QualityFilter input parameter allows you to filter out detected faces that
// don’t meet a required quality bar. The quality bar is based on a variety of
// common use cases. Use QualityFilter to set the quality bar for filtering by
// specifying LOW , MEDIUM , or HIGH . If you do not want to filter detected faces,
// specify NONE . The default value is NONE . To use quality filtering, you need a
// collection associated with version 3 of the face model or higher. To get the
// version of the face model associated with a collection, call DescribeCollection
// . This operation requires permissions to perform the
// rekognition:SearchFacesByImage action.
func (c *Client) SearchFacesByImage(ctx context.Context, params *SearchFacesByImageInput, optFns ...func(*Options)) (*SearchFacesByImageOutput, error) {
if params == nil {
params = &SearchFacesByImageInput{}
}
result, metadata, err := c.invokeOperation(ctx, "SearchFacesByImage", params, optFns, c.addOperationSearchFacesByImageMiddlewares)
if err != nil {
return nil, err
}
out := result.(*SearchFacesByImageOutput)
out.ResultMetadata = metadata
return out, nil
}
type SearchFacesByImageInput struct {
// ID of the collection to search.
//
// This member is required.
CollectionId *string
// The input image as base64-encoded bytes or an S3 object. If you use the AWS CLI
// to call Amazon Rekognition operations, passing base64-encoded image bytes is not
// supported. If you are using an AWS SDK to call Amazon Rekognition, you might not
// need to base64-encode image bytes passed using the Bytes field. For more
// information, see Images in the Amazon Rekognition developer guide.
//
// This member is required.
Image *types.Image
// (Optional) Specifies the minimum confidence in the face match to return. For
// example, don't return any matches where confidence in matches is less than 70%.
// The default value is 80%.
FaceMatchThreshold *float32
// Maximum number of faces to return. The operation returns the maximum number of
// faces with the highest confidence in the match.
MaxFaces *int32
// A filter that specifies a quality bar for how much filtering is done to
// identify faces. Filtered faces aren't searched for in the collection. If you
// specify AUTO , Amazon Rekognition chooses the quality bar. If you specify LOW ,
// MEDIUM , or HIGH , filtering removes all faces that don’t meet the chosen
// quality bar. The quality bar is based on a variety of common use cases.
// Low-quality detections can occur for a number of reasons. Some examples are an
// object that's misidentified as a face, a face that's too blurry, or a face with
// a pose that's too extreme to use. If you specify NONE , no filtering is
// performed. The default value is NONE . To use quality filtering, the collection
// you are using must be associated with version 3 of the face model or higher.
QualityFilter types.QualityFilter
noSmithyDocumentSerde
}
type SearchFacesByImageOutput struct {
// An array of faces that match the input face, along with the confidence in the
// match.
FaceMatches []types.FaceMatch
// Version number of the face detection model associated with the input collection
// ( CollectionId ).
FaceModelVersion *string
// The bounding box around the face in the input image that Amazon Rekognition
// used for the search.
SearchedFaceBoundingBox *types.BoundingBox
// The level of confidence that the searchedFaceBoundingBox , contains a face.
SearchedFaceConfidence *float32
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationSearchFacesByImageMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpSearchFacesByImage{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpSearchFacesByImage{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpSearchFacesByImageValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchFacesByImage(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
}
return nil
}
func newServiceMetadataMiddleware_opSearchFacesByImage(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "SearchFacesByImage",
}
}
| 195 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Searches for UserIDs within a collection based on a FaceId or UserId . This API
// can be used to find the closest UserID (with a highest similarity) to associate
// a face. The request must be provided with either FaceId or UserId . The
// operation returns an array of UserID that match the FaceId or UserId , ordered
// by similarity score with the highest similarity first.
func (c *Client) SearchUsers(ctx context.Context, params *SearchUsersInput, optFns ...func(*Options)) (*SearchUsersOutput, error) {
if params == nil {
params = &SearchUsersInput{}
}
result, metadata, err := c.invokeOperation(ctx, "SearchUsers", params, optFns, c.addOperationSearchUsersMiddlewares)
if err != nil {
return nil, err
}
out := result.(*SearchUsersOutput)
out.ResultMetadata = metadata
return out, nil
}
type SearchUsersInput struct {
// The ID of an existing collection containing the UserID, used with a UserId or
// FaceId. If a FaceId is provided, UserId isn’t required to be present in the
// Collection.
//
// This member is required.
CollectionId *string
// ID for the existing face.
FaceId *string
// Maximum number of identities to return.
MaxUsers *int32
// ID for the existing User.
UserId *string
// Optional value that specifies the minimum confidence in the matched UserID to
// return. Default value of 80.
UserMatchThreshold *float32
noSmithyDocumentSerde
}
type SearchUsersOutput struct {
// Version number of the face detection model associated with the input
// CollectionId.
FaceModelVersion *string
// Contains the ID of a face that was used to search for matches in a collection.
SearchedFace *types.SearchedFace
// Contains the ID of the UserID that was used to search for matches in a
// collection.
SearchedUser *types.SearchedUser
// An array of UserMatch objects that matched the input face along with the
// confidence in the match. Array will be empty if there are no matches.
UserMatches []types.UserMatch
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationSearchUsersMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpSearchUsers{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpSearchUsers{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpSearchUsersValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchUsers(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
}
return nil
}
func newServiceMetadataMiddleware_opSearchUsers(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "SearchUsers",
}
}
| 156 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Searches for UserIDs using a supplied image. It first detects the largest face
// in the image, and then searches a specified collection for matching UserIDs. The
// operation returns an array of UserIDs that match the face in the supplied image,
// ordered by similarity score with the highest similarity first. It also returns a
// bounding box for the face found in the input image. Information about faces
// detected in the supplied image, but not used for the search, is returned in an
// array of UnsearchedFace objects. If no valid face is detected in the image, the
// response will contain an empty UserMatches list and no SearchedFace object.
func (c *Client) SearchUsersByImage(ctx context.Context, params *SearchUsersByImageInput, optFns ...func(*Options)) (*SearchUsersByImageOutput, error) {
if params == nil {
params = &SearchUsersByImageInput{}
}
result, metadata, err := c.invokeOperation(ctx, "SearchUsersByImage", params, optFns, c.addOperationSearchUsersByImageMiddlewares)
if err != nil {
return nil, err
}
out := result.(*SearchUsersByImageOutput)
out.ResultMetadata = metadata
return out, nil
}
type SearchUsersByImageInput struct {
// The ID of an existing collection containing the UserID.
//
// This member is required.
CollectionId *string
// Provides the input image either as bytes or an S3 object. You pass image bytes
// to an Amazon Rekognition API operation by using the Bytes property. For
// example, you would use the Bytes property to pass an image loaded from a local
// file system. Image bytes passed by using the Bytes property must be
// base64-encoded. Your code may not need to encode image bytes if you are using an
// AWS SDK to call Amazon Rekognition API operations. For more information, see
// Analyzing an Image Loaded from a Local File System in the Amazon Rekognition
// Developer Guide. You pass images stored in an S3 bucket to an Amazon Rekognition
// API operation by using the S3Object property. Images stored in an S3 bucket do
// not need to be base64-encoded. The region for the S3 bucket containing the S3
// object must match the region you use for Amazon Rekognition operations. If you
// use the AWS CLI to call Amazon Rekognition operations, passing image bytes using
// the Bytes property is not supported. You must first upload the image to an
// Amazon S3 bucket and then call the operation using the S3Object property. For
// Amazon Rekognition to process an S3 object, the user must have permission to
// access the S3 object. For more information, see How Amazon Rekognition works
// with IAM in the Amazon Rekognition Developer Guide.
//
// This member is required.
Image *types.Image
// Maximum number of UserIDs to return.
MaxUsers *int32
// A filter that specifies a quality bar for how much filtering is done to
// identify faces. Filtered faces aren't searched for in the collection. The
// default value is NONE.
QualityFilter types.QualityFilter
// Specifies the minimum confidence in the UserID match to return. Default value
// is 80.
UserMatchThreshold *float32
noSmithyDocumentSerde
}
type SearchUsersByImageOutput struct {
// Version number of the face detection model associated with the input collection
// CollectionId.
FaceModelVersion *string
// A list of FaceDetail objects containing the BoundingBox for the largest face in
// image, as well as the confidence in the bounding box, that was searched for
// matches. If no valid face is detected in the image the response will contain no
// SearchedFace object.
SearchedFace *types.SearchedFaceDetails
// List of UnsearchedFace objects. Contains the face details infered from the
// specified image but not used for search. Contains reasons that describe why a
// face wasn't used for Search.
UnsearchedFaces []types.UnsearchedFace
// An array of UserID objects that matched the input face, along with the
// confidence in the match. The returned structure will be empty if there are no
// matches. Returned if the SearchUsersByImageResponse action is successful.
UserMatches []types.UserMatch
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationSearchUsersByImageMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpSearchUsersByImage{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpSearchUsersByImage{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpSearchUsersByImageValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSearchUsersByImage(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
}
return nil
}
func newServiceMetadataMiddleware_opSearchUsersByImage(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "SearchUsersByImage",
}
}
| 182 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts asynchronous recognition of celebrities in a stored video. Amazon
// Rekognition Video can detect celebrities in a video must be stored in an Amazon
// S3 bucket. Use Video to specify the bucket name and the filename of the video.
// StartCelebrityRecognition returns a job identifier ( JobId ) which you use to
// get the results of the analysis. When celebrity recognition analysis is
// finished, Amazon Rekognition Video publishes a completion status to the Amazon
// Simple Notification Service topic that you specify in NotificationChannel . To
// get the results of the celebrity recognition analysis, first check that the
// status value published to the Amazon SNS topic is SUCCEEDED . If so, call
// GetCelebrityRecognition and pass the job identifier ( JobId ) from the initial
// call to StartCelebrityRecognition . For more information, see Recognizing
// celebrities in the Amazon Rekognition Developer Guide.
func (c *Client) StartCelebrityRecognition(ctx context.Context, params *StartCelebrityRecognitionInput, optFns ...func(*Options)) (*StartCelebrityRecognitionOutput, error) {
if params == nil {
params = &StartCelebrityRecognitionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartCelebrityRecognition", params, optFns, c.addOperationStartCelebrityRecognitionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartCelebrityRecognitionOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartCelebrityRecognitionInput struct {
// The video in which you want to recognize celebrities. The video must be stored
// in an Amazon S3 bucket.
//
// This member is required.
Video *types.Video
// Idempotent token used to identify the start request. If you use the same token
// with multiple StartCelebrityRecognition requests, the same JobId is returned.
// Use ClientRequestToken to prevent the same job from being accidently started
// more than once.
ClientRequestToken *string
// An identifier you specify that's returned in the completion notification that's
// published to your Amazon Simple Notification Service topic. For example, you can
// use JobTag to group related jobs and identify them in the completion
// notification.
JobTag *string
// The Amazon SNS topic ARN that you want Amazon Rekognition Video to publish the
// completion status of the celebrity recognition analysis to. The Amazon SNS topic
// must have a topic name that begins with AmazonRekognition if you are using the
// AmazonRekognitionServiceRole permissions policy.
NotificationChannel *types.NotificationChannel
noSmithyDocumentSerde
}
type StartCelebrityRecognitionOutput struct {
// The identifier for the celebrity recognition analysis job. Use JobId to
// identify the job in a subsequent call to GetCelebrityRecognition .
JobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartCelebrityRecognitionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartCelebrityRecognition{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartCelebrityRecognition{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartCelebrityRecognitionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartCelebrityRecognition(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
}
return nil
}
func newServiceMetadataMiddleware_opStartCelebrityRecognition(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartCelebrityRecognition",
}
}
| 156 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts asynchronous detection of inappropriate, unwanted, or offensive content
// in a stored video. For a list of moderation labels in Amazon Rekognition, see
// Using the image and video moderation APIs (https://docs.aws.amazon.com/rekognition/latest/dg/moderation.html#moderation-api)
// . Amazon Rekognition Video can moderate content in a video stored in an Amazon
// S3 bucket. Use Video to specify the bucket name and the filename of the video.
// StartContentModeration returns a job identifier ( JobId ) which you use to get
// the results of the analysis. When content analysis is finished, Amazon
// Rekognition Video publishes a completion status to the Amazon Simple
// Notification Service topic that you specify in NotificationChannel . To get the
// results of the content analysis, first check that the status value published to
// the Amazon SNS topic is SUCCEEDED . If so, call GetContentModeration and pass
// the job identifier ( JobId ) from the initial call to StartContentModeration .
// For more information, see Moderating content in the Amazon Rekognition Developer
// Guide.
func (c *Client) StartContentModeration(ctx context.Context, params *StartContentModerationInput, optFns ...func(*Options)) (*StartContentModerationOutput, error) {
if params == nil {
params = &StartContentModerationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartContentModeration", params, optFns, c.addOperationStartContentModerationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartContentModerationOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartContentModerationInput struct {
// The video in which you want to detect inappropriate, unwanted, or offensive
// content. The video must be stored in an Amazon S3 bucket.
//
// This member is required.
Video *types.Video
// Idempotent token used to identify the start request. If you use the same token
// with multiple StartContentModeration requests, the same JobId is returned. Use
// ClientRequestToken to prevent the same job from being accidently started more
// than once.
ClientRequestToken *string
// An identifier you specify that's returned in the completion notification that's
// published to your Amazon Simple Notification Service topic. For example, you can
// use JobTag to group related jobs and identify them in the completion
// notification.
JobTag *string
// Specifies the minimum confidence that Amazon Rekognition must have in order to
// return a moderated content label. Confidence represents how certain Amazon
// Rekognition is that the moderated content is correctly identified. 0 is the
// lowest confidence. 100 is the highest confidence. Amazon Rekognition doesn't
// return any moderated content labels with a confidence level lower than this
// specified value. If you don't specify MinConfidence , GetContentModeration
// returns labels with confidence values greater than or equal to 50 percent.
MinConfidence *float32
// The Amazon SNS topic ARN that you want Amazon Rekognition Video to publish the
// completion status of the content analysis to. The Amazon SNS topic must have a
// topic name that begins with AmazonRekognition if you are using the
// AmazonRekognitionServiceRole permissions policy to access the topic.
NotificationChannel *types.NotificationChannel
noSmithyDocumentSerde
}
type StartContentModerationOutput struct {
// The identifier for the content analysis job. Use JobId to identify the job in a
// subsequent call to GetContentModeration .
JobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartContentModerationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartContentModeration{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartContentModeration{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartContentModerationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartContentModeration(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
}
return nil
}
func newServiceMetadataMiddleware_opStartContentModeration(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartContentModeration",
}
}
| 167 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts asynchronous detection of faces in a stored video. Amazon Rekognition
// Video can detect faces in a video stored in an Amazon S3 bucket. Use Video to
// specify the bucket name and the filename of the video. StartFaceDetection
// returns a job identifier ( JobId ) that you use to get the results of the
// operation. When face detection is finished, Amazon Rekognition Video publishes a
// completion status to the Amazon Simple Notification Service topic that you
// specify in NotificationChannel . To get the results of the face detection
// operation, first check that the status value published to the Amazon SNS topic
// is SUCCEEDED . If so, call GetFaceDetection and pass the job identifier ( JobId
// ) from the initial call to StartFaceDetection . For more information, see
// Detecting faces in a stored video in the Amazon Rekognition Developer Guide.
func (c *Client) StartFaceDetection(ctx context.Context, params *StartFaceDetectionInput, optFns ...func(*Options)) (*StartFaceDetectionOutput, error) {
if params == nil {
params = &StartFaceDetectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartFaceDetection", params, optFns, c.addOperationStartFaceDetectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartFaceDetectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartFaceDetectionInput struct {
// The video in which you want to detect faces. The video must be stored in an
// Amazon S3 bucket.
//
// This member is required.
Video *types.Video
// Idempotent token used to identify the start request. If you use the same token
// with multiple StartFaceDetection requests, the same JobId is returned. Use
// ClientRequestToken to prevent the same job from being accidently started more
// than once.
ClientRequestToken *string
// The face attributes you want returned. DEFAULT - The following subset of facial
// attributes are returned: BoundingBox, Confidence, Pose, Quality and Landmarks.
// ALL - All facial attributes are returned.
FaceAttributes types.FaceAttributes
// An identifier you specify that's returned in the completion notification that's
// published to your Amazon Simple Notification Service topic. For example, you can
// use JobTag to group related jobs and identify them in the completion
// notification.
JobTag *string
// The ARN of the Amazon SNS topic to which you want Amazon Rekognition Video to
// publish the completion status of the face detection operation. The Amazon SNS
// topic must have a topic name that begins with AmazonRekognition if you are using
// the AmazonRekognitionServiceRole permissions policy.
NotificationChannel *types.NotificationChannel
noSmithyDocumentSerde
}
type StartFaceDetectionOutput struct {
// The identifier for the face detection job. Use JobId to identify the job in a
// subsequent call to GetFaceDetection .
JobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartFaceDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartFaceDetection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartFaceDetection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartFaceDetectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartFaceDetection(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
}
return nil
}
func newServiceMetadataMiddleware_opStartFaceDetection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartFaceDetection",
}
}
| 160 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts the asynchronous search for faces in a collection that match the faces
// of persons detected in a stored video. The video must be stored in an Amazon S3
// bucket. Use Video to specify the bucket name and the filename of the video.
// StartFaceSearch returns a job identifier ( JobId ) which you use to get the
// search results once the search has completed. When searching is finished, Amazon
// Rekognition Video publishes a completion status to the Amazon Simple
// Notification Service topic that you specify in NotificationChannel . To get the
// search results, first check that the status value published to the Amazon SNS
// topic is SUCCEEDED . If so, call GetFaceSearch and pass the job identifier (
// JobId ) from the initial call to StartFaceSearch . For more information, see
// Searching stored videos for faces (https://docs.aws.amazon.com/rekognition/latest/dg/procedure-person-search-videos.html)
// .
func (c *Client) StartFaceSearch(ctx context.Context, params *StartFaceSearchInput, optFns ...func(*Options)) (*StartFaceSearchOutput, error) {
if params == nil {
params = &StartFaceSearchInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartFaceSearch", params, optFns, c.addOperationStartFaceSearchMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartFaceSearchOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartFaceSearchInput struct {
// ID of the collection that contains the faces you want to search for.
//
// This member is required.
CollectionId *string
// The video you want to search. The video must be stored in an Amazon S3 bucket.
//
// This member is required.
Video *types.Video
// Idempotent token used to identify the start request. If you use the same token
// with multiple StartFaceSearch requests, the same JobId is returned. Use
// ClientRequestToken to prevent the same job from being accidently started more
// than once.
ClientRequestToken *string
// The minimum confidence in the person match to return. For example, don't return
// any matches where confidence in matches is less than 70%. The default value is
// 80%.
FaceMatchThreshold *float32
// An identifier you specify that's returned in the completion notification that's
// published to your Amazon Simple Notification Service topic. For example, you can
// use JobTag to group related jobs and identify them in the completion
// notification.
JobTag *string
// The ARN of the Amazon SNS topic to which you want Amazon Rekognition Video to
// publish the completion status of the search. The Amazon SNS topic must have a
// topic name that begins with AmazonRekognition if you are using the
// AmazonRekognitionServiceRole permissions policy to access the topic.
NotificationChannel *types.NotificationChannel
noSmithyDocumentSerde
}
type StartFaceSearchOutput struct {
// The identifier for the search job. Use JobId to identify the job in a
// subsequent call to GetFaceSearch .
JobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartFaceSearchMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartFaceSearch{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartFaceSearch{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartFaceSearchValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartFaceSearch(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
}
return nil
}
func newServiceMetadataMiddleware_opStartFaceSearch(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartFaceSearch",
}
}
| 165 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts asynchronous detection of labels in a stored video. Amazon Rekognition
// Video can detect labels in a video. Labels are instances of real-world entities.
// This includes objects like flower, tree, and table; events like wedding,
// graduation, and birthday party; concepts like landscape, evening, and nature;
// and activities like a person getting out of a car or a person skiing. The video
// must be stored in an Amazon S3 bucket. Use Video to specify the bucket name and
// the filename of the video. StartLabelDetection returns a job identifier ( JobId
// ) which you use to get the results of the operation. When label detection is
// finished, Amazon Rekognition Video publishes a completion status to the Amazon
// Simple Notification Service topic that you specify in NotificationChannel . To
// get the results of the label detection operation, first check that the status
// value published to the Amazon SNS topic is SUCCEEDED . If so, call
// GetLabelDetection and pass the job identifier ( JobId ) from the initial call to
// StartLabelDetection . Optional Parameters StartLabelDetection has the
// GENERAL_LABELS Feature applied by default. This feature allows you to provide
// filtering criteria to the Settings parameter. You can filter with sets of
// individual labels or with label categories. You can specify inclusive filters,
// exclusive filters, or a combination of inclusive and exclusive filters. For more
// information on filtering, see Detecting labels in a video (https://docs.aws.amazon.com/rekognition/latest/dg/labels-detecting-labels-video.html)
// . You can specify MinConfidence to control the confidence threshold for the
// labels returned. The default is 50.
func (c *Client) StartLabelDetection(ctx context.Context, params *StartLabelDetectionInput, optFns ...func(*Options)) (*StartLabelDetectionOutput, error) {
if params == nil {
params = &StartLabelDetectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartLabelDetection", params, optFns, c.addOperationStartLabelDetectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartLabelDetectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartLabelDetectionInput struct {
// The video in which you want to detect labels. The video must be stored in an
// Amazon S3 bucket.
//
// This member is required.
Video *types.Video
// Idempotent token used to identify the start request. If you use the same token
// with multiple StartLabelDetection requests, the same JobId is returned. Use
// ClientRequestToken to prevent the same job from being accidently started more
// than once.
ClientRequestToken *string
// The features to return after video analysis. You can specify that
// GENERAL_LABELS are returned.
Features []types.LabelDetectionFeatureName
// An identifier you specify that's returned in the completion notification that's
// published to your Amazon Simple Notification Service topic. For example, you can
// use JobTag to group related jobs and identify them in the completion
// notification.
JobTag *string
// Specifies the minimum confidence that Amazon Rekognition Video must have in
// order to return a detected label. Confidence represents how certain Amazon
// Rekognition is that a label is correctly identified.0 is the lowest confidence.
// 100 is the highest confidence. Amazon Rekognition Video doesn't return any
// labels with a confidence level lower than this specified value. If you don't
// specify MinConfidence , the operation returns labels and bounding boxes (if
// detected) with confidence values greater than or equal to 50 percent.
MinConfidence *float32
// The Amazon SNS topic ARN you want Amazon Rekognition Video to publish the
// completion status of the label detection operation to. The Amazon SNS topic must
// have a topic name that begins with AmazonRekognition if you are using the
// AmazonRekognitionServiceRole permissions policy.
NotificationChannel *types.NotificationChannel
// The settings for a StartLabelDetection request.Contains the specified
// parameters for the label detection request of an asynchronous label analysis
// operation. Settings can include filters for GENERAL_LABELS.
Settings *types.LabelDetectionSettings
noSmithyDocumentSerde
}
type StartLabelDetectionOutput struct {
// The identifier for the label detection job. Use JobId to identify the job in a
// subsequent call to GetLabelDetection .
JobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartLabelDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartLabelDetection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartLabelDetection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartLabelDetectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartLabelDetection(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
}
return nil
}
func newServiceMetadataMiddleware_opStartLabelDetection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartLabelDetection",
}
}
| 183 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts the asynchronous tracking of a person's path in a stored video. Amazon
// Rekognition Video can track the path of people in a video stored in an Amazon S3
// bucket. Use Video to specify the bucket name and the filename of the video.
// StartPersonTracking returns a job identifier ( JobId ) which you use to get the
// results of the operation. When label detection is finished, Amazon Rekognition
// publishes a completion status to the Amazon Simple Notification Service topic
// that you specify in NotificationChannel . To get the results of the person
// detection operation, first check that the status value published to the Amazon
// SNS topic is SUCCEEDED . If so, call GetPersonTracking and pass the job
// identifier ( JobId ) from the initial call to StartPersonTracking .
func (c *Client) StartPersonTracking(ctx context.Context, params *StartPersonTrackingInput, optFns ...func(*Options)) (*StartPersonTrackingOutput, error) {
if params == nil {
params = &StartPersonTrackingInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartPersonTracking", params, optFns, c.addOperationStartPersonTrackingMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartPersonTrackingOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartPersonTrackingInput struct {
// The video in which you want to detect people. The video must be stored in an
// Amazon S3 bucket.
//
// This member is required.
Video *types.Video
// Idempotent token used to identify the start request. If you use the same token
// with multiple StartPersonTracking requests, the same JobId is returned. Use
// ClientRequestToken to prevent the same job from being accidently started more
// than once.
ClientRequestToken *string
// An identifier you specify that's returned in the completion notification that's
// published to your Amazon Simple Notification Service topic. For example, you can
// use JobTag to group related jobs and identify them in the completion
// notification.
JobTag *string
// The Amazon SNS topic ARN you want Amazon Rekognition Video to publish the
// completion status of the people detection operation to. The Amazon SNS topic
// must have a topic name that begins with AmazonRekognition if you are using the
// AmazonRekognitionServiceRole permissions policy.
NotificationChannel *types.NotificationChannel
noSmithyDocumentSerde
}
type StartPersonTrackingOutput struct {
// The identifier for the person detection job. Use JobId to identify the job in a
// subsequent call to GetPersonTracking .
JobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartPersonTrackingMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartPersonTracking{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartPersonTracking{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartPersonTrackingValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartPersonTracking(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
}
return nil
}
func newServiceMetadataMiddleware_opStartPersonTracking(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartPersonTracking",
}
}
| 154 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts the running of the version of a model. Starting a model takes a while to
// complete. To check the current state of the model, use DescribeProjectVersions .
// Once the model is running, you can detect custom labels in new images by calling
// DetectCustomLabels . You are charged for the amount of time that the model is
// running. To stop a running model, call StopProjectVersion . For more
// information, see Running a trained Amazon Rekognition Custom Labels model in the
// Amazon Rekognition Custom Labels Guide. This operation requires permissions to
// perform the rekognition:StartProjectVersion action.
func (c *Client) StartProjectVersion(ctx context.Context, params *StartProjectVersionInput, optFns ...func(*Options)) (*StartProjectVersionOutput, error) {
if params == nil {
params = &StartProjectVersionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartProjectVersion", params, optFns, c.addOperationStartProjectVersionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartProjectVersionOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartProjectVersionInput struct {
// The minimum number of inference units to use. A single inference unit
// represents 1 hour of processing. For information about the number of
// transactions per second (TPS) that an inference unit can support, see Running a
// trained Amazon Rekognition Custom Labels model in the Amazon Rekognition Custom
// Labels Guide. Use a higher number to increase the TPS throughput of your model.
// You are charged for the number of inference units that you use.
//
// This member is required.
MinInferenceUnits *int32
// The Amazon Resource Name(ARN) of the model version that you want to start.
//
// This member is required.
ProjectVersionArn *string
// The maximum number of inference units to use for auto-scaling the model. If you
// don't specify a value, Amazon Rekognition Custom Labels doesn't auto-scale the
// model.
MaxInferenceUnits *int32
noSmithyDocumentSerde
}
type StartProjectVersionOutput struct {
// The current running status of the model.
Status types.ProjectVersionStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartProjectVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartProjectVersion{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartProjectVersion{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartProjectVersionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartProjectVersion(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
}
return nil
}
func newServiceMetadataMiddleware_opStartProjectVersion(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartProjectVersion",
}
}
| 147 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts asynchronous detection of segment detection in a stored video. Amazon
// Rekognition Video can detect segments in a video stored in an Amazon S3 bucket.
// Use Video to specify the bucket name and the filename of the video.
// StartSegmentDetection returns a job identifier ( JobId ) which you use to get
// the results of the operation. When segment detection is finished, Amazon
// Rekognition Video publishes a completion status to the Amazon Simple
// Notification Service topic that you specify in NotificationChannel . You can use
// the Filters ( StartSegmentDetectionFilters ) input parameter to specify the
// minimum detection confidence returned in the response. Within Filters , use
// ShotFilter ( StartShotDetectionFilter ) to filter detected shots. Use
// TechnicalCueFilter ( StartTechnicalCueDetectionFilter ) to filter technical
// cues. To get the results of the segment detection operation, first check that
// the status value published to the Amazon SNS topic is SUCCEEDED . if so, call
// GetSegmentDetection and pass the job identifier ( JobId ) from the initial call
// to StartSegmentDetection . For more information, see Detecting video segments in
// stored video in the Amazon Rekognition Developer Guide.
func (c *Client) StartSegmentDetection(ctx context.Context, params *StartSegmentDetectionInput, optFns ...func(*Options)) (*StartSegmentDetectionOutput, error) {
if params == nil {
params = &StartSegmentDetectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartSegmentDetection", params, optFns, c.addOperationStartSegmentDetectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartSegmentDetectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartSegmentDetectionInput struct {
// An array of segment types to detect in the video. Valid values are
// TECHNICAL_CUE and SHOT.
//
// This member is required.
SegmentTypes []types.SegmentType
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
//
// This member is required.
Video *types.Video
// Idempotent token used to identify the start request. If you use the same token
// with multiple StartSegmentDetection requests, the same JobId is returned. Use
// ClientRequestToken to prevent the same job from being accidently started more
// than once.
ClientRequestToken *string
// Filters for technical cue or shot detection.
Filters *types.StartSegmentDetectionFilters
// An identifier you specify that's returned in the completion notification that's
// published to your Amazon Simple Notification Service topic. For example, you can
// use JobTag to group related jobs and identify them in the completion
// notification.
JobTag *string
// The ARN of the Amazon SNS topic to which you want Amazon Rekognition Video to
// publish the completion status of the segment detection operation. Note that the
// Amazon SNS topic must have a topic name that begins with AmazonRekognition if
// you are using the AmazonRekognitionServiceRole permissions policy to access the
// topic.
NotificationChannel *types.NotificationChannel
noSmithyDocumentSerde
}
type StartSegmentDetectionOutput struct {
// Unique identifier for the segment detection job. The JobId is returned from
// StartSegmentDetection .
JobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartSegmentDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartSegmentDetection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartSegmentDetection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartSegmentDetectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartSegmentDetection(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
}
return nil
}
func newServiceMetadataMiddleware_opStartSegmentDetection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartSegmentDetection",
}
}
| 171 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts processing a stream processor. You create a stream processor by calling
// CreateStreamProcessor . To tell StartStreamProcessor which stream processor to
// start, use the value of the Name field specified in the call to
// CreateStreamProcessor . If you are using a label detection stream processor to
// detect labels, you need to provide a Start selector and a Stop selector to
// determine the length of the stream processing time.
func (c *Client) StartStreamProcessor(ctx context.Context, params *StartStreamProcessorInput, optFns ...func(*Options)) (*StartStreamProcessorOutput, error) {
if params == nil {
params = &StartStreamProcessorInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartStreamProcessor", params, optFns, c.addOperationStartStreamProcessorMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartStreamProcessorOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartStreamProcessorInput struct {
// The name of the stream processor to start processing.
//
// This member is required.
Name *string
// Specifies the starting point in the Kinesis stream to start processing. You can
// use the producer timestamp or the fragment number. If you use the producer
// timestamp, you must put the time in milliseconds. For more information about
// fragment numbers, see Fragment (https://docs.aws.amazon.com/kinesisvideostreams/latest/dg/API_reader_Fragment.html)
// . This is a required parameter for label detection stream processors and should
// not be used to start a face search stream processor.
StartSelector *types.StreamProcessingStartSelector
// Specifies when to stop processing the stream. You can specify a maximum amount
// of time to process the video. This is a required parameter for label detection
// stream processors and should not be used to start a face search stream
// processor.
StopSelector *types.StreamProcessingStopSelector
noSmithyDocumentSerde
}
type StartStreamProcessorOutput struct {
// A unique identifier for the stream processing session.
SessionId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartStreamProcessorMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartStreamProcessor{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartStreamProcessor{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartStreamProcessorValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartStreamProcessor(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
}
return nil
}
func newServiceMetadataMiddleware_opStartStreamProcessor(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartStreamProcessor",
}
}
| 144 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts asynchronous detection of text in a stored video. Amazon Rekognition
// Video can detect text in a video stored in an Amazon S3 bucket. Use Video to
// specify the bucket name and the filename of the video. StartTextDetection
// returns a job identifier ( JobId ) which you use to get the results of the
// operation. When text detection is finished, Amazon Rekognition Video publishes a
// completion status to the Amazon Simple Notification Service topic that you
// specify in NotificationChannel . To get the results of the text detection
// operation, first check that the status value published to the Amazon SNS topic
// is SUCCEEDED . if so, call GetTextDetection and pass the job identifier ( JobId
// ) from the initial call to StartTextDetection .
func (c *Client) StartTextDetection(ctx context.Context, params *StartTextDetectionInput, optFns ...func(*Options)) (*StartTextDetectionOutput, error) {
if params == nil {
params = &StartTextDetectionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartTextDetection", params, optFns, c.addOperationStartTextDetectionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartTextDetectionOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartTextDetectionInput struct {
// Video file stored in an Amazon S3 bucket. Amazon Rekognition video start
// operations such as StartLabelDetection use Video to specify a video for
// analysis. The supported file formats are .mp4, .mov and .avi.
//
// This member is required.
Video *types.Video
// Idempotent token used to identify the start request. If you use the same token
// with multiple StartTextDetection requests, the same JobId is returned. Use
// ClientRequestToken to prevent the same job from being accidentaly started more
// than once.
ClientRequestToken *string
// Optional parameters that let you set criteria the text must meet to be included
// in your response.
Filters *types.StartTextDetectionFilters
// An identifier returned in the completion status published by your Amazon Simple
// Notification Service topic. For example, you can use JobTag to group related
// jobs and identify them in the completion notification.
JobTag *string
// The Amazon Simple Notification Service topic to which Amazon Rekognition
// publishes the completion status of a video analysis operation. For more
// information, see Calling Amazon Rekognition Video operations (https://docs.aws.amazon.com/rekognition/latest/dg/api-video.html)
// . Note that the Amazon SNS topic must have a topic name that begins with
// AmazonRekognition if you are using the AmazonRekognitionServiceRole permissions
// policy to access the topic. For more information, see Giving access to multiple
// Amazon SNS topics (https://docs.aws.amazon.com/rekognition/latest/dg/api-video-roles.html#api-video-roles-all-topics)
// .
NotificationChannel *types.NotificationChannel
noSmithyDocumentSerde
}
type StartTextDetectionOutput struct {
// Identifier for the text detection job. Use JobId to identify the job in a
// subsequent call to GetTextDetection .
JobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartTextDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartTextDetection{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartTextDetection{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStartTextDetectionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartTextDetection(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
}
return nil
}
func newServiceMetadataMiddleware_opStartTextDetection(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StartTextDetection",
}
}
| 162 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rekognition
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/aws-sdk-go-v2/service/rekognition/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Stops a running model. The operation might take a while to complete. To check
// the current status, call DescribeProjectVersions . This operation requires
// permissions to perform the rekognition:StopProjectVersion action.
func (c *Client) StopProjectVersion(ctx context.Context, params *StopProjectVersionInput, optFns ...func(*Options)) (*StopProjectVersionOutput, error) {
if params == nil {
params = &StopProjectVersionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StopProjectVersion", params, optFns, c.addOperationStopProjectVersionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StopProjectVersionOutput)
out.ResultMetadata = metadata
return out, nil
}
type StopProjectVersionInput struct {
// The Amazon Resource Name (ARN) of the model version that you want to delete.
// This operation requires permissions to perform the
// rekognition:StopProjectVersion action.
//
// This member is required.
ProjectVersionArn *string
noSmithyDocumentSerde
}
type StopProjectVersionOutput struct {
// The current status of the stop operation.
Status types.ProjectVersionStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStopProjectVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpStopProjectVersion{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStopProjectVersion{}, middleware.After)
if 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 = addHTTPSignerV4Middleware(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); err != nil {
return err
}
if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
return err
}
if err = addOpStopProjectVersionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStopProjectVersion(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
}
return nil
}
func newServiceMetadataMiddleware_opStopProjectVersion(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rekognition",
OperationName: "StopProjectVersion",
}
}
| 129 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.