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 gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets details about a specified extension.
func (c *Client) GetExtension(ctx context.Context, params *GetExtensionInput, optFns ...func(*Options)) (*GetExtensionOutput, error) {
if params == nil {
params = &GetExtensionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetExtension", params, optFns, c.addOperationGetExtensionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetExtensionOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetExtensionInput struct {
// The name of the extension.
//
// This member is required.
Name *string
// The namespace (qualifier) of the extension.
//
// This member is required.
Namespace *string
noSmithyDocumentSerde
}
type GetExtensionOutput struct {
// Details about the extension.
Extension *types.ExtensionDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetExtensionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetExtension{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetExtension{}, 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 = addOpGetExtensionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetExtension(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_opGetExtension(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetExtension",
}
}
| 130 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets details about a specified extension version.
func (c *Client) GetExtensionVersion(ctx context.Context, params *GetExtensionVersionInput, optFns ...func(*Options)) (*GetExtensionVersionOutput, error) {
if params == nil {
params = &GetExtensionVersionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetExtensionVersion", params, optFns, c.addOperationGetExtensionVersionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetExtensionVersionOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetExtensionVersionInput struct {
// The version of the extension.
//
// This member is required.
ExtensionVersion *string
// The name of the extension.
//
// This member is required.
Name *string
// The namespace (qualifier) of the extension.
//
// This member is required.
Namespace *string
noSmithyDocumentSerde
}
type GetExtensionVersionOutput struct {
// The version of the extension.
ExtensionVersion *types.ExtensionVersionDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetExtensionVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetExtensionVersion{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetExtensionVersion{}, 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 = addOpGetExtensionVersionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetExtensionVersion(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_opGetExtensionVersion(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetExtensionVersion",
}
}
| 135 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets details about a game.
func (c *Client) GetGame(ctx context.Context, params *GetGameInput, optFns ...func(*Options)) (*GetGameOutput, error) {
if params == nil {
params = &GetGameInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetGame", params, optFns, c.addOperationGetGameMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetGameOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetGameInput struct {
// The name of the game.
//
// This member is required.
GameName *string
noSmithyDocumentSerde
}
type GetGameOutput struct {
// The details of the game.
Game *types.GameDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetGameMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetGame{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetGame{}, 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 = addOpGetGameValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGame(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_opGetGame(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetGame",
}
}
| 125 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the configuration of the game.
func (c *Client) GetGameConfiguration(ctx context.Context, params *GetGameConfigurationInput, optFns ...func(*Options)) (*GetGameConfigurationOutput, error) {
if params == nil {
params = &GetGameConfigurationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetGameConfiguration", params, optFns, c.addOperationGetGameConfigurationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetGameConfigurationOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetGameConfigurationInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The list of sections to return.
Sections []string
noSmithyDocumentSerde
}
type GetGameConfigurationOutput struct {
// Details about the game configuration.
GameConfiguration *types.GameConfigurationDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetGameConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetGameConfiguration{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetGameConfiguration{}, 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 = addOpGetGameConfigurationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGameConfiguration(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_opGetGameConfiguration(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetGameConfiguration",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets details about a job that is generating code for a snapshot.
func (c *Client) GetGeneratedCodeJob(ctx context.Context, params *GetGeneratedCodeJobInput, optFns ...func(*Options)) (*GetGeneratedCodeJobOutput, error) {
if params == nil {
params = &GetGeneratedCodeJobInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetGeneratedCodeJob", params, optFns, c.addOperationGetGeneratedCodeJobMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetGeneratedCodeJobOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetGeneratedCodeJobInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The identifier of the code generation job.
//
// This member is required.
JobId *string
// The identifier of the snapshot for the code generation job.
//
// This member is required.
SnapshotId *string
noSmithyDocumentSerde
}
type GetGeneratedCodeJobOutput struct {
// Details about the generated code job.
GeneratedCodeJob *types.GeneratedCodeJobDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetGeneratedCodeJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetGeneratedCodeJob{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetGeneratedCodeJob{}, 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 = addOpGetGeneratedCodeJobValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGeneratedCodeJob(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_opGetGeneratedCodeJob(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetGeneratedCodeJob",
}
}
| 135 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets the status of a player's connection to the game runtime. It's possible for
// a single player to have multiple connections to the game runtime. If a player is
// not connected, this operation returns an empty list.
func (c *Client) GetPlayerConnectionStatus(ctx context.Context, params *GetPlayerConnectionStatusInput, optFns ...func(*Options)) (*GetPlayerConnectionStatusOutput, error) {
if params == nil {
params = &GetPlayerConnectionStatusInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetPlayerConnectionStatus", params, optFns, c.addOperationGetPlayerConnectionStatusMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetPlayerConnectionStatusOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetPlayerConnectionStatusInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The unique identifier representing a player.
//
// This member is required.
PlayerId *string
// The name of the stage.
//
// This member is required.
StageName *string
noSmithyDocumentSerde
}
type GetPlayerConnectionStatusOutput struct {
// The list of connection ids, one for each connection in use by the player.
Connections []types.Connection
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetPlayerConnectionStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetPlayerConnectionStatus{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetPlayerConnectionStatus{}, 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 = addOpGetPlayerConnectionStatusValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPlayerConnectionStatus(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_opGetPlayerConnectionStatus(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetPlayerConnectionStatus",
}
}
| 137 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a copy of the game configuration in a snapshot.
func (c *Client) GetSnapshot(ctx context.Context, params *GetSnapshotInput, optFns ...func(*Options)) (*GetSnapshotOutput, error) {
if params == nil {
params = &GetSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetSnapshot", params, optFns, c.addOperationGetSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetSnapshotInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The identifier of the snapshot.
//
// This member is required.
SnapshotId *string
// The list of game configuration sections to be described.
Sections []string
noSmithyDocumentSerde
}
type GetSnapshotOutput struct {
// Properties that provide details of the snapshot.
Snapshot *types.SnapshotDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetSnapshot{}, 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 = addOpGetSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSnapshot(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_opGetSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetSnapshot",
}
}
| 133 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets information about a stage.
func (c *Client) GetStage(ctx context.Context, params *GetStageInput, optFns ...func(*Options)) (*GetStageOutput, error) {
if params == nil {
params = &GetStageInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetStage", params, optFns, c.addOperationGetStageMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetStageOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetStageInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The name of the stage.
//
// This member is required.
StageName *string
noSmithyDocumentSerde
}
type GetStageOutput struct {
// Properties that provide details of the stage.
Stage *types.StageDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetStageMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetStage{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetStage{}, 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 = addOpGetStageValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetStage(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_opGetStage(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetStage",
}
}
| 130 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets information about a stage deployment.
func (c *Client) GetStageDeployment(ctx context.Context, params *GetStageDeploymentInput, optFns ...func(*Options)) (*GetStageDeploymentOutput, error) {
if params == nil {
params = &GetStageDeploymentInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetStageDeployment", params, optFns, c.addOperationGetStageDeploymentMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetStageDeploymentOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetStageDeploymentInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The name of the stage.
//
// This member is required.
StageName *string
// The identifier of the stage deployment. StartStageDeployment returns the
// identifier that you use here.
DeploymentId *string
noSmithyDocumentSerde
}
type GetStageDeploymentOutput struct {
// Properties that provide details of the stage deployment.
StageDeployment *types.StageDeploymentDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetStageDeploymentMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetStageDeployment{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetStageDeployment{}, 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 = addOpGetStageDeploymentValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetStageDeployment(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_opGetStageDeployment(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "GetStageDeployment",
}
}
| 134 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Imports a game configuration. This operation replaces the current configuration
// of the game with the provided input. This is not a reversible operation. If you
// want to preserve the previous configuration, use CreateSnapshot to make a new
// snapshot before importing.
func (c *Client) ImportGameConfiguration(ctx context.Context, params *ImportGameConfigurationInput, optFns ...func(*Options)) (*ImportGameConfigurationOutput, error) {
if params == nil {
params = &ImportGameConfigurationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ImportGameConfiguration", params, optFns, c.addOperationImportGameConfigurationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ImportGameConfigurationOutput)
out.ResultMetadata = metadata
return out, nil
}
type ImportGameConfigurationInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The source used to import configuration sections.
//
// This member is required.
ImportSource *types.ImportGameConfigurationSource
noSmithyDocumentSerde
}
type ImportGameConfigurationOutput struct {
// Details about the game configuration.
GameConfiguration *types.GameConfigurationDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationImportGameConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpImportGameConfiguration{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpImportGameConfiguration{}, 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 = addOpImportGameConfigurationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opImportGameConfiguration(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_opImportGameConfiguration(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "ImportGameConfiguration",
}
}
| 133 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a paginated list of available extensions. Extensions provide features that
// games can use from scripts.
func (c *Client) ListExtensions(ctx context.Context, params *ListExtensionsInput, optFns ...func(*Options)) (*ListExtensionsOutput, error) {
if params == nil {
params = &ListExtensionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListExtensions", params, optFns, c.addOperationListExtensionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListExtensionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListExtensionsInput struct {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
MaxResults *int32
// The token that indicates the start of the next sequential page of results. Use
// the token that is returned with a previous call to this operation. To start at
// the beginning of the result set, do not specify a value.
NextToken *string
noSmithyDocumentSerde
}
type ListExtensionsOutput struct {
// The list of extensions.
Extensions []types.ExtensionDetails
// The token that indicates the start of the next sequential page of results. Use
// this value when making the next call to this operation to continue where the
// last one finished.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListExtensionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListExtensions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListExtensions{}, 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_opListExtensions(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
}
// ListExtensionsAPIClient is a client that implements the ListExtensions
// operation.
type ListExtensionsAPIClient interface {
ListExtensions(context.Context, *ListExtensionsInput, ...func(*Options)) (*ListExtensionsOutput, error)
}
var _ ListExtensionsAPIClient = (*Client)(nil)
// ListExtensionsPaginatorOptions is the paginator options for ListExtensions
type ListExtensionsPaginatorOptions struct {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
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
}
// ListExtensionsPaginator is a paginator for ListExtensions
type ListExtensionsPaginator struct {
options ListExtensionsPaginatorOptions
client ListExtensionsAPIClient
params *ListExtensionsInput
nextToken *string
firstPage bool
}
// NewListExtensionsPaginator returns a new ListExtensionsPaginator
func NewListExtensionsPaginator(client ListExtensionsAPIClient, params *ListExtensionsInput, optFns ...func(*ListExtensionsPaginatorOptions)) *ListExtensionsPaginator {
if params == nil {
params = &ListExtensionsInput{}
}
options := ListExtensionsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListExtensionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListExtensionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListExtensions page.
func (p *ListExtensionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListExtensionsOutput, 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.ListExtensions(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_opListExtensions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "ListExtensions",
}
}
| 224 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a paginated list of available versions for the extension. Each time an API
// change is made to an extension, the version is incremented. The list retrieved
// by this operation shows the versions that are currently available.
func (c *Client) ListExtensionVersions(ctx context.Context, params *ListExtensionVersionsInput, optFns ...func(*Options)) (*ListExtensionVersionsOutput, error) {
if params == nil {
params = &ListExtensionVersionsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListExtensionVersions", params, optFns, c.addOperationListExtensionVersionsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListExtensionVersionsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListExtensionVersionsInput struct {
// The name of the extension.
//
// This member is required.
Name *string
// The namespace (qualifier) of the extension.
//
// This member is required.
Namespace *string
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
MaxResults *int32
// The token that indicates the start of the next sequential page of results. Use
// the token that is returned with a previous call to this operation. To start at
// the beginning of the result set, do not specify a value.
NextToken *string
noSmithyDocumentSerde
}
type ListExtensionVersionsOutput struct {
// The list of extension versions.
ExtensionVersions []types.ExtensionVersionDetails
// The token that indicates the start of the next sequential page of results. Use
// this value when making the next call to this operation to continue where the
// last one finished.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListExtensionVersionsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListExtensionVersions{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListExtensionVersions{}, 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 = addOpListExtensionVersionsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListExtensionVersions(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
}
// ListExtensionVersionsAPIClient is a client that implements the
// ListExtensionVersions operation.
type ListExtensionVersionsAPIClient interface {
ListExtensionVersions(context.Context, *ListExtensionVersionsInput, ...func(*Options)) (*ListExtensionVersionsOutput, error)
}
var _ ListExtensionVersionsAPIClient = (*Client)(nil)
// ListExtensionVersionsPaginatorOptions is the paginator options for
// ListExtensionVersions
type ListExtensionVersionsPaginatorOptions struct {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
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
}
// ListExtensionVersionsPaginator is a paginator for ListExtensionVersions
type ListExtensionVersionsPaginator struct {
options ListExtensionVersionsPaginatorOptions
client ListExtensionVersionsAPIClient
params *ListExtensionVersionsInput
nextToken *string
firstPage bool
}
// NewListExtensionVersionsPaginator returns a new ListExtensionVersionsPaginator
func NewListExtensionVersionsPaginator(client ListExtensionVersionsAPIClient, params *ListExtensionVersionsInput, optFns ...func(*ListExtensionVersionsPaginatorOptions)) *ListExtensionVersionsPaginator {
if params == nil {
params = &ListExtensionVersionsInput{}
}
options := ListExtensionVersionsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListExtensionVersionsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListExtensionVersionsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListExtensionVersions page.
func (p *ListExtensionVersionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListExtensionVersionsOutput, 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.ListExtensionVersions(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_opListExtensionVersions(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "ListExtensionVersions",
}
}
| 239 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a paginated list of games.
func (c *Client) ListGames(ctx context.Context, params *ListGamesInput, optFns ...func(*Options)) (*ListGamesOutput, error) {
if params == nil {
params = &ListGamesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListGames", params, optFns, c.addOperationListGamesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListGamesOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListGamesInput struct {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
MaxResults *int32
// The token that indicates the start of the next sequential page of results. Use
// the token that is returned with a previous call to this operation. To start at
// the beginning of the result set, do not specify a value.
NextToken *string
noSmithyDocumentSerde
}
type ListGamesOutput struct {
// The list of games.
Games []types.GameSummary
// The token that indicates the start of the next sequential page of results. Use
// this value when making the next call to this operation to continue where the
// last one finished.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListGamesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListGames{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListGames{}, 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_opListGames(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
}
// ListGamesAPIClient is a client that implements the ListGames operation.
type ListGamesAPIClient interface {
ListGames(context.Context, *ListGamesInput, ...func(*Options)) (*ListGamesOutput, error)
}
var _ ListGamesAPIClient = (*Client)(nil)
// ListGamesPaginatorOptions is the paginator options for ListGames
type ListGamesPaginatorOptions struct {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
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
}
// ListGamesPaginator is a paginator for ListGames
type ListGamesPaginator struct {
options ListGamesPaginatorOptions
client ListGamesAPIClient
params *ListGamesInput
nextToken *string
firstPage bool
}
// NewListGamesPaginator returns a new ListGamesPaginator
func NewListGamesPaginator(client ListGamesAPIClient, params *ListGamesInput, optFns ...func(*ListGamesPaginatorOptions)) *ListGamesPaginator {
if params == nil {
params = &ListGamesInput{}
}
options := ListGamesPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListGamesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListGamesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListGames page.
func (p *ListGamesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListGamesOutput, 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.ListGames(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_opListGames(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "ListGames",
}
}
| 222 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a paginated list of code generation jobs for a snapshot.
func (c *Client) ListGeneratedCodeJobs(ctx context.Context, params *ListGeneratedCodeJobsInput, optFns ...func(*Options)) (*ListGeneratedCodeJobsOutput, error) {
if params == nil {
params = &ListGeneratedCodeJobsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListGeneratedCodeJobs", params, optFns, c.addOperationListGeneratedCodeJobsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListGeneratedCodeJobsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListGeneratedCodeJobsInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The identifier of the snapshot.
//
// This member is required.
SnapshotId *string
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
MaxResults *int32
// The token that indicates the start of the next sequential page of results. Use
// the token that is returned with a previous call to this operation. To start at
// the beginning of the result set, do not specify a value.
NextToken *string
noSmithyDocumentSerde
}
type ListGeneratedCodeJobsOutput struct {
// The list of generated code jobs.
GeneratedCodeJobs []types.GeneratedCodeJobDetails
// The token that indicates the start of the next sequential page of results. Use
// this value when making the next call to this operation to continue where the
// last one finished.
NextToken *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListGeneratedCodeJobsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListGeneratedCodeJobs{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListGeneratedCodeJobs{}, 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 = addOpListGeneratedCodeJobsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListGeneratedCodeJobs(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
}
// ListGeneratedCodeJobsAPIClient is a client that implements the
// ListGeneratedCodeJobs operation.
type ListGeneratedCodeJobsAPIClient interface {
ListGeneratedCodeJobs(context.Context, *ListGeneratedCodeJobsInput, ...func(*Options)) (*ListGeneratedCodeJobsOutput, error)
}
var _ ListGeneratedCodeJobsAPIClient = (*Client)(nil)
// ListGeneratedCodeJobsPaginatorOptions is the paginator options for
// ListGeneratedCodeJobs
type ListGeneratedCodeJobsPaginatorOptions struct {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
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
}
// ListGeneratedCodeJobsPaginator is a paginator for ListGeneratedCodeJobs
type ListGeneratedCodeJobsPaginator struct {
options ListGeneratedCodeJobsPaginatorOptions
client ListGeneratedCodeJobsAPIClient
params *ListGeneratedCodeJobsInput
nextToken *string
firstPage bool
}
// NewListGeneratedCodeJobsPaginator returns a new ListGeneratedCodeJobsPaginator
func NewListGeneratedCodeJobsPaginator(client ListGeneratedCodeJobsAPIClient, params *ListGeneratedCodeJobsInput, optFns ...func(*ListGeneratedCodeJobsPaginatorOptions)) *ListGeneratedCodeJobsPaginator {
if params == nil {
params = &ListGeneratedCodeJobsInput{}
}
options := ListGeneratedCodeJobsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListGeneratedCodeJobsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListGeneratedCodeJobsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListGeneratedCodeJobs page.
func (p *ListGeneratedCodeJobsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListGeneratedCodeJobsOutput, 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.ListGeneratedCodeJobs(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_opListGeneratedCodeJobs(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "ListGeneratedCodeJobs",
}
}
| 237 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a paginated list of snapshot summaries from the game.
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 name of the game.
//
// This member is required.
GameName *string
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
MaxResults *int32
// The token that indicates the start of the next sequential page of results. Use
// the token that is returned with a previous call to this operation. To start at
// the beginning of the result set, do not specify a value.
NextToken *string
noSmithyDocumentSerde
}
type ListSnapshotsOutput struct {
// The token that indicates the start of the next sequential page of results. Use
// this value when making the next call to this operation to continue where the
// last one finished.
NextToken *string
// A list of snapshot summaries. You can use the returned snapshot IDs in the
// UpdateSnapshot and GetSnapshot operations.
Snapshots []types.SnapshotSummary
// 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(&awsRestjson1_serializeOpListSnapshots{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_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 = addOpListSnapshotsValidationMiddleware(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 {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
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: "gamesparks",
OperationName: "ListSnapshots",
}
}
| 231 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a paginated list of stage deployment summaries from the game.
func (c *Client) ListStageDeployments(ctx context.Context, params *ListStageDeploymentsInput, optFns ...func(*Options)) (*ListStageDeploymentsOutput, error) {
if params == nil {
params = &ListStageDeploymentsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListStageDeployments", params, optFns, c.addOperationListStageDeploymentsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListStageDeploymentsOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListStageDeploymentsInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The name of the stage.
//
// This member is required.
StageName *string
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
MaxResults *int32
// The token that indicates the start of the next sequential page of results. Use
// the token that is returned with a previous call to this operation. To start at
// the beginning of the result set, do not specify a value.
NextToken *string
noSmithyDocumentSerde
}
type ListStageDeploymentsOutput struct {
// The token that indicates the start of the next sequential page of results. Use
// this value when making the next call to this operation to continue where the
// last one finished.
NextToken *string
// A list of stage deployment summaries. You can use the deployment IDs in the
// UpdateStageDeployment and GetStageDeployment actions.
StageDeployments []types.StageDeploymentSummary
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListStageDeploymentsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListStageDeployments{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListStageDeployments{}, 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 = addOpListStageDeploymentsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListStageDeployments(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
}
// ListStageDeploymentsAPIClient is a client that implements the
// ListStageDeployments operation.
type ListStageDeploymentsAPIClient interface {
ListStageDeployments(context.Context, *ListStageDeploymentsInput, ...func(*Options)) (*ListStageDeploymentsOutput, error)
}
var _ ListStageDeploymentsAPIClient = (*Client)(nil)
// ListStageDeploymentsPaginatorOptions is the paginator options for
// ListStageDeployments
type ListStageDeploymentsPaginatorOptions struct {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
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
}
// ListStageDeploymentsPaginator is a paginator for ListStageDeployments
type ListStageDeploymentsPaginator struct {
options ListStageDeploymentsPaginatorOptions
client ListStageDeploymentsAPIClient
params *ListStageDeploymentsInput
nextToken *string
firstPage bool
}
// NewListStageDeploymentsPaginator returns a new ListStageDeploymentsPaginator
func NewListStageDeploymentsPaginator(client ListStageDeploymentsAPIClient, params *ListStageDeploymentsInput, optFns ...func(*ListStageDeploymentsPaginatorOptions)) *ListStageDeploymentsPaginator {
if params == nil {
params = &ListStageDeploymentsInput{}
}
options := ListStageDeploymentsPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListStageDeploymentsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListStageDeploymentsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListStageDeployments page.
func (p *ListStageDeploymentsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListStageDeploymentsOutput, 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.ListStageDeployments(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_opListStageDeployments(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "ListStageDeployments",
}
}
| 238 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Gets a paginated list of stage summaries from the game.
func (c *Client) ListStages(ctx context.Context, params *ListStagesInput, optFns ...func(*Options)) (*ListStagesOutput, error) {
if params == nil {
params = &ListStagesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListStages", params, optFns, c.addOperationListStagesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListStagesOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListStagesInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
MaxResults *int32
// The token that indicates the start of the next sequential page of results. Use
// the token that is returned with a previous call to this operation. To start at
// the beginning of the result set, do not specify a value.
NextToken *string
noSmithyDocumentSerde
}
type ListStagesOutput struct {
// The token that indicates the start of the next sequential page of results. Use
// this value when making the next call to this operation to continue where the
// last one finished.
NextToken *string
// A list of stage summaries. You can use the stage names in the UpdateStage and
// GetStage actions.
Stages []types.StageSummary
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListStagesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListStages{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListStages{}, 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 = addOpListStagesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListStages(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
}
// ListStagesAPIClient is a client that implements the ListStages operation.
type ListStagesAPIClient interface {
ListStages(context.Context, *ListStagesInput, ...func(*Options)) (*ListStagesOutput, error)
}
var _ ListStagesAPIClient = (*Client)(nil)
// ListStagesPaginatorOptions is the paginator options for ListStages
type ListStagesPaginatorOptions struct {
// The maximum number of results to return. Use this parameter with NextToken to
// get results as a set of sequential pages.
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
}
// ListStagesPaginator is a paginator for ListStages
type ListStagesPaginator struct {
options ListStagesPaginatorOptions
client ListStagesAPIClient
params *ListStagesInput
nextToken *string
firstPage bool
}
// NewListStagesPaginator returns a new ListStagesPaginator
func NewListStagesPaginator(client ListStagesAPIClient, params *ListStagesInput, optFns ...func(*ListStagesPaginatorOptions)) *ListStagesPaginator {
if params == nil {
params = &ListStagesInput{}
}
options := ListStagesPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListStagesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListStagesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListStages page.
func (p *ListStagesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListStagesOutput, 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.ListStages(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_opListStages(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "ListStages",
}
}
| 231 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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"
)
// Lists the tags associated with a GameSparks 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 GameSparks resource.
//
// This member is required.
ResourceArn *string
noSmithyDocumentSerde
}
type ListTagsForResourceOutput struct {
// The tags associated with 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(&awsRestjson1_serializeOpListTagsForResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_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: "gamesparks",
OperationName: "ListTagsForResource",
}
}
| 124 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Starts an asynchronous process that generates client code for system-defined
// and custom messages. The resulting code is collected as a .zip file and uploaded
// to a pre-signed Amazon S3 URL.
func (c *Client) StartGeneratedCodeJob(ctx context.Context, params *StartGeneratedCodeJobInput, optFns ...func(*Options)) (*StartGeneratedCodeJobOutput, error) {
if params == nil {
params = &StartGeneratedCodeJobInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartGeneratedCodeJob", params, optFns, c.addOperationStartGeneratedCodeJobMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartGeneratedCodeJobOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartGeneratedCodeJobInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// Properties of the generator to use for the job.
//
// This member is required.
Generator *types.Generator
// The identifier of the snapshot for which to generate code.
//
// This member is required.
SnapshotId *string
noSmithyDocumentSerde
}
type StartGeneratedCodeJobOutput struct {
// The identifier of the code generation job. You can use this identifier in the
// GetGeneratedCodeJob operation.
GeneratedCodeJobId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartGeneratedCodeJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpStartGeneratedCodeJob{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartGeneratedCodeJob{}, 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 = addOpStartGeneratedCodeJobValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartGeneratedCodeJob(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_opStartGeneratedCodeJob(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "StartGeneratedCodeJob",
}
}
| 138 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deploys a snapshot to the stage and creates a new game runtime. After you call
// this operation, you can check the deployment status by using GetStageDeployment
// . If there are any players connected to the previous game runtime, then both
// runtimes persist. Existing connections to the previous runtime are maintained.
// When players disconnect and reconnect, they connect to the new runtime. After
// there are no connections to the previous game runtime, it is deleted.
func (c *Client) StartStageDeployment(ctx context.Context, params *StartStageDeploymentInput, optFns ...func(*Options)) (*StartStageDeploymentOutput, error) {
if params == nil {
params = &StartStageDeploymentInput{}
}
result, metadata, err := c.invokeOperation(ctx, "StartStageDeployment", params, optFns, c.addOperationStartStageDeploymentMiddlewares)
if err != nil {
return nil, err
}
out := result.(*StartStageDeploymentOutput)
out.ResultMetadata = metadata
return out, nil
}
type StartStageDeploymentInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The identifier of the snapshot to deploy.
//
// This member is required.
SnapshotId *string
// The name of the stage to deploy the snapshot onto.
//
// This member is required.
StageName *string
// A client-defined token. With an active client token in the request, this action
// is idempotent.
ClientToken *string
noSmithyDocumentSerde
}
type StartStageDeploymentOutput struct {
// Properties that describe the stage deployment.
StageDeployment *types.StageDeploymentDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationStartStageDeploymentMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpStartStageDeployment{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartStageDeployment{}, 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 = addOpStartStageDeploymentValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartStageDeployment(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_opStartStageDeployment(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "StartStageDeployment",
}
}
| 144 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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"
)
// Adds tags to a GameSparks 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 add the tags to.
//
// This member is required.
ResourceArn *string
// The tags to add to the resource.
//
// This member is required.
Tags map[string]string
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(&awsRestjson1_serializeOpTagResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_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: "gamesparks",
OperationName: "TagResource",
}
}
| 125 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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 tags from a GameSparks 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 the tags from.
//
// This member is required.
ResourceArn *string
// The keys of the tags to remove.
//
// 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(&awsRestjson1_serializeOpUntagResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_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: "gamesparks",
OperationName: "UntagResource",
}
}
| 125 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates details of the game.
func (c *Client) UpdateGame(ctx context.Context, params *UpdateGameInput, optFns ...func(*Options)) (*UpdateGameOutput, error) {
if params == nil {
params = &UpdateGameInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateGame", params, optFns, c.addOperationUpdateGameMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateGameOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateGameInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The description of the game.
Description *string
noSmithyDocumentSerde
}
type UpdateGameOutput struct {
// The details of the game.
Game *types.GameDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateGameMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateGame{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateGame{}, 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 = addOpUpdateGameValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateGame(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_opUpdateGame(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "UpdateGame",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates one or more sections of the game configuration.
func (c *Client) UpdateGameConfiguration(ctx context.Context, params *UpdateGameConfigurationInput, optFns ...func(*Options)) (*UpdateGameConfigurationOutput, error) {
if params == nil {
params = &UpdateGameConfigurationInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateGameConfiguration", params, optFns, c.addOperationUpdateGameConfigurationMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateGameConfigurationOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateGameConfigurationInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The list of modifications to make.
//
// This member is required.
Modifications []types.SectionModification
noSmithyDocumentSerde
}
type UpdateGameConfigurationOutput struct {
// Details about the game configuration.
GameConfiguration *types.GameConfigurationDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateGameConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateGameConfiguration{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateGameConfiguration{}, 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 = addOpUpdateGameConfigurationValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateGameConfiguration(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_opUpdateGameConfiguration(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "UpdateGameConfiguration",
}
}
| 130 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates the metadata of a GameSparks 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 game.
//
// This member is required.
GameName *string
// The identifier of the snapshot.
//
// This member is required.
SnapshotId *string
// The description of the snapshot.
Description *string
noSmithyDocumentSerde
}
type UpdateSnapshotOutput struct {
// Properties that provide details of the updated snapshot.
Snapshot *types.SnapshotDetails
// 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(&awsRestjson1_serializeOpUpdateSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_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: "gamesparks",
OperationName: "UpdateSnapshot",
}
}
| 133 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Updates the metadata of a stage.
func (c *Client) UpdateStage(ctx context.Context, params *UpdateStageInput, optFns ...func(*Options)) (*UpdateStageOutput, error) {
if params == nil {
params = &UpdateStageInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateStage", params, optFns, c.addOperationUpdateStageMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateStageOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateStageInput struct {
// The name of the game.
//
// This member is required.
GameName *string
// The name of the stage.
//
// This member is required.
StageName *string
// The description of the stage.
Description *string
// The Amazon Resource Name (ARN) of the role to use for the game snapshots
// deployed to this stage.
Role *string
noSmithyDocumentSerde
}
type UpdateStageOutput struct {
// Properties that provide details of the updated stage.
Stage *types.StageDetails
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateStageMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateStage{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateStage{}, 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 = addOpUpdateStageValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateStage(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_opUpdateStage(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "gamesparks",
OperationName: "UpdateStage",
}
}
| 137 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/gamesparks/document"
internaldocument "github.com/aws/aws-sdk-go-v2/service/gamesparks/internal/document"
"github.com/aws/aws-sdk-go-v2/service/gamesparks/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"
"strings"
)
type awsRestjson1_deserializeOpCreateGame struct {
}
func (*awsRestjson1_deserializeOpCreateGame) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateGame) 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, awsRestjson1_deserializeOpErrorCreateGame(response, &metadata)
}
output := &CreateGameOutput{}
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 = awsRestjson1_deserializeOpDocumentCreateGameOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCreateGame(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateGameOutput(v **CreateGameOutput, 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 *CreateGameOutput
if *v == nil {
sv = &CreateGameOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Game":
if err := awsRestjson1_deserializeDocumentGameDetails(&sv.Game, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreateSnapshot struct {
}
func (*awsRestjson1_deserializeOpCreateSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_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, awsRestjson1_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 = awsRestjson1_deserializeOpDocumentCreateSnapshotOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_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("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_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 := awsRestjson1_deserializeDocumentSnapshotDetails(&sv.Snapshot, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreateStage struct {
}
func (*awsRestjson1_deserializeOpCreateStage) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateStage) 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, awsRestjson1_deserializeOpErrorCreateStage(response, &metadata)
}
output := &CreateStageOutput{}
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 = awsRestjson1_deserializeOpDocumentCreateStageOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCreateStage(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateStageOutput(v **CreateStageOutput, 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 *CreateStageOutput
if *v == nil {
sv = &CreateStageOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Stage":
if err := awsRestjson1_deserializeDocumentStageDetails(&sv.Stage, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDeleteGame struct {
}
func (*awsRestjson1_deserializeOpDeleteGame) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteGame) 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, awsRestjson1_deserializeOpErrorDeleteGame(response, &metadata)
}
output := &DeleteGameOutput{}
out.Result = output
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteGame(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDeleteStage struct {
}
func (*awsRestjson1_deserializeOpDeleteStage) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteStage) 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, awsRestjson1_deserializeOpErrorDeleteStage(response, &metadata)
}
output := &DeleteStageOutput{}
out.Result = output
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteStage(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDisconnectPlayer struct {
}
func (*awsRestjson1_deserializeOpDisconnectPlayer) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisconnectPlayer) 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, awsRestjson1_deserializeOpErrorDisconnectPlayer(response, &metadata)
}
output := &DisconnectPlayerOutput{}
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 = awsRestjson1_deserializeOpDocumentDisconnectPlayerOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDisconnectPlayer(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDisconnectPlayerOutput(v **DisconnectPlayerOutput, 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 *DisconnectPlayerOutput
if *v == nil {
sv = &DisconnectPlayerOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "DisconnectFailures":
if err := awsRestjson1_deserializeDocumentConnectionIdList(&sv.DisconnectFailures, value); err != nil {
return err
}
case "DisconnectSuccesses":
if err := awsRestjson1_deserializeDocumentConnectionIdList(&sv.DisconnectSuccesses, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpExportSnapshot struct {
}
func (*awsRestjson1_deserializeOpExportSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpExportSnapshot) 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, awsRestjson1_deserializeOpErrorExportSnapshot(response, &metadata)
}
output := &ExportSnapshotOutput{}
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 = awsRestjson1_deserializeOpDocumentExportSnapshotOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorExportSnapshot(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentExportSnapshotOutput(v **ExportSnapshotOutput, 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 *ExportSnapshotOutput
if *v == nil {
sv = &ExportSnapshotOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "S3Url":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected S3PresignedUrl to be of type string, got %T instead", value)
}
sv.S3Url = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetExtension struct {
}
func (*awsRestjson1_deserializeOpGetExtension) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetExtension) 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, awsRestjson1_deserializeOpErrorGetExtension(response, &metadata)
}
output := &GetExtensionOutput{}
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 = awsRestjson1_deserializeOpDocumentGetExtensionOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetExtension(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetExtensionOutput(v **GetExtensionOutput, 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 *GetExtensionOutput
if *v == nil {
sv = &GetExtensionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Extension":
if err := awsRestjson1_deserializeDocumentExtensionDetails(&sv.Extension, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetExtensionVersion struct {
}
func (*awsRestjson1_deserializeOpGetExtensionVersion) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetExtensionVersion) 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, awsRestjson1_deserializeOpErrorGetExtensionVersion(response, &metadata)
}
output := &GetExtensionVersionOutput{}
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 = awsRestjson1_deserializeOpDocumentGetExtensionVersionOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetExtensionVersion(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetExtensionVersionOutput(v **GetExtensionVersionOutput, 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 *GetExtensionVersionOutput
if *v == nil {
sv = &GetExtensionVersionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ExtensionVersion":
if err := awsRestjson1_deserializeDocumentExtensionVersionDetails(&sv.ExtensionVersion, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetGame struct {
}
func (*awsRestjson1_deserializeOpGetGame) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetGame) 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, awsRestjson1_deserializeOpErrorGetGame(response, &metadata)
}
output := &GetGameOutput{}
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 = awsRestjson1_deserializeOpDocumentGetGameOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetGame(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetGameOutput(v **GetGameOutput, 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 *GetGameOutput
if *v == nil {
sv = &GetGameOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Game":
if err := awsRestjson1_deserializeDocumentGameDetails(&sv.Game, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetGameConfiguration struct {
}
func (*awsRestjson1_deserializeOpGetGameConfiguration) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetGameConfiguration) 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, awsRestjson1_deserializeOpErrorGetGameConfiguration(response, &metadata)
}
output := &GetGameConfigurationOutput{}
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 = awsRestjson1_deserializeOpDocumentGetGameConfigurationOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetGameConfiguration(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetGameConfigurationOutput(v **GetGameConfigurationOutput, 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 *GetGameConfigurationOutput
if *v == nil {
sv = &GetGameConfigurationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "GameConfiguration":
if err := awsRestjson1_deserializeDocumentGameConfigurationDetails(&sv.GameConfiguration, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetGeneratedCodeJob struct {
}
func (*awsRestjson1_deserializeOpGetGeneratedCodeJob) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetGeneratedCodeJob) 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, awsRestjson1_deserializeOpErrorGetGeneratedCodeJob(response, &metadata)
}
output := &GetGeneratedCodeJobOutput{}
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 = awsRestjson1_deserializeOpDocumentGetGeneratedCodeJobOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetGeneratedCodeJob(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetGeneratedCodeJobOutput(v **GetGeneratedCodeJobOutput, 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 *GetGeneratedCodeJobOutput
if *v == nil {
sv = &GetGeneratedCodeJobOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "GeneratedCodeJob":
if err := awsRestjson1_deserializeDocumentGeneratedCodeJobDetails(&sv.GeneratedCodeJob, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetPlayerConnectionStatus struct {
}
func (*awsRestjson1_deserializeOpGetPlayerConnectionStatus) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetPlayerConnectionStatus) 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, awsRestjson1_deserializeOpErrorGetPlayerConnectionStatus(response, &metadata)
}
output := &GetPlayerConnectionStatusOutput{}
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 = awsRestjson1_deserializeOpDocumentGetPlayerConnectionStatusOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetPlayerConnectionStatus(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetPlayerConnectionStatusOutput(v **GetPlayerConnectionStatusOutput, 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 *GetPlayerConnectionStatusOutput
if *v == nil {
sv = &GetPlayerConnectionStatusOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Connections":
if err := awsRestjson1_deserializeDocumentConnectionList(&sv.Connections, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetSnapshot struct {
}
func (*awsRestjson1_deserializeOpGetSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_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, awsRestjson1_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 = awsRestjson1_deserializeOpDocumentGetSnapshotOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_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("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_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 := awsRestjson1_deserializeDocumentSnapshotDetails(&sv.Snapshot, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetStage struct {
}
func (*awsRestjson1_deserializeOpGetStage) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetStage) 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, awsRestjson1_deserializeOpErrorGetStage(response, &metadata)
}
output := &GetStageOutput{}
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 = awsRestjson1_deserializeOpDocumentGetStageOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetStage(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetStageOutput(v **GetStageOutput, 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 *GetStageOutput
if *v == nil {
sv = &GetStageOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Stage":
if err := awsRestjson1_deserializeDocumentStageDetails(&sv.Stage, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetStageDeployment struct {
}
func (*awsRestjson1_deserializeOpGetStageDeployment) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetStageDeployment) 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, awsRestjson1_deserializeOpErrorGetStageDeployment(response, &metadata)
}
output := &GetStageDeploymentOutput{}
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 = awsRestjson1_deserializeOpDocumentGetStageDeploymentOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetStageDeployment(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetStageDeploymentOutput(v **GetStageDeploymentOutput, 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 *GetStageDeploymentOutput
if *v == nil {
sv = &GetStageDeploymentOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "StageDeployment":
if err := awsRestjson1_deserializeDocumentStageDeploymentDetails(&sv.StageDeployment, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpImportGameConfiguration struct {
}
func (*awsRestjson1_deserializeOpImportGameConfiguration) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpImportGameConfiguration) 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, awsRestjson1_deserializeOpErrorImportGameConfiguration(response, &metadata)
}
output := &ImportGameConfigurationOutput{}
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 = awsRestjson1_deserializeOpDocumentImportGameConfigurationOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorImportGameConfiguration(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentImportGameConfigurationOutput(v **ImportGameConfigurationOutput, 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 *ImportGameConfigurationOutput
if *v == nil {
sv = &ImportGameConfigurationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "GameConfiguration":
if err := awsRestjson1_deserializeDocumentGameConfigurationDetails(&sv.GameConfiguration, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListExtensions struct {
}
func (*awsRestjson1_deserializeOpListExtensions) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListExtensions) 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, awsRestjson1_deserializeOpErrorListExtensions(response, &metadata)
}
output := &ListExtensionsOutput{}
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 = awsRestjson1_deserializeOpDocumentListExtensionsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListExtensions(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListExtensionsOutput(v **ListExtensionsOutput, 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 *ListExtensionsOutput
if *v == nil {
sv = &ListExtensionsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Extensions":
if err := awsRestjson1_deserializeDocumentExtensionDetailsList(&sv.Extensions, value); err != nil {
return err
}
case "NextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListExtensionVersions struct {
}
func (*awsRestjson1_deserializeOpListExtensionVersions) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListExtensionVersions) 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, awsRestjson1_deserializeOpErrorListExtensionVersions(response, &metadata)
}
output := &ListExtensionVersionsOutput{}
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 = awsRestjson1_deserializeOpDocumentListExtensionVersionsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListExtensionVersions(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListExtensionVersionsOutput(v **ListExtensionVersionsOutput, 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 *ListExtensionVersionsOutput
if *v == nil {
sv = &ListExtensionVersionsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ExtensionVersions":
if err := awsRestjson1_deserializeDocumentExtensionVersionDetailsList(&sv.ExtensionVersions, value); err != nil {
return err
}
case "NextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListGames struct {
}
func (*awsRestjson1_deserializeOpListGames) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListGames) 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, awsRestjson1_deserializeOpErrorListGames(response, &metadata)
}
output := &ListGamesOutput{}
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 = awsRestjson1_deserializeOpDocumentListGamesOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListGames(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListGamesOutput(v **ListGamesOutput, 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 *ListGamesOutput
if *v == nil {
sv = &ListGamesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Games":
if err := awsRestjson1_deserializeDocumentGameSummaryList(&sv.Games, value); err != nil {
return err
}
case "NextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListGeneratedCodeJobs struct {
}
func (*awsRestjson1_deserializeOpListGeneratedCodeJobs) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListGeneratedCodeJobs) 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, awsRestjson1_deserializeOpErrorListGeneratedCodeJobs(response, &metadata)
}
output := &ListGeneratedCodeJobsOutput{}
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 = awsRestjson1_deserializeOpDocumentListGeneratedCodeJobsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListGeneratedCodeJobs(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListGeneratedCodeJobsOutput(v **ListGeneratedCodeJobsOutput, 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 *ListGeneratedCodeJobsOutput
if *v == nil {
sv = &ListGeneratedCodeJobsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "GeneratedCodeJobs":
if err := awsRestjson1_deserializeDocumentGeneratedCodeJobDetailsList(&sv.GeneratedCodeJobs, value); err != nil {
return err
}
case "NextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListSnapshots struct {
}
func (*awsRestjson1_deserializeOpListSnapshots) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_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, awsRestjson1_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 = awsRestjson1_deserializeOpDocumentListSnapshotsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_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("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_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 NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "Snapshots":
if err := awsRestjson1_deserializeDocumentSnapshotSummaryList(&sv.Snapshots, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListStageDeployments struct {
}
func (*awsRestjson1_deserializeOpListStageDeployments) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListStageDeployments) 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, awsRestjson1_deserializeOpErrorListStageDeployments(response, &metadata)
}
output := &ListStageDeploymentsOutput{}
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 = awsRestjson1_deserializeOpDocumentListStageDeploymentsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListStageDeployments(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListStageDeploymentsOutput(v **ListStageDeploymentsOutput, 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 *ListStageDeploymentsOutput
if *v == nil {
sv = &ListStageDeploymentsOutput{}
} 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 NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "StageDeployments":
if err := awsRestjson1_deserializeDocumentStageDeploymentList(&sv.StageDeployments, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListStages struct {
}
func (*awsRestjson1_deserializeOpListStages) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListStages) 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, awsRestjson1_deserializeOpErrorListStages(response, &metadata)
}
output := &ListStagesOutput{}
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 = awsRestjson1_deserializeOpDocumentListStagesOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListStages(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListStagesOutput(v **ListStagesOutput, 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 *ListStagesOutput
if *v == nil {
sv = &ListStagesOutput{}
} 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 NextToken to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "Stages":
if err := awsRestjson1_deserializeDocumentStageSummaryList(&sv.Stages, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListTagsForResource struct {
}
func (*awsRestjson1_deserializeOpListTagsForResource) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_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, awsRestjson1_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 = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_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 awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_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 := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpStartGeneratedCodeJob struct {
}
func (*awsRestjson1_deserializeOpStartGeneratedCodeJob) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpStartGeneratedCodeJob) 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, awsRestjson1_deserializeOpErrorStartGeneratedCodeJob(response, &metadata)
}
output := &StartGeneratedCodeJobOutput{}
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 = awsRestjson1_deserializeOpDocumentStartGeneratedCodeJobOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorStartGeneratedCodeJob(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentStartGeneratedCodeJobOutput(v **StartGeneratedCodeJobOutput, 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 *StartGeneratedCodeJobOutput
if *v == nil {
sv = &StartGeneratedCodeJobOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "GeneratedCodeJobId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GeneratedCodeJobId to be of type string, got %T instead", value)
}
sv.GeneratedCodeJobId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpStartStageDeployment struct {
}
func (*awsRestjson1_deserializeOpStartStageDeployment) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpStartStageDeployment) 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, awsRestjson1_deserializeOpErrorStartStageDeployment(response, &metadata)
}
output := &StartStageDeploymentOutput{}
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 = awsRestjson1_deserializeOpDocumentStartStageDeploymentOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorStartStageDeployment(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("ConflictException", errorCode):
return awsRestjson1_deserializeErrorConflictException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentStartStageDeploymentOutput(v **StartStageDeploymentOutput, 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 *StartStageDeploymentOutput
if *v == nil {
sv = &StartStageDeploymentOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "StageDeployment":
if err := awsRestjson1_deserializeDocumentStageDeploymentDetails(&sv.StageDeployment, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpTagResource struct {
}
func (*awsRestjson1_deserializeOpTagResource) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_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, awsRestjson1_deserializeOpErrorTagResource(response, &metadata)
}
output := &TagResourceOutput{}
out.Result = output
return out, metadata, err
}
func awsRestjson1_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 awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpUntagResource struct {
}
func (*awsRestjson1_deserializeOpUntagResource) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_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, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata)
}
output := &UntagResourceOutput{}
out.Result = output
return out, metadata, err
}
func awsRestjson1_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 awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpUpdateGame struct {
}
func (*awsRestjson1_deserializeOpUpdateGame) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateGame) 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, awsRestjson1_deserializeOpErrorUpdateGame(response, &metadata)
}
output := &UpdateGameOutput{}
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 = awsRestjson1_deserializeOpDocumentUpdateGameOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorUpdateGame(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateGameOutput(v **UpdateGameOutput, 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 *UpdateGameOutput
if *v == nil {
sv = &UpdateGameOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Game":
if err := awsRestjson1_deserializeDocumentGameDetails(&sv.Game, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateGameConfiguration struct {
}
func (*awsRestjson1_deserializeOpUpdateGameConfiguration) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateGameConfiguration) 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, awsRestjson1_deserializeOpErrorUpdateGameConfiguration(response, &metadata)
}
output := &UpdateGameConfigurationOutput{}
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 = awsRestjson1_deserializeOpDocumentUpdateGameConfigurationOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorUpdateGameConfiguration(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateGameConfigurationOutput(v **UpdateGameConfigurationOutput, 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 *UpdateGameConfigurationOutput
if *v == nil {
sv = &UpdateGameConfigurationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "GameConfiguration":
if err := awsRestjson1_deserializeDocumentGameConfigurationDetails(&sv.GameConfiguration, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateSnapshot struct {
}
func (*awsRestjson1_deserializeOpUpdateSnapshot) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_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, awsRestjson1_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 = awsRestjson1_deserializeOpDocumentUpdateSnapshotOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_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("AccessDeniedException", errorCode):
return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_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 := awsRestjson1_deserializeDocumentSnapshotDetails(&sv.Snapshot, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpUpdateStage struct {
}
func (*awsRestjson1_deserializeOpUpdateStage) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateStage) 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, awsRestjson1_deserializeOpErrorUpdateStage(response, &metadata)
}
output := &UpdateStageOutput{}
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 = awsRestjson1_deserializeOpDocumentUpdateStageOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorUpdateStage(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 awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
case strings.EqualFold("InternalServerException", errorCode):
return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateStageOutput(v **UpdateStageOutput, 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 *UpdateStageOutput
if *v == nil {
sv = &UpdateStageOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Stage":
if err := awsRestjson1_deserializeDocumentStageDetails(&sv.Stage, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.AccessDeniedException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_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 awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ConflictException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_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 awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InternalServerException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_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 awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceNotFoundException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_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 awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ServiceQuotaExceededException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_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 awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ThrottlingException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ValidationException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_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 awsRestjson1_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 "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_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 ExceptionMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentConnection(v **types.Connection, 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.Connection
if *v == nil {
sv = &types.Connection{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Created":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Created = ptr.Time(t)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ConnectionId to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentConnectionIdList(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 ConnectionId to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentConnectionList(v *[]types.Connection, 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.Connection
if *v == nil {
cv = []types.Connection{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Connection
destAddr := &col
if err := awsRestjson1_deserializeDocumentConnection(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentDeploymentResult(v **types.DeploymentResult, 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.DeploymentResult
if *v == nil {
sv = &types.DeploymentResult{}
} 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 Message to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "ResultCode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResultCode to be of type string, got %T instead", value)
}
sv.ResultCode = types.ResultCode(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDocument(v *document.Interface, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
*v = internaldocument.NewDocumentUnmarshaler(value)
return nil
}
func awsRestjson1_deserializeDocumentExtensionDetails(v **types.ExtensionDetails, 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.ExtensionDetails
if *v == nil {
sv = &types.ExtensionDetails{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExtensionDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExtensionName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "Namespace":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExtensionNamespace to be of type string, got %T instead", value)
}
sv.Namespace = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentExtensionDetailsList(v *[]types.ExtensionDetails, 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.ExtensionDetails
if *v == nil {
cv = []types.ExtensionDetails{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ExtensionDetails
destAddr := &col
if err := awsRestjson1_deserializeDocumentExtensionDetails(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentExtensionVersionDetails(v **types.ExtensionVersionDetails, 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.ExtensionVersionDetails
if *v == nil {
sv = &types.ExtensionVersionDetails{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExtensionName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "Namespace":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExtensionNamespace to be of type string, got %T instead", value)
}
sv.Namespace = ptr.String(jtv)
}
case "Schema":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExtensionVersionSchema to be of type string, got %T instead", value)
}
sv.Schema = ptr.String(jtv)
}
case "Version":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExtensionVersion to be of type string, got %T instead", value)
}
sv.Version = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentExtensionVersionDetailsList(v *[]types.ExtensionVersionDetails, 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.ExtensionVersionDetails
if *v == nil {
cv = []types.ExtensionVersionDetails{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ExtensionVersionDetails
destAddr := &col
if err := awsRestjson1_deserializeDocumentExtensionVersionDetails(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentGameConfigurationDetails(v **types.GameConfigurationDetails, 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.GameConfigurationDetails
if *v == nil {
sv = &types.GameConfigurationDetails{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Created":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Created = ptr.Time(t)
}
case "LastUpdated":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastUpdated = ptr.Time(t)
}
case "Sections":
if err := awsRestjson1_deserializeDocumentSections(&sv.Sections, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentGameDetails(v **types.GameDetails, 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.GameDetails
if *v == nil {
sv = &types.GameDetails{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ARN to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "Created":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Created = ptr.Time(t)
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GameDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "EnableTerminationProtection":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected GameTerminationProtection to be of type *bool, got %T instead", value)
}
sv.EnableTerminationProtection = jtv
}
case "LastUpdated":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastUpdated = ptr.Time(t)
}
case "Name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GameName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "State":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GameState to be of type string, got %T instead", value)
}
sv.State = types.GameState(jtv)
}
case "Tags":
if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentGameSummary(v **types.GameSummary, 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.GameSummary
if *v == nil {
sv = &types.GameSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GameDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GameName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "State":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GameState to be of type string, got %T instead", value)
}
sv.State = types.GameState(jtv)
}
case "Tags":
if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentGameSummaryList(v *[]types.GameSummary, 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.GameSummary
if *v == nil {
cv = []types.GameSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.GameSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentGameSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentGeneratedCodeJobDetails(v **types.GeneratedCodeJobDetails, 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.GeneratedCodeJobDetails
if *v == nil {
sv = &types.GeneratedCodeJobDetails{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GeneratedCodeJobDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "ExpirationTime":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.ExpirationTime = ptr.Time(t)
}
case "GeneratedCodeJobId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GeneratedCodeJobId to be of type string, got %T instead", value)
}
sv.GeneratedCodeJobId = ptr.String(jtv)
}
case "S3Url":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected S3PresignedUrl to be of type string, got %T instead", value)
}
sv.S3Url = ptr.String(jtv)
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GeneratedCodeJobState to be of type string, got %T instead", value)
}
sv.Status = types.GeneratedCodeJobState(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentGeneratedCodeJobDetailsList(v *[]types.GeneratedCodeJobDetails, 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.GeneratedCodeJobDetails
if *v == nil {
cv = []types.GeneratedCodeJobDetails{}
} else {
cv = *v
}
for _, value := range shape {
var col types.GeneratedCodeJobDetails
destAddr := &col
if err := awsRestjson1_deserializeDocumentGeneratedCodeJobDetails(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_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 ExceptionMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_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 ExceptionMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSection(v **types.Section, 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.Section
if *v == nil {
sv = &types.Section{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Attributes":
if err := awsRestjson1_deserializeDocumentDocument(&sv.Attributes, value); err != nil {
return err
}
case "Name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SectionName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "Size":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected ByteSize to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.Size = int32(i64)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSections(v *map[string]types.Section, 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 mv map[string]types.Section
if *v == nil {
mv = map[string]types.Section{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal types.Section
mapVar := parsedVal
destAddr := &mapVar
if err := awsRestjson1_deserializeDocumentSection(&destAddr, value); err != nil {
return err
}
parsedVal = *destAddr
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_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 ExceptionMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSnapshotDetails(v **types.SnapshotDetails, 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.SnapshotDetails
if *v == nil {
sv = &types.SnapshotDetails{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Created":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Created = ptr.Time(t)
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SnapshotDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SnapshotId to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdated":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastUpdated = ptr.Time(t)
}
case "Sections":
if err := awsRestjson1_deserializeDocumentSections(&sv.Sections, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSnapshotSummary(v **types.SnapshotSummary, 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.SnapshotSummary
if *v == nil {
sv = &types.SnapshotSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Created":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Created = ptr.Time(t)
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SnapshotDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Id":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SnapshotId to be of type string, got %T instead", value)
}
sv.Id = ptr.String(jtv)
}
case "LastUpdated":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastUpdated = ptr.Time(t)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSnapshotSummaryList(v *[]types.SnapshotSummary, 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.SnapshotSummary
if *v == nil {
cv = []types.SnapshotSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.SnapshotSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentSnapshotSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentStageDeploymentDetails(v **types.StageDeploymentDetails, 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.StageDeploymentDetails
if *v == nil {
sv = &types.StageDeploymentDetails{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Created":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Created = ptr.Time(t)
}
case "DeploymentAction":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DeploymentAction to be of type string, got %T instead", value)
}
sv.DeploymentAction = types.DeploymentAction(jtv)
}
case "DeploymentId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DeploymentId to be of type string, got %T instead", value)
}
sv.DeploymentId = ptr.String(jtv)
}
case "DeploymentResult":
if err := awsRestjson1_deserializeDocumentDeploymentResult(&sv.DeploymentResult, value); err != nil {
return err
}
case "DeploymentState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DeploymentState to be of type string, got %T instead", value)
}
sv.DeploymentState = types.DeploymentState(jtv)
}
case "LastUpdated":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastUpdated = ptr.Time(t)
}
case "SnapshotId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SnapshotId to be of type string, got %T instead", value)
}
sv.SnapshotId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStageDeploymentList(v *[]types.StageDeploymentSummary, 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.StageDeploymentSummary
if *v == nil {
cv = []types.StageDeploymentSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.StageDeploymentSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentStageDeploymentSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentStageDeploymentSummary(v **types.StageDeploymentSummary, 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.StageDeploymentSummary
if *v == nil {
sv = &types.StageDeploymentSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "DeploymentAction":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DeploymentAction to be of type string, got %T instead", value)
}
sv.DeploymentAction = types.DeploymentAction(jtv)
}
case "DeploymentId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DeploymentId to be of type string, got %T instead", value)
}
sv.DeploymentId = ptr.String(jtv)
}
case "DeploymentResult":
if err := awsRestjson1_deserializeDocumentDeploymentResult(&sv.DeploymentResult, value); err != nil {
return err
}
case "DeploymentState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DeploymentState to be of type string, got %T instead", value)
}
sv.DeploymentState = types.DeploymentState(jtv)
}
case "LastUpdated":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastUpdated = ptr.Time(t)
}
case "SnapshotId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected SnapshotId to be of type string, got %T instead", value)
}
sv.SnapshotId = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStageDetails(v **types.StageDetails, 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.StageDetails
if *v == nil {
sv = &types.StageDetails{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Arn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ARN to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "Created":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.Created = ptr.Time(t)
}
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StageDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "GameKey":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GameKey to be of type string, got %T instead", value)
}
sv.GameKey = ptr.String(jtv)
}
case "LastUpdated":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
t, err := smithytime.ParseDateTime(jtv)
if err != nil {
return err
}
sv.LastUpdated = ptr.Time(t)
}
case "LogGroup":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LogGroupName to be of type string, got %T instead", value)
}
sv.LogGroup = ptr.String(jtv)
}
case "Name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StageName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "Role":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RoleARN to be of type string, got %T instead", value)
}
sv.Role = ptr.String(jtv)
}
case "State":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StageState to be of type string, got %T instead", value)
}
sv.State = types.StageState(jtv)
}
case "Tags":
if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStageSummary(v **types.StageSummary, 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.StageSummary
if *v == nil {
sv = &types.StageSummary{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Description":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StageDescription to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "GameKey":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected GameKey to be of type string, got %T instead", value)
}
sv.GameKey = ptr.String(jtv)
}
case "Name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StageName to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "State":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StageState to be of type string, got %T instead", value)
}
sv.State = types.StageState(jtv)
}
case "Tags":
if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentStageSummaryList(v *[]types.StageSummary, 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.StageSummary
if *v == nil {
cv = []types.StageSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.StageSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentStageSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, 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 mv map[string]string
if *v == nil {
mv = map[string]string{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagValue to be of type string, got %T instead", value)
}
parsedVal = jtv
}
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ThrottlingException
if *v == nil {
sv = &types.ThrottlingException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExceptionMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_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 ExceptionMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
| 7,138 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
// Package gamesparks provides the API client, operations, and parameter types for
// GameSparks.
package gamesparks
| 6 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
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/gamesparks/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 = "gamesparks"
}
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 gamesparks
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.2.12"
| 7 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
| 4 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
import (
"bytes"
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/gamesparks/document"
internaldocument "github.com/aws/aws-sdk-go-v2/service/gamesparks/internal/document"
"github.com/aws/aws-sdk-go-v2/service/gamesparks/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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
type awsRestjson1_serializeOpCreateGame struct {
}
func (*awsRestjson1_serializeOpCreateGame) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCreateGame) 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.(*CreateGameInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentCreateGameInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsCreateGameInput(v *CreateGameInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentCreateGameInput(v *CreateGameInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("ClientToken")
ok.String(*v.ClientToken)
}
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
if v.GameName != nil {
ok := object.Key("GameName")
ok.String(*v.GameName)
}
if v.Tags != nil {
ok := object.Key("Tags")
if err := awsRestjson1_serializeDocumentTagMap(v.Tags, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpCreateSnapshot struct {
}
func (*awsRestjson1_serializeOpCreateSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_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)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/snapshot")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsCreateSnapshotInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsCreateSnapshotInput(v *CreateSnapshotInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentCreateSnapshotInput(v *CreateSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
return nil
}
type awsRestjson1_serializeOpCreateStage struct {
}
func (*awsRestjson1_serializeOpCreateStage) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCreateStage) 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.(*CreateStageInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/stage")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsCreateStageInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentCreateStageInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsCreateStageInput(v *CreateStageInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentCreateStageInput(v *CreateStageInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("ClientToken")
ok.String(*v.ClientToken)
}
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
if v.Role != nil {
ok := object.Key("Role")
ok.String(*v.Role)
}
if v.StageName != nil {
ok := object.Key("StageName")
ok.String(*v.StageName)
}
if v.Tags != nil {
ok := object.Key("Tags")
if err := awsRestjson1_serializeDocumentTagMap(v.Tags, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDeleteGame struct {
}
func (*awsRestjson1_serializeOpDeleteGame) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeleteGame) 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.(*DeleteGameInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDeleteGameInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDeleteGameInput(v *DeleteGameInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDeleteStage struct {
}
func (*awsRestjson1_serializeOpDeleteStage) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeleteStage) 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.(*DeleteStageInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/stage/{StageName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDeleteStageInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDeleteStageInput(v *DeleteStageInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.StageName == nil || len(*v.StageName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member StageName must not be empty")}
}
if v.StageName != nil {
if err := encoder.SetURI("StageName").String(*v.StageName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDisconnectPlayer struct {
}
func (*awsRestjson1_serializeOpDisconnectPlayer) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDisconnectPlayer) 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.(*DisconnectPlayerInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/runtime/game/{GameName}/stage/{StageName}/player/{PlayerId}/disconnect")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDisconnectPlayerInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDisconnectPlayerInput(v *DisconnectPlayerInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.PlayerId == nil || len(*v.PlayerId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member PlayerId must not be empty")}
}
if v.PlayerId != nil {
if err := encoder.SetURI("PlayerId").String(*v.PlayerId); err != nil {
return err
}
}
if v.StageName == nil || len(*v.StageName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member StageName must not be empty")}
}
if v.StageName != nil {
if err := encoder.SetURI("StageName").String(*v.StageName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpExportSnapshot struct {
}
func (*awsRestjson1_serializeOpExportSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpExportSnapshot) 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.(*ExportSnapshotInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/snapshot/{SnapshotId}/export")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsExportSnapshotInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsExportSnapshotInput(v *ExportSnapshotInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.SnapshotId == nil || len(*v.SnapshotId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member SnapshotId must not be empty")}
}
if v.SnapshotId != nil {
if err := encoder.SetURI("SnapshotId").String(*v.SnapshotId); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetExtension struct {
}
func (*awsRestjson1_serializeOpGetExtension) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetExtension) 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.(*GetExtensionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/extension/{Namespace}/{Name}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetExtensionInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetExtensionInput(v *GetExtensionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.Name == nil || len(*v.Name) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Name must not be empty")}
}
if v.Name != nil {
if err := encoder.SetURI("Name").String(*v.Name); err != nil {
return err
}
}
if v.Namespace == nil || len(*v.Namespace) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Namespace must not be empty")}
}
if v.Namespace != nil {
if err := encoder.SetURI("Namespace").String(*v.Namespace); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetExtensionVersion struct {
}
func (*awsRestjson1_serializeOpGetExtensionVersion) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetExtensionVersion) 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.(*GetExtensionVersionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/extension/{Namespace}/{Name}/version/{ExtensionVersion}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetExtensionVersionInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetExtensionVersionInput(v *GetExtensionVersionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.ExtensionVersion == nil || len(*v.ExtensionVersion) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member ExtensionVersion must not be empty")}
}
if v.ExtensionVersion != nil {
if err := encoder.SetURI("ExtensionVersion").String(*v.ExtensionVersion); err != nil {
return err
}
}
if v.Name == nil || len(*v.Name) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Name must not be empty")}
}
if v.Name != nil {
if err := encoder.SetURI("Name").String(*v.Name); err != nil {
return err
}
}
if v.Namespace == nil || len(*v.Namespace) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Namespace must not be empty")}
}
if v.Namespace != nil {
if err := encoder.SetURI("Namespace").String(*v.Namespace); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetGame struct {
}
func (*awsRestjson1_serializeOpGetGame) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetGame) 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.(*GetGameInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetGameInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetGameInput(v *GetGameInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetGameConfiguration struct {
}
func (*awsRestjson1_serializeOpGetGameConfiguration) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetGameConfiguration) 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.(*GetGameConfigurationInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/configuration")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetGameConfigurationInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetGameConfigurationInput(v *GetGameConfigurationInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.Sections != nil {
for i := range v.Sections {
encoder.AddQuery("Sections").String(v.Sections[i])
}
}
return nil
}
type awsRestjson1_serializeOpGetGeneratedCodeJob struct {
}
func (*awsRestjson1_serializeOpGetGeneratedCodeJob) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetGeneratedCodeJob) 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.(*GetGeneratedCodeJobInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/snapshot/{SnapshotId}/generated-sdk-code-job/{JobId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetGeneratedCodeJobInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetGeneratedCodeJobInput(v *GetGeneratedCodeJobInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.JobId == nil || len(*v.JobId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member JobId must not be empty")}
}
if v.JobId != nil {
if err := encoder.SetURI("JobId").String(*v.JobId); err != nil {
return err
}
}
if v.SnapshotId == nil || len(*v.SnapshotId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member SnapshotId must not be empty")}
}
if v.SnapshotId != nil {
if err := encoder.SetURI("SnapshotId").String(*v.SnapshotId); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetPlayerConnectionStatus struct {
}
func (*awsRestjson1_serializeOpGetPlayerConnectionStatus) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetPlayerConnectionStatus) 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.(*GetPlayerConnectionStatusInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/runtime/game/{GameName}/stage/{StageName}/player/{PlayerId}/connection")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetPlayerConnectionStatusInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetPlayerConnectionStatusInput(v *GetPlayerConnectionStatusInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.PlayerId == nil || len(*v.PlayerId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member PlayerId must not be empty")}
}
if v.PlayerId != nil {
if err := encoder.SetURI("PlayerId").String(*v.PlayerId); err != nil {
return err
}
}
if v.StageName == nil || len(*v.StageName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member StageName must not be empty")}
}
if v.StageName != nil {
if err := encoder.SetURI("StageName").String(*v.StageName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetSnapshot struct {
}
func (*awsRestjson1_serializeOpGetSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_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)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/snapshot/{SnapshotId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetSnapshotInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetSnapshotInput(v *GetSnapshotInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.Sections != nil {
for i := range v.Sections {
encoder.AddQuery("Sections").String(v.Sections[i])
}
}
if v.SnapshotId == nil || len(*v.SnapshotId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member SnapshotId must not be empty")}
}
if v.SnapshotId != nil {
if err := encoder.SetURI("SnapshotId").String(*v.SnapshotId); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetStage struct {
}
func (*awsRestjson1_serializeOpGetStage) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetStage) 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.(*GetStageInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/stage/{StageName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetStageInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetStageInput(v *GetStageInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.StageName == nil || len(*v.StageName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member StageName must not be empty")}
}
if v.StageName != nil {
if err := encoder.SetURI("StageName").String(*v.StageName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetStageDeployment struct {
}
func (*awsRestjson1_serializeOpGetStageDeployment) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetStageDeployment) 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.(*GetStageDeploymentInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/stage/{StageName}/deployment")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetStageDeploymentInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetStageDeploymentInput(v *GetStageDeploymentInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.DeploymentId != nil {
encoder.SetQuery("DeploymentId").String(*v.DeploymentId)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.StageName == nil || len(*v.StageName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member StageName must not be empty")}
}
if v.StageName != nil {
if err := encoder.SetURI("StageName").String(*v.StageName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpImportGameConfiguration struct {
}
func (*awsRestjson1_serializeOpImportGameConfiguration) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpImportGameConfiguration) 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.(*ImportGameConfigurationInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/configuration")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PUT"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsImportGameConfigurationInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentImportGameConfigurationInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsImportGameConfigurationInput(v *ImportGameConfigurationInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentImportGameConfigurationInput(v *ImportGameConfigurationInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ImportSource != nil {
ok := object.Key("ImportSource")
if err := awsRestjson1_serializeDocumentImportGameConfigurationSource(v.ImportSource, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListExtensions struct {
}
func (*awsRestjson1_serializeOpListExtensions) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListExtensions) 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.(*ListExtensionsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/extension")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListExtensionsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListExtensionsInput(v *ListExtensionsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.MaxResults != nil {
encoder.SetQuery("MaxResults").Integer(*v.MaxResults)
}
if v.NextToken != nil {
encoder.SetQuery("NextToken").String(*v.NextToken)
}
return nil
}
type awsRestjson1_serializeOpListExtensionVersions struct {
}
func (*awsRestjson1_serializeOpListExtensionVersions) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListExtensionVersions) 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.(*ListExtensionVersionsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/extension/{Namespace}/{Name}/version")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListExtensionVersionsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListExtensionVersionsInput(v *ListExtensionVersionsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.MaxResults != nil {
encoder.SetQuery("MaxResults").Integer(*v.MaxResults)
}
if v.Name == nil || len(*v.Name) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Name must not be empty")}
}
if v.Name != nil {
if err := encoder.SetURI("Name").String(*v.Name); err != nil {
return err
}
}
if v.Namespace == nil || len(*v.Namespace) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Namespace must not be empty")}
}
if v.Namespace != nil {
if err := encoder.SetURI("Namespace").String(*v.Namespace); err != nil {
return err
}
}
if v.NextToken != nil {
encoder.SetQuery("NextToken").String(*v.NextToken)
}
return nil
}
type awsRestjson1_serializeOpListGames struct {
}
func (*awsRestjson1_serializeOpListGames) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListGames) 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.(*ListGamesInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListGamesInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListGamesInput(v *ListGamesInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.MaxResults != nil {
encoder.SetQuery("MaxResults").Integer(*v.MaxResults)
}
if v.NextToken != nil {
encoder.SetQuery("NextToken").String(*v.NextToken)
}
return nil
}
type awsRestjson1_serializeOpListGeneratedCodeJobs struct {
}
func (*awsRestjson1_serializeOpListGeneratedCodeJobs) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListGeneratedCodeJobs) 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.(*ListGeneratedCodeJobsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/snapshot/{SnapshotId}/generated-sdk-code-jobs")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListGeneratedCodeJobsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListGeneratedCodeJobsInput(v *ListGeneratedCodeJobsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.MaxResults != nil {
encoder.SetQuery("MaxResults").Integer(*v.MaxResults)
}
if v.NextToken != nil {
encoder.SetQuery("NextToken").String(*v.NextToken)
}
if v.SnapshotId == nil || len(*v.SnapshotId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member SnapshotId must not be empty")}
}
if v.SnapshotId != nil {
if err := encoder.SetURI("SnapshotId").String(*v.SnapshotId); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListSnapshots struct {
}
func (*awsRestjson1_serializeOpListSnapshots) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_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)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/snapshot")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListSnapshotsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListSnapshotsInput(v *ListSnapshotsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.MaxResults != nil {
encoder.SetQuery("MaxResults").Integer(*v.MaxResults)
}
if v.NextToken != nil {
encoder.SetQuery("NextToken").String(*v.NextToken)
}
return nil
}
type awsRestjson1_serializeOpListStageDeployments struct {
}
func (*awsRestjson1_serializeOpListStageDeployments) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListStageDeployments) 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.(*ListStageDeploymentsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/stage/{StageName}/deployments")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListStageDeploymentsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListStageDeploymentsInput(v *ListStageDeploymentsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.MaxResults != nil {
encoder.SetQuery("MaxResults").Integer(*v.MaxResults)
}
if v.NextToken != nil {
encoder.SetQuery("NextToken").String(*v.NextToken)
}
if v.StageName == nil || len(*v.StageName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member StageName must not be empty")}
}
if v.StageName != nil {
if err := encoder.SetURI("StageName").String(*v.StageName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListStages struct {
}
func (*awsRestjson1_serializeOpListStages) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListStages) 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.(*ListStagesInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/stage")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListStagesInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListStagesInput(v *ListStagesInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.MaxResults != nil {
encoder.SetQuery("MaxResults").Integer(*v.MaxResults)
}
if v.NextToken != nil {
encoder.SetQuery("NextToken").String(*v.NextToken)
}
return nil
}
type awsRestjson1_serializeOpListTagsForResource struct {
}
func (*awsRestjson1_serializeOpListTagsForResource) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_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)}
}
opPath, opQuery := httpbinding.SplitURI("/tags/{ResourceArn}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListTagsForResourceInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListTagsForResourceInput(v *ListTagsForResourceInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.ResourceArn == nil || len(*v.ResourceArn) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceArn must not be empty")}
}
if v.ResourceArn != nil {
if err := encoder.SetURI("ResourceArn").String(*v.ResourceArn); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpStartGeneratedCodeJob struct {
}
func (*awsRestjson1_serializeOpStartGeneratedCodeJob) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpStartGeneratedCodeJob) 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.(*StartGeneratedCodeJobInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/snapshot/{SnapshotId}/generated-sdk-code-job")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsStartGeneratedCodeJobInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentStartGeneratedCodeJobInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsStartGeneratedCodeJobInput(v *StartGeneratedCodeJobInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.SnapshotId == nil || len(*v.SnapshotId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member SnapshotId must not be empty")}
}
if v.SnapshotId != nil {
if err := encoder.SetURI("SnapshotId").String(*v.SnapshotId); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentStartGeneratedCodeJobInput(v *StartGeneratedCodeJobInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Generator != nil {
ok := object.Key("Generator")
if err := awsRestjson1_serializeDocumentGenerator(v.Generator, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpStartStageDeployment struct {
}
func (*awsRestjson1_serializeOpStartStageDeployment) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpStartStageDeployment) 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.(*StartStageDeploymentInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/stage/{StageName}/deployment")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsStartStageDeploymentInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentStartStageDeploymentInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsStartStageDeploymentInput(v *StartStageDeploymentInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.StageName == nil || len(*v.StageName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member StageName must not be empty")}
}
if v.StageName != nil {
if err := encoder.SetURI("StageName").String(*v.StageName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentStartStageDeploymentInput(v *StartStageDeploymentInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("ClientToken")
ok.String(*v.ClientToken)
}
if v.SnapshotId != nil {
ok := object.Key("SnapshotId")
ok.String(*v.SnapshotId)
}
return nil
}
type awsRestjson1_serializeOpTagResource struct {
}
func (*awsRestjson1_serializeOpTagResource) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_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)}
}
opPath, opQuery := httpbinding.SplitURI("/tags/{ResourceArn}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsTagResourceInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsTagResourceInput(v *TagResourceInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.ResourceArn == nil || len(*v.ResourceArn) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceArn must not be empty")}
}
if v.ResourceArn != nil {
if err := encoder.SetURI("ResourceArn").String(*v.ResourceArn); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentTagResourceInput(v *TagResourceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Tags != nil {
ok := object.Key("tags")
if err := awsRestjson1_serializeDocumentTagMap(v.Tags, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpUntagResource struct {
}
func (*awsRestjson1_serializeOpUntagResource) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_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)}
}
opPath, opQuery := httpbinding.SplitURI("/tags/{ResourceArn}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsUntagResourceInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsUntagResourceInput(v *UntagResourceInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.ResourceArn == nil || len(*v.ResourceArn) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceArn must not be empty")}
}
if v.ResourceArn != nil {
if err := encoder.SetURI("ResourceArn").String(*v.ResourceArn); err != nil {
return err
}
}
if v.TagKeys != nil {
for i := range v.TagKeys {
encoder.AddQuery("tagKeys").String(v.TagKeys[i])
}
}
return nil
}
type awsRestjson1_serializeOpUpdateGame struct {
}
func (*awsRestjson1_serializeOpUpdateGame) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpUpdateGame) 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.(*UpdateGameInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PATCH"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsUpdateGameInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentUpdateGameInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsUpdateGameInput(v *UpdateGameInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentUpdateGameInput(v *UpdateGameInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
return nil
}
type awsRestjson1_serializeOpUpdateGameConfiguration struct {
}
func (*awsRestjson1_serializeOpUpdateGameConfiguration) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpUpdateGameConfiguration) 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.(*UpdateGameConfigurationInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/configuration")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PATCH"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsUpdateGameConfigurationInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentUpdateGameConfigurationInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsUpdateGameConfigurationInput(v *UpdateGameConfigurationInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentUpdateGameConfigurationInput(v *UpdateGameConfigurationInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Modifications != nil {
ok := object.Key("Modifications")
if err := awsRestjson1_serializeDocumentSectionModificationList(v.Modifications, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpUpdateSnapshot struct {
}
func (*awsRestjson1_serializeOpUpdateSnapshot) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_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)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/snapshot/{SnapshotId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PATCH"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsUpdateSnapshotInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsUpdateSnapshotInput(v *UpdateSnapshotInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.SnapshotId == nil || len(*v.SnapshotId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member SnapshotId must not be empty")}
}
if v.SnapshotId != nil {
if err := encoder.SetURI("SnapshotId").String(*v.SnapshotId); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentUpdateSnapshotInput(v *UpdateSnapshotInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
return nil
}
type awsRestjson1_serializeOpUpdateStage struct {
}
func (*awsRestjson1_serializeOpUpdateStage) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpUpdateStage) 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.(*UpdateStageInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/game/{GameName}/stage/{StageName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PATCH"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsUpdateStageInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentUpdateStageInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsUpdateStageInput(v *UpdateStageInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.GameName == nil || len(*v.GameName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member GameName must not be empty")}
}
if v.GameName != nil {
if err := encoder.SetURI("GameName").String(*v.GameName); err != nil {
return err
}
}
if v.StageName == nil || len(*v.StageName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member StageName must not be empty")}
}
if v.StageName != nil {
if err := encoder.SetURI("StageName").String(*v.StageName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentUpdateStageInput(v *UpdateStageInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
if v.Role != nil {
ok := object.Key("Role")
ok.String(*v.Role)
}
return nil
}
func awsRestjson1_serializeDocumentDocument(v document.Interface, value smithyjson.Value) error {
if v == nil {
return nil
}
if !internaldocument.IsInterface(v) {
return fmt.Errorf("%T is not a compatible document type", v)
}
db, err := v.MarshalSmithyDocument()
if err != nil {
return err
}
value.Write(db)
return nil
}
func awsRestjson1_serializeDocumentGenerator(v *types.Generator, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.GameSdkVersion != nil {
ok := object.Key("GameSdkVersion")
ok.String(*v.GameSdkVersion)
}
if v.Language != nil {
ok := object.Key("Language")
ok.String(*v.Language)
}
if v.TargetPlatform != nil {
ok := object.Key("TargetPlatform")
ok.String(*v.TargetPlatform)
}
return nil
}
func awsRestjson1_serializeDocumentImportGameConfigurationSource(v *types.ImportGameConfigurationSource, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.File != nil {
ok := object.Key("File")
ok.Base64EncodeBytes(v.File)
}
return nil
}
func awsRestjson1_serializeDocumentSectionModification(v *types.SectionModification, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.Operation) > 0 {
ok := object.Key("Operation")
ok.String(string(v.Operation))
}
if v.Path != nil {
ok := object.Key("Path")
ok.String(*v.Path)
}
if v.Section != nil {
ok := object.Key("Section")
ok.String(*v.Section)
}
if v.Value != nil {
ok := object.Key("Value")
if err := awsRestjson1_serializeDocumentDocument(v.Value, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentSectionModificationList(v []types.SectionModification, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsRestjson1_serializeDocumentSectionModification(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentTagMap(v map[string]string, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
for key := range v {
om := object.Key(key)
om.String(v[key])
}
return nil
}
| 2,580 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package gamesparks
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/gamesparks/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
)
type validateOpCreateGame struct {
}
func (*validateOpCreateGame) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateGame) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateGameInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateGameInput(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 validateOpCreateStage struct {
}
func (*validateOpCreateStage) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateStage) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateStageInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateStageInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteGame struct {
}
func (*validateOpDeleteGame) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteGame) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteGameInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteGameInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteStage struct {
}
func (*validateOpDeleteStage) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteStage) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteStageInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteStageInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDisconnectPlayer struct {
}
func (*validateOpDisconnectPlayer) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDisconnectPlayer) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DisconnectPlayerInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDisconnectPlayerInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpExportSnapshot struct {
}
func (*validateOpExportSnapshot) ID() string {
return "OperationInputValidation"
}
func (m *validateOpExportSnapshot) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ExportSnapshotInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpExportSnapshotInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetExtension struct {
}
func (*validateOpGetExtension) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetExtension) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetExtensionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetExtensionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetExtensionVersion struct {
}
func (*validateOpGetExtensionVersion) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetExtensionVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetExtensionVersionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetExtensionVersionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetGameConfiguration struct {
}
func (*validateOpGetGameConfiguration) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetGameConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetGameConfigurationInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetGameConfigurationInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetGame struct {
}
func (*validateOpGetGame) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetGame) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetGameInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetGameInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetGeneratedCodeJob struct {
}
func (*validateOpGetGeneratedCodeJob) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetGeneratedCodeJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetGeneratedCodeJobInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetGeneratedCodeJobInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetPlayerConnectionStatus struct {
}
func (*validateOpGetPlayerConnectionStatus) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetPlayerConnectionStatus) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetPlayerConnectionStatusInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetPlayerConnectionStatusInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetSnapshot struct {
}
func (*validateOpGetSnapshot) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetSnapshot) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetSnapshotInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetSnapshotInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetStageDeployment struct {
}
func (*validateOpGetStageDeployment) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetStageDeployment) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetStageDeploymentInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetStageDeploymentInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetStage struct {
}
func (*validateOpGetStage) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetStage) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetStageInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetStageInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpImportGameConfiguration struct {
}
func (*validateOpImportGameConfiguration) ID() string {
return "OperationInputValidation"
}
func (m *validateOpImportGameConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ImportGameConfigurationInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpImportGameConfigurationInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListExtensionVersions struct {
}
func (*validateOpListExtensionVersions) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListExtensionVersions) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListExtensionVersionsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListExtensionVersionsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListGeneratedCodeJobs struct {
}
func (*validateOpListGeneratedCodeJobs) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListGeneratedCodeJobs) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListGeneratedCodeJobsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListGeneratedCodeJobsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListSnapshots struct {
}
func (*validateOpListSnapshots) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListSnapshots) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListSnapshotsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListSnapshotsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListStageDeployments struct {
}
func (*validateOpListStageDeployments) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListStageDeployments) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListStageDeploymentsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListStageDeploymentsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListStages struct {
}
func (*validateOpListStages) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListStages) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListStagesInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListStagesInput(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 validateOpStartGeneratedCodeJob struct {
}
func (*validateOpStartGeneratedCodeJob) ID() string {
return "OperationInputValidation"
}
func (m *validateOpStartGeneratedCodeJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*StartGeneratedCodeJobInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpStartGeneratedCodeJobInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpStartStageDeployment struct {
}
func (*validateOpStartStageDeployment) ID() string {
return "OperationInputValidation"
}
func (m *validateOpStartStageDeployment) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*StartStageDeploymentInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpStartStageDeploymentInput(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 validateOpUpdateGameConfiguration struct {
}
func (*validateOpUpdateGameConfiguration) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateGameConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateGameConfigurationInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateGameConfigurationInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUpdateGame struct {
}
func (*validateOpUpdateGame) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateGame) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateGameInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateGameInput(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 validateOpUpdateStage struct {
}
func (*validateOpUpdateStage) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateStage) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateStageInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateStageInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
func addOpCreateGameValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateGame{}, middleware.After)
}
func addOpCreateSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateSnapshot{}, middleware.After)
}
func addOpCreateStageValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateStage{}, middleware.After)
}
func addOpDeleteGameValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteGame{}, middleware.After)
}
func addOpDeleteStageValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteStage{}, middleware.After)
}
func addOpDisconnectPlayerValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDisconnectPlayer{}, middleware.After)
}
func addOpExportSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpExportSnapshot{}, middleware.After)
}
func addOpGetExtensionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetExtension{}, middleware.After)
}
func addOpGetExtensionVersionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetExtensionVersion{}, middleware.After)
}
func addOpGetGameConfigurationValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetGameConfiguration{}, middleware.After)
}
func addOpGetGameValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetGame{}, middleware.After)
}
func addOpGetGeneratedCodeJobValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetGeneratedCodeJob{}, middleware.After)
}
func addOpGetPlayerConnectionStatusValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetPlayerConnectionStatus{}, middleware.After)
}
func addOpGetSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetSnapshot{}, middleware.After)
}
func addOpGetStageDeploymentValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetStageDeployment{}, middleware.After)
}
func addOpGetStageValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetStage{}, middleware.After)
}
func addOpImportGameConfigurationValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpImportGameConfiguration{}, middleware.After)
}
func addOpListExtensionVersionsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListExtensionVersions{}, middleware.After)
}
func addOpListGeneratedCodeJobsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListGeneratedCodeJobs{}, middleware.After)
}
func addOpListSnapshotsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListSnapshots{}, middleware.After)
}
func addOpListStageDeploymentsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListStageDeployments{}, middleware.After)
}
func addOpListStagesValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListStages{}, middleware.After)
}
func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After)
}
func addOpStartGeneratedCodeJobValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpStartGeneratedCodeJob{}, middleware.After)
}
func addOpStartStageDeploymentValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpStartStageDeployment{}, 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 addOpUpdateGameConfigurationValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateGameConfiguration{}, middleware.After)
}
func addOpUpdateGameValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateGame{}, middleware.After)
}
func addOpUpdateSnapshotValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateSnapshot{}, middleware.After)
}
func addOpUpdateStageValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateStage{}, middleware.After)
}
func validateImportGameConfigurationSource(v *types.ImportGameConfigurationSource) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ImportGameConfigurationSource"}
if v.File == nil {
invalidParams.Add(smithy.NewErrParamRequired("File"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateSectionModification(v *types.SectionModification) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "SectionModification"}
if v.Section == nil {
invalidParams.Add(smithy.NewErrParamRequired("Section"))
}
if v.Path == nil {
invalidParams.Add(smithy.NewErrParamRequired("Path"))
}
if len(v.Operation) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("Operation"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateSectionModificationList(v []types.SectionModification) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "SectionModificationList"}
for i := range v {
if err := validateSectionModification(&v[i]); err != nil {
invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateGameInput(v *CreateGameInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateGameInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
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.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateStageInput(v *CreateStageInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateStageInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if v.Role == nil {
invalidParams.Add(smithy.NewErrParamRequired("Role"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteGameInput(v *DeleteGameInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteGameInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteStageInput(v *DeleteStageInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteStageInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDisconnectPlayerInput(v *DisconnectPlayerInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DisconnectPlayerInput"}
if v.PlayerId == nil {
invalidParams.Add(smithy.NewErrParamRequired("PlayerId"))
}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpExportSnapshotInput(v *ExportSnapshotInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ExportSnapshotInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.SnapshotId == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetExtensionInput(v *GetExtensionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetExtensionInput"}
if v.Namespace == nil {
invalidParams.Add(smithy.NewErrParamRequired("Namespace"))
}
if v.Name == nil {
invalidParams.Add(smithy.NewErrParamRequired("Name"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetExtensionVersionInput(v *GetExtensionVersionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetExtensionVersionInput"}
if v.Namespace == nil {
invalidParams.Add(smithy.NewErrParamRequired("Namespace"))
}
if v.Name == nil {
invalidParams.Add(smithy.NewErrParamRequired("Name"))
}
if v.ExtensionVersion == nil {
invalidParams.Add(smithy.NewErrParamRequired("ExtensionVersion"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetGameConfigurationInput(v *GetGameConfigurationInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetGameConfigurationInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetGameInput(v *GetGameInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetGameInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetGeneratedCodeJobInput(v *GetGeneratedCodeJobInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetGeneratedCodeJobInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.SnapshotId == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotId"))
}
if v.JobId == nil {
invalidParams.Add(smithy.NewErrParamRequired("JobId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetPlayerConnectionStatusInput(v *GetPlayerConnectionStatusInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetPlayerConnectionStatusInput"}
if v.PlayerId == nil {
invalidParams.Add(smithy.NewErrParamRequired("PlayerId"))
}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetSnapshotInput(v *GetSnapshotInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetSnapshotInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.SnapshotId == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetStageDeploymentInput(v *GetStageDeploymentInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetStageDeploymentInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetStageInput(v *GetStageInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetStageInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpImportGameConfigurationInput(v *ImportGameConfigurationInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ImportGameConfigurationInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.ImportSource == nil {
invalidParams.Add(smithy.NewErrParamRequired("ImportSource"))
} else if v.ImportSource != nil {
if err := validateImportGameConfigurationSource(v.ImportSource); err != nil {
invalidParams.AddNested("ImportSource", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListExtensionVersionsInput(v *ListExtensionVersionsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListExtensionVersionsInput"}
if v.Namespace == nil {
invalidParams.Add(smithy.NewErrParamRequired("Namespace"))
}
if v.Name == nil {
invalidParams.Add(smithy.NewErrParamRequired("Name"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListGeneratedCodeJobsInput(v *ListGeneratedCodeJobsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListGeneratedCodeJobsInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.SnapshotId == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListSnapshotsInput(v *ListSnapshotsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListSnapshotsInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListStageDeploymentsInput(v *ListStageDeploymentsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListStageDeploymentsInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListStagesInput(v *ListStagesInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListStagesInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
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 validateOpStartGeneratedCodeJobInput(v *StartGeneratedCodeJobInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "StartGeneratedCodeJobInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.SnapshotId == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotId"))
}
if v.Generator == nil {
invalidParams.Add(smithy.NewErrParamRequired("Generator"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpStartStageDeploymentInput(v *StartStageDeploymentInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "StartStageDeploymentInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if v.SnapshotId == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotId"))
}
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"))
}
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 validateOpUpdateGameConfigurationInput(v *UpdateGameConfigurationInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateGameConfigurationInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.Modifications == nil {
invalidParams.Add(smithy.NewErrParamRequired("Modifications"))
} else if v.Modifications != nil {
if err := validateSectionModificationList(v.Modifications); err != nil {
invalidParams.AddNested("Modifications", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUpdateGameInput(v *UpdateGameInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateGameInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
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.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.SnapshotId == nil {
invalidParams.Add(smithy.NewErrParamRequired("SnapshotId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUpdateStageInput(v *UpdateStageInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateStageInput"}
if v.GameName == nil {
invalidParams.Add(smithy.NewErrParamRequired("GameName"))
}
if v.StageName == nil {
invalidParams.Add(smithy.NewErrParamRequired("StageName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
| 1,369 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
// Package document implements encoding and decoding of open-content that has a JSON-like data model.
// This data-model allows for UTF-8 strings, arbitrary precision numbers, booleans, nulls, a list of these values, and a
// map of UTF-8 strings to these values.
//
// Interface defines the semantics for how a document type is marshalled and unmarshalled for requests and responses
// for the service. To send a document as input to the service you use NewLazyDocument and pass it the Go type to be
// sent to the service. NewLazyDocument returns a document Interface type that encodes the provided Go type during
// the request serialization step after you have invoked an API client operation that uses the document type.
//
// The following examples show how you can create document types using basic Go types.
//
// NewLazyDocument(map[string]interface{}{
// "favoriteNumber": 42,
// "fruits": []string{"apple", "orange"},
// "capitals": map[string]interface{}{
// "Washington": "Olympia",
// "Oregon": "Salem",
// },
// "skyIsBlue": true,
// })
//
// NewLazyDocument(3.14159)
//
// NewLazyDocument([]interface{"One", 2, 3, 3.5, "four"})
//
// NewLazyDocument(true)
//
// Services can send document types as part of their API responses. To retrieve the content of a response document
// you use the UnmarshalSmithyDocument method on the response document. When calling UnmarshalSmithyDocument you pass
// a reference to the Go type that you want to unmarshal and map the response to.
//
// For example, if you expect to receive key/value map from the service response:
//
// var kv map[string]interface{}
// if err := outputDocument.UnmarshalSmithyDocument(&kv); err != nil {
// // handle error
// }
//
// If a service can return one or more data-types in the response, you can use an empty interface and type switch to
// dynamically handle the response type.
//
// var v interface{}
// if err := outputDocument.UnmarshalSmithyDocument(&v); err != nil {
// // handle error
// }
//
// switch vv := v.(type) {
// case map[string]interface{}:
// // handle key/value map
// case []interface{}:
// // handle array of values
// case bool:
// // handle boolean
// case document.Number:
// // handle an arbitrary precision number
// case string:
// // handle string
// default:
// // handle unknown case
// }
//
// The mapping of Go types to document types is covered in more depth in https://pkg.go.dev/github.com/aws/smithy-go/document
// including more in depth examples that cover user-defined structure types.
package document
| 67 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package document
import (
internaldocument "github.com/aws/aws-sdk-go-v2/service/gamesparks/internal/document"
)
// Interface defines a document which is a protocol-agnostic type which supports a
// JSON-like data-model. You can use this type to send UTF-8 strings, arbitrary
// precision numbers, booleans, nulls, a list of these values, and a map of UTF-8
// strings to these values.
//
// You create a document type using the NewLazyDocument function and passing it
// the Go type to marshal. When receiving a document in an API response, you use
// the document's UnmarshalSmithyDocument function to decode the response to your
// desired Go type. Unless documented specifically generated structure types in
// client packages or client types packages are not supported at this time. Such
// types embed a noSmithyDocumentSerde and will cause an error to be returned when
// attempting to send an API request.
//
// For more information see the accompanying package documentation and linked
// references.
type Interface = internaldocument.Interface
// You create document type using the NewLazyDocument function and passing it the
// Go type to be marshaled and sent to the service. The document marshaler supports
// semantics similar to the encoding/json Go standard library.
//
// For more information see the accompanying package documentation and linked
// references.
func NewLazyDocument(v interface{}) Interface {
return internaldocument.NewDocumentMarshaler(v)
}
| 35 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package document
import (
"bytes"
"encoding/json"
smithydocument "github.com/aws/smithy-go/document"
smithydocumentjson "github.com/aws/smithy-go/document/json"
)
// github.com/aws/aws-sdk-go-v2/service/gamesparks/internal/document.smithyDocument
// is an interface which is used to bind a document type to its service client.
type smithyDocument interface {
isSmithyDocument()
}
// github.com/aws/aws-sdk-go-v2/service/gamesparks/internal/document.Interface is
// a JSON-like data model type that is protocol agnostic and is usedto send
// open-content to a service.
type Interface interface {
smithyDocument
smithydocument.Marshaler
smithydocument.Unmarshaler
}
type documentMarshaler struct {
value interface{}
}
func (m *documentMarshaler) UnmarshalSmithyDocument(v interface{}) error {
mBytes, err := m.MarshalSmithyDocument()
if err != nil {
return err
}
jDecoder := json.NewDecoder(bytes.NewReader(mBytes))
jDecoder.UseNumber()
var jv interface{}
if err := jDecoder.Decode(&v); err != nil {
return err
}
return NewDocumentUnmarshaler(v).UnmarshalSmithyDocument(&jv)
}
func (m *documentMarshaler) MarshalSmithyDocument() ([]byte, error) {
return smithydocumentjson.NewEncoder().Encode(m.value)
}
func (m *documentMarshaler) isSmithyDocument() {}
var _ Interface = (*documentMarshaler)(nil)
type documentUnmarshaler struct {
value interface{}
}
func (m *documentUnmarshaler) UnmarshalSmithyDocument(v interface{}) error {
decoder := smithydocumentjson.NewDecoder()
return decoder.DecodeJSONInterface(m.value, v)
}
func (m *documentUnmarshaler) MarshalSmithyDocument() ([]byte, error) {
return json.Marshal(m.value)
}
func (m *documentUnmarshaler) isSmithyDocument() {}
var _ Interface = (*documentUnmarshaler)(nil)
// NewDocumentMarshaler creates a new document marshaler for the given input type
func NewDocumentMarshaler(v interface{}) Interface {
return &documentMarshaler{
value: v,
}
}
// NewDocumentUnmarshaler creates a new document unmarshaler for the given service
// response
func NewDocumentUnmarshaler(v interface{}) Interface {
return &documentUnmarshaler{
value: v,
}
}
// github.com/aws/aws-sdk-go-v2/service/gamesparks/internal/document.IsInterface
// returns whether the given Interface implementation is a valid client
// implementation
func IsInterface(v Interface) (ok bool) {
defer func() {
if err := recover(); err != nil {
ok = false
}
}()
v.isSmithyDocument()
return true
}
| 100 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package document
import (
smithydocument "github.com/aws/smithy-go/document"
)
var _ smithyDocument = (Interface)(nil)
var _ smithydocument.Marshaler = (Interface)(nil)
var _ smithydocument.Unmarshaler = (Interface)(nil)
| 12 |
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 GameSparks 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: "gamesparks.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "gamesparks-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "gamesparks-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "gamesparks.{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: "us-east-1",
}: endpoints.Endpoint{},
},
},
{
ID: "aws-cn",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "gamesparks.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "gamesparks-fips.{region}.amazonaws.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "gamesparks-fips.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "gamesparks.{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: "gamesparks-fips.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "gamesparks.{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: "gamesparks-fips.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "gamesparks.{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: "gamesparks-fips.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "gamesparks.{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: "gamesparks-fips.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "gamesparks.{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: "gamesparks.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "gamesparks-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "gamesparks-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "gamesparks.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsUsGov,
IsRegionalized: true,
},
}
| 305 |
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 DeploymentAction string
// Enum values for DeploymentAction
const (
DeploymentActionDeploy DeploymentAction = "DEPLOY"
DeploymentActionUndeploy DeploymentAction = "UNDEPLOY"
)
// Values returns all known values for DeploymentAction. 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 (DeploymentAction) Values() []DeploymentAction {
return []DeploymentAction{
"DEPLOY",
"UNDEPLOY",
}
}
type DeploymentState string
// Enum values for DeploymentState
const (
DeploymentStatePending DeploymentState = "PENDING"
DeploymentStateInProgress DeploymentState = "IN_PROGRESS"
DeploymentStateCompleted DeploymentState = "COMPLETED"
DeploymentStateFailed DeploymentState = "FAILED"
)
// Values returns all known values for DeploymentState. 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 (DeploymentState) Values() []DeploymentState {
return []DeploymentState{
"PENDING",
"IN_PROGRESS",
"COMPLETED",
"FAILED",
}
}
type GameState string
// Enum values for GameState
const (
GameStateActive GameState = "ACTIVE"
GameStateDeleting GameState = "DELETING"
)
// Values returns all known values for GameState. 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 (GameState) Values() []GameState {
return []GameState{
"ACTIVE",
"DELETING",
}
}
type GeneratedCodeJobState string
// Enum values for GeneratedCodeJobState
const (
GeneratedCodeJobStateInProgress GeneratedCodeJobState = "IN_PROGRESS"
GeneratedCodeJobStateCompleted GeneratedCodeJobState = "COMPLETED"
GeneratedCodeJobStateFailed GeneratedCodeJobState = "FAILED"
GeneratedCodeJobStatePending GeneratedCodeJobState = "PENDING"
)
// Values returns all known values for GeneratedCodeJobState. 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 (GeneratedCodeJobState) Values() []GeneratedCodeJobState {
return []GeneratedCodeJobState{
"IN_PROGRESS",
"COMPLETED",
"FAILED",
"PENDING",
}
}
type Operation string
// Enum values for Operation
const (
OperationAdd Operation = "ADD"
OperationRemove Operation = "REMOVE"
OperationReplace Operation = "REPLACE"
)
// Values returns all known values for Operation. 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 (Operation) Values() []Operation {
return []Operation{
"ADD",
"REMOVE",
"REPLACE",
}
}
type ResultCode string
// Enum values for ResultCode
const (
ResultCodeSuccess ResultCode = "SUCCESS"
ResultCodeInvalidRoleFailure ResultCode = "INVALID_ROLE_FAILURE"
ResultCodeUnspecifiedFailure ResultCode = "UNSPECIFIED_FAILURE"
)
// Values returns all known values for ResultCode. 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 (ResultCode) Values() []ResultCode {
return []ResultCode{
"SUCCESS",
"INVALID_ROLE_FAILURE",
"UNSPECIFIED_FAILURE",
}
}
type StageState string
// Enum values for StageState
const (
StageStateActive StageState = "ACTIVE"
StageStateDeleting StageState = "DELETING"
)
// Values returns all known values for StageState. 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 (StageState) Values() []StageState {
return []StageState{
"ACTIVE",
"DELETING",
}
}
| 142 |
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
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 resource already exists, or another operation is in progress.
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 }
// The service encountered an internal error.
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 resource specified in the request does not exist.
type ResourceNotFoundException struct {
Message *string
ErrorCodeOverride *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 request would result in exceeding service quota.
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 throughput limit was exceeded.
type ThrottlingException struct {
Message *string
ErrorCodeOverride *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 }
// One of the parameters in the request is invalid.
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 }
| 191 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
"github.com/aws/aws-sdk-go-v2/service/gamesparks/document"
smithydocument "github.com/aws/smithy-go/document"
"time"
)
// Details about a WebSocket connection.
type Connection struct {
// The date and time when the connection was created.
Created *time.Time
// The identifier used to indicate a specific WebSocket connection.
Id *string
noSmithyDocumentSerde
}
// The result of the deployment.
type DeploymentResult struct {
// Details about the deployment result.
Message *string
// The type of deployment result.
ResultCode ResultCode
noSmithyDocumentSerde
}
// Details about the extension.
type ExtensionDetails struct {
// The description of the extension.
Description *string
// The name of the extension.
Name *string
// The namespace (qualifier) of the extension.
Namespace *string
noSmithyDocumentSerde
}
// Details about the extension version.
type ExtensionVersionDetails struct {
// The name of the extension.
Name *string
// The namespace (qualifier) of the extension.
Namespace *string
// The model that defines the interface for this extension version.
Schema *string
// The version of the extension.
Version *string
noSmithyDocumentSerde
}
// Details about the game configuration. The game configuration is organized into
// named sections, where the schema of each section is defined by an extension. The
// schema for these sections can be retrieved using the GetExtensionVersion
// operation.
type GameConfigurationDetails struct {
// The date when the game was created.
Created *time.Time
// The date when the game was last modified.
LastUpdated *time.Time
// Configuration data, organized by section name.
Sections map[string]Section
noSmithyDocumentSerde
}
// Details about a game.
type GameDetails struct {
// The Amazon Resource Name (ARN) of this game.
Arn *string
// The date when the game was created.
Created *time.Time
// The description of the game.
Description *string
// Determines if the game can be deleted.
EnableTerminationProtection bool
// The date when the game was last modified.
LastUpdated *time.Time
// The name of the game.
Name *string
// The state of the game.
State GameState
// The tags associated with the game.
Tags map[string]string
noSmithyDocumentSerde
}
// The summary of the properties of a game.
type GameSummary struct {
// The description of the game.
Description *string
// The name of the game.
Name *string
// The state of the game.
State GameState
// The tags associated with the game.
Tags map[string]string
noSmithyDocumentSerde
}
// Details about a generated code job.
type GeneratedCodeJobDetails struct {
// The description of the generated code job.
Description *string
// The expiration date and time for the download URL. The download URL us
// guaranteed to be available until at least this time.
ExpirationTime *time.Time
// The identifier for the generated code job.
GeneratedCodeJobId *string
// A presigned URL that can be used to download the generated code.
S3Url *string
// The status of the generated code job
Status GeneratedCodeJobState
noSmithyDocumentSerde
}
// Properties that specify the code generator for a generated code job.
type Generator struct {
// The target version of the GameSparks Game SDK.
GameSdkVersion *string
// The programming language for the generated code. Not all languages are
// supported for each platform. For cases where multiple languages are supported,
// this parameter specifies the language to be used. If this value is omitted, the
// default language for the target platform will be used.
Language *string
// The platform that will be used to run the generated code.
TargetPlatform *string
noSmithyDocumentSerde
}
// The source used to import configuration sections.
type ImportGameConfigurationSource struct {
// The JSON string containing the configuration sections.
//
// This member is required.
File []byte
noSmithyDocumentSerde
}
// The configuration section.
type Section struct {
// The content of a configuration section.
Attributes document.Interface
// The name of the section.
Name *string
// The size, in bytes, of the section contents.
Size int32
noSmithyDocumentSerde
}
// A single modification to the configuration section.
type SectionModification struct {
// The operation to be performed on a configuration section. Content can be added,
// deleted, or replaced within a section.
//
// This member is required.
Operation Operation
// The path within the section content to be modified.
//
// This member is required.
Path *string
// The name of the section to be modified.
//
// This member is required.
Section *string
// For add and replace operations, this is the value that will be used. This field
// should be omitted for delete operations.
Value document.Interface
noSmithyDocumentSerde
}
// Properties that provide details of a snapshot.
type SnapshotDetails struct {
// The timestamp of when the snapshot was created.
Created *time.Time
// The description of the snapshot.
Description *string
// The identifier of the snapshot.
Id *string
// The timestamp of when the snapshot was last updated.
LastUpdated *time.Time
// The sections in the snapshot.
Sections map[string]Section
noSmithyDocumentSerde
}
// The summary of the properties of a snapshot.
type SnapshotSummary struct {
// The timestamp of when the snapshot was created.
Created *time.Time
// The description of the snapshot.
Description *string
// The identifier of the snapshot.
Id *string
// Then timestamp of when the snapshot was last updated.
LastUpdated *time.Time
noSmithyDocumentSerde
}
// Properties that provide details of a stage deployment.
type StageDeploymentDetails struct {
// The timestamp of when the stage deployment was created.
Created *time.Time
// The type of action of the stage deployment.
DeploymentAction DeploymentAction
// The identifier of the deployment.
DeploymentId *string
// The result of the deployment.
DeploymentResult *DeploymentResult
// The state of the deployment.
DeploymentState DeploymentState
// The timestamp of when the deployment was last updated.
LastUpdated *time.Time
// The identifier of the snapshot associated with the stage deployment.
SnapshotId *string
noSmithyDocumentSerde
}
// The summary of the properties of a stage deployment.
type StageDeploymentSummary struct {
// The type of action of the deployment.
DeploymentAction DeploymentAction
// The identifier of the deployment.
DeploymentId *string
// The result of the deployment.
DeploymentResult *DeploymentResult
// The state of the deployment.
DeploymentState DeploymentState
// The timestamp of when the deployment was last updated.
LastUpdated *time.Time
// The identifier of the snapshot associated with the stage deployment.
SnapshotId *string
noSmithyDocumentSerde
}
// Properties that provide details of a stage.
type StageDetails struct {
// The Amazon Resource Name (ARN) of the stage.
Arn *string
// The timestamp of when the stage was created.
Created *time.Time
// The description of the stage.
Description *string
// The game key associated with the stage. The game key is a unique identifier
// that the game client uses to connect to the GameSparks backend.
GameKey *string
// The timestamp of when the stage was last updated.
LastUpdated *time.Time
// The Amazon CloudWatch log group for game runtimes deployed to the stage.
LogGroup *string
// The name of the stage.
Name *string
// The Amazon Resource Name (ARN) of the role used to run the game runtimes
// deployed to the stage.
Role *string
// The state of the stage.
State StageState
// The tags associated with the stage.
Tags map[string]string
noSmithyDocumentSerde
}
// The summary of the properties of a stage.
type StageSummary struct {
// The description of the stage.
Description *string
// The game key associated with the stage. The game key is a unique identifier
// that the game client uses to connect to the GameSparks backend.
GameKey *string
// The name of the stage.
Name *string
// The state of the stage.
State StageState
// The tags associated with the stage.
Tags map[string]string
noSmithyDocumentSerde
}
type noSmithyDocumentSerde = smithydocument.NoSerde
| 377 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
"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"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net"
"net/http"
"time"
)
const ServiceID = "Glacier"
const ServiceAPIVersion = "2012-06-01"
// Client provides the API client to make operations call for Amazon Glacier.
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)
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
// 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, "glacier", 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 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
}
func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error {
return awsmiddleware.AddRequestIDRetrieverMiddleware(stack)
}
func addResponseErrorMiddleware(stack *middleware.Stack) error {
return awshttp.AddResponseErrorMiddleware(stack)
}
// setDefaultAccountID sets the AccountID to the given value if the current value
// is nil
func setDefaultAccountID(input interface{}, accountID string) interface{} {
switch i := input.(type) {
case *AbortMultipartUploadInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *AbortVaultLockInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *AddTagsToVaultInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *CompleteMultipartUploadInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *CompleteVaultLockInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *CreateVaultInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *DeleteArchiveInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *DeleteVaultInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *DeleteVaultAccessPolicyInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *DeleteVaultNotificationsInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *DescribeJobInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *DescribeVaultInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *GetDataRetrievalPolicyInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *GetJobOutputInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *GetVaultAccessPolicyInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *GetVaultLockInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *GetVaultNotificationsInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *InitiateJobInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *InitiateMultipartUploadInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *InitiateVaultLockInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *ListJobsInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *ListMultipartUploadsInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *ListPartsInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *ListProvisionedCapacityInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *ListTagsForVaultInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *ListVaultsInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *PurchaseProvisionedCapacityInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *RemoveTagsFromVaultInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *SetDataRetrievalPolicyInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *SetVaultAccessPolicyInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *SetVaultNotificationsInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *UploadArchiveInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
case *UploadMultipartPartInput:
if i.AccountId == nil {
i.AccountId = &accountID
}
return i
default:
return input
}
}
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)
}
| 641 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
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 glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation aborts a multipart upload identified by the upload ID. After the
// Abort Multipart Upload request succeeds, you cannot upload any more parts to the
// multipart upload or complete the multipart upload. Aborting a completed upload
// fails. However, aborting an already-aborted upload will succeed, for a short
// time. For more information about uploading a part and completing a multipart
// upload, see UploadMultipartPart and CompleteMultipartUpload . This operation is
// idempotent. An AWS account has full permission to perform all operations
// (actions). However, AWS Identity and Access Management (IAM) users don't have
// any permissions by default. You must grant them explicit permission to perform
// specific actions. For more information, see Access Control Using AWS Identity
// and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Working with Archives
// in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html)
// and Abort Multipart Upload (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-abort-upload.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) AbortMultipartUpload(ctx context.Context, params *AbortMultipartUploadInput, optFns ...func(*Options)) (*AbortMultipartUploadOutput, error) {
if params == nil {
params = &AbortMultipartUploadInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AbortMultipartUpload", params, optFns, c.addOperationAbortMultipartUploadMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AbortMultipartUploadOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options to abort a multipart upload identified by the upload ID. For
// information about the underlying REST API, see Abort Multipart Upload (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-abort-upload.html)
// . For conceptual information, see Working with Archives in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html)
// .
type AbortMultipartUploadInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The upload ID of the multipart upload to delete.
//
// This member is required.
UploadId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
type AbortMultipartUploadOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAbortMultipartUploadMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpAbortMultipartUpload{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAbortMultipartUpload{}, 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 = addOpAbortMultipartUploadValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAbortMultipartUpload(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAbortMultipartUpload(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "AbortMultipartUpload",
}
}
| 162 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation aborts the vault locking process if the vault lock is not in the
// Locked state. If the vault lock is in the Locked state when this operation is
// requested, the operation returns an AccessDeniedException error. Aborting the
// vault locking process removes the vault lock policy from the specified vault. A
// vault lock is put into the InProgress state by calling InitiateVaultLock . A
// vault lock is put into the Locked state by calling CompleteVaultLock . You can
// get the state of a vault lock by calling GetVaultLock . For more information
// about the vault locking process, see Amazon Glacier Vault Lock (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html)
// . For more information about vault lock policies, see Amazon Glacier Access
// Control with Vault Lock Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html)
// . This operation is idempotent. You can successfully invoke this operation
// multiple times, if the vault lock is in the InProgress state or if there is no
// policy associated with the vault.
func (c *Client) AbortVaultLock(ctx context.Context, params *AbortVaultLockInput, optFns ...func(*Options)) (*AbortVaultLockOutput, error) {
if params == nil {
params = &AbortVaultLockInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AbortVaultLock", params, optFns, c.addOperationAbortVaultLockMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AbortVaultLockOutput)
out.ResultMetadata = metadata
return out, nil
}
// The input values for AbortVaultLock .
type AbortVaultLockInput struct {
// The AccountId value is the AWS account ID. This value must match the AWS
// account ID associated with the credentials used to sign the request. You can
// either specify an AWS account ID or optionally a single ' - ' (hyphen), in which
// case Amazon Glacier uses the AWS account ID associated with the credentials used
// to sign the request. If you specify your account ID, do not include any hyphens
// ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
type AbortVaultLockOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAbortVaultLockMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpAbortVaultLock{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAbortVaultLock{}, 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 = addOpAbortVaultLockValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAbortVaultLock(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAbortVaultLock(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "AbortVaultLock",
}
}
| 153 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation adds the specified tags to a vault. Each tag is composed of a
// key and a value. Each vault can have up to 10 tags. If your request would cause
// the tag limit for the vault to be exceeded, the operation throws the
// LimitExceededException error. If a tag already exists on the vault under a
// specified key, the existing key value will be overwritten. For more information
// about tags, see Tagging Amazon S3 Glacier Resources (https://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html)
// .
func (c *Client) AddTagsToVault(ctx context.Context, params *AddTagsToVaultInput, optFns ...func(*Options)) (*AddTagsToVaultOutput, error) {
if params == nil {
params = &AddTagsToVaultInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AddTagsToVault", params, optFns, c.addOperationAddTagsToVaultMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AddTagsToVaultOutput)
out.ResultMetadata = metadata
return out, nil
}
// The input values for AddTagsToVault .
type AddTagsToVaultInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The tags to add to the vault. Each tag is composed of a key and a value. The
// value can be an empty string.
Tags map[string]string
noSmithyDocumentSerde
}
type AddTagsToVaultOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAddTagsToVaultMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpAddTagsToVault{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAddTagsToVault{}, 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 = addOpAddTagsToVaultValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddTagsToVault(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opAddTagsToVault(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "AddTagsToVault",
}
}
| 150 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// You call this operation to inform Amazon S3 Glacier (Glacier) that all the
// archive parts have been uploaded and that Glacier can now assemble the archive
// from the uploaded parts. After assembling and saving the archive to the vault,
// Glacier returns the URI path of the newly created archive resource. Using the
// URI path, you can then access the archive. After you upload an archive, you
// should save the archive ID returned to retrieve the archive at a later point.
// You can also get the vault inventory to obtain a list of archive IDs in a vault.
// For more information, see InitiateJob . In the request, you must include the
// computed SHA256 tree hash of the entire archive you have uploaded. For
// information about computing a SHA256 tree hash, see Computing Checksums (https://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html)
// . On the server side, Glacier also constructs the SHA256 tree hash of the
// assembled archive. If the values match, Glacier saves the archive to the vault;
// otherwise, it returns an error, and the operation fails. The ListParts
// operation returns a list of parts uploaded for a specific multipart upload. It
// includes checksum information for each uploaded part that can be used to debug a
// bad checksum issue. Additionally, Glacier also checks for any missing content
// ranges when assembling the archive, if missing content ranges are found, Glacier
// returns an error and the operation fails. Complete Multipart Upload is an
// idempotent operation. After your first successful complete multipart upload, if
// you call the operation again within a short period, the operation will succeed
// and return the same archive ID. This is useful in the event you experience a
// network issue that causes an aborted connection or receive a 500 server error,
// in which case you can repeat your Complete Multipart Upload request and get the
// same archive ID without creating duplicate archives. Note, however, that after
// the multipart upload completes, you cannot call the List Parts operation and the
// multipart upload will not appear in List Multipart Uploads response, even if
// idempotent complete is possible. An AWS account has full permission to perform
// all operations (actions). However, AWS Identity and Access Management (IAM)
// users don't have any permissions by default. You must grant them explicit
// permission to perform specific actions. For more information, see Access
// Control Using AWS Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Uploading Large
// Archives in Parts (Multipart Upload) (https://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html)
// and Complete Multipart Upload (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-complete-upload.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) CompleteMultipartUpload(ctx context.Context, params *CompleteMultipartUploadInput, optFns ...func(*Options)) (*CompleteMultipartUploadOutput, error) {
if params == nil {
params = &CompleteMultipartUploadInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CompleteMultipartUpload", params, optFns, c.addOperationCompleteMultipartUploadMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CompleteMultipartUploadOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options to complete a multipart upload operation. This informs Amazon
// Glacier that all the archive parts have been uploaded and Amazon S3 Glacier
// (Glacier) can now assemble the archive from the uploaded parts. After assembling
// and saving the archive to the vault, Glacier returns the URI path of the newly
// created archive resource.
type CompleteMultipartUploadInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The upload ID of the multipart upload.
//
// This member is required.
UploadId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The total size, in bytes, of the entire archive. This value should be the sum
// of all the sizes of the individual parts that you uploaded.
ArchiveSize *string
// The SHA256 tree hash of the entire archive. It is the tree hash of SHA256 tree
// hash of the individual parts. If the value you specify in the request does not
// match the SHA256 tree hash of the final assembled archive as computed by Amazon
// S3 Glacier (Glacier), Glacier returns an error and the request fails.
Checksum *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request. For information about
// the underlying REST API, see Upload Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-post.html)
// . For conceptual information, see Working with Archives in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html)
// .
type CompleteMultipartUploadOutput struct {
// The ID of the archive. This value is also included as part of the location.
ArchiveId *string
// The checksum of the archive computed by Amazon S3 Glacier.
Checksum *string
// The relative URI path of the newly added archive resource.
Location *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCompleteMultipartUploadMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpCompleteMultipartUpload{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCompleteMultipartUpload{}, 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 = addOpCompleteMultipartUploadValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCompleteMultipartUpload(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCompleteMultipartUpload(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "CompleteMultipartUpload",
}
}
| 207 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation completes the vault locking process by transitioning the vault
// lock from the InProgress state to the Locked state, which causes the vault lock
// policy to become unchangeable. A vault lock is put into the InProgress state by
// calling InitiateVaultLock . You can obtain the state of the vault lock by
// calling GetVaultLock . For more information about the vault locking process,
// Amazon Glacier Vault Lock (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html)
// . This operation is idempotent. This request is always successful if the vault
// lock is in the Locked state and the provided lock ID matches the lock ID
// originally used to lock the vault. If an invalid lock ID is passed in the
// request when the vault lock is in the Locked state, the operation returns an
// AccessDeniedException error. If an invalid lock ID is passed in the request when
// the vault lock is in the InProgress state, the operation throws an
// InvalidParameter error.
func (c *Client) CompleteVaultLock(ctx context.Context, params *CompleteVaultLockInput, optFns ...func(*Options)) (*CompleteVaultLockOutput, error) {
if params == nil {
params = &CompleteVaultLockInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CompleteVaultLock", params, optFns, c.addOperationCompleteVaultLockMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CompleteVaultLockOutput)
out.ResultMetadata = metadata
return out, nil
}
// The input values for CompleteVaultLock .
type CompleteVaultLockInput struct {
// The AccountId value is the AWS account ID. This value must match the AWS
// account ID associated with the credentials used to sign the request. You can
// either specify an AWS account ID or optionally a single ' - ' (hyphen), in which
// case Amazon Glacier uses the AWS account ID associated with the credentials used
// to sign the request. If you specify your account ID, do not include any hyphens
// ('-') in the ID.
//
// This member is required.
AccountId *string
// The lockId value is the lock ID obtained from a InitiateVaultLock request.
//
// This member is required.
LockId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
type CompleteVaultLockOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCompleteVaultLockMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpCompleteVaultLock{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCompleteVaultLock{}, 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 = addOpCompleteVaultLockValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCompleteVaultLock(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCompleteVaultLock(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "CompleteVaultLock",
}
}
| 158 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation creates a new vault with the specified name. The name of the
// vault must be unique within a region for an AWS account. You can create up to
// 1,000 vaults per account. If you need to create more vaults, contact Amazon S3
// Glacier. You must use the following guidelines when naming a vault.
// - Names can be between 1 and 255 characters long.
// - Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), and
// '.' (period).
//
// This operation is idempotent. An AWS account has full permission to perform all
// operations (actions). However, AWS Identity and Access Management (IAM) users
// don't have any permissions by default. You must grant them explicit permission
// to perform specific actions. For more information, see Access Control Using AWS
// Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Creating a Vault in
// Amazon Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/creating-vaults.html)
// and Create Vault (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-put.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) CreateVault(ctx context.Context, params *CreateVaultInput, optFns ...func(*Options)) (*CreateVaultOutput, error) {
if params == nil {
params = &CreateVaultInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateVault", params, optFns, c.addOperationCreateVaultMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateVaultOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options to create a vault.
type CreateVaultInput struct {
// The AccountId value is the AWS account ID. This value must match the AWS
// account ID associated with the credentials used to sign the request. You can
// either specify an AWS account ID or optionally a single ' - ' (hyphen), in which
// case Amazon S3 Glacier uses the AWS account ID associated with the credentials
// used to sign the request. If you specify your account ID, do not include any
// hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type CreateVaultOutput struct {
// The URI of the vault that was created.
Location *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateVaultMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateVault{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateVault{}, 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 = addOpCreateVaultValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateVault(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opCreateVault(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "CreateVault",
}
}
| 162 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation deletes an archive from a vault. Subsequent requests to initiate
// a retrieval of this archive will fail. Archive retrievals that are in progress
// for this archive ID may or may not succeed according to the following scenarios:
//
// - If the archive retrieval job is actively preparing the data for download
// when Amazon S3 Glacier receives the delete archive request, the archival
// retrieval operation might fail.
// - If the archive retrieval job has successfully prepared the archive for
// download when Amazon S3 Glacier receives the delete archive request, you will be
// able to download the output.
//
// This operation is idempotent. Attempting to delete an already-deleted archive
// does not result in an error. An AWS account has full permission to perform all
// operations (actions). However, AWS Identity and Access Management (IAM) users
// don't have any permissions by default. You must grant them explicit permission
// to perform specific actions. For more information, see Access Control Using AWS
// Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Deleting an Archive
// in Amazon Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-an-archive.html)
// and Delete Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) DeleteArchive(ctx context.Context, params *DeleteArchiveInput, optFns ...func(*Options)) (*DeleteArchiveOutput, error) {
if params == nil {
params = &DeleteArchiveInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteArchive", params, optFns, c.addOperationDeleteArchiveMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteArchiveOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for deleting an archive from an Amazon S3 Glacier vault.
type DeleteArchiveInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The ID of the archive to delete.
//
// This member is required.
ArchiveId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
type DeleteArchiveOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteArchiveMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteArchive{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteArchive{}, 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 = addOpDeleteArchiveValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteArchive(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteArchive(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "DeleteArchive",
}
}
| 165 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation deletes a vault. Amazon S3 Glacier will delete a vault only if
// there are no archives in the vault as of the last inventory and there have been
// no writes to the vault since the last inventory. If either of these conditions
// is not satisfied, the vault deletion fails (that is, the vault is not removed)
// and Amazon S3 Glacier returns an error. You can use DescribeVault to return the
// number of archives in a vault, and you can use Initiate a Job (POST jobs) (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html)
// to initiate a new inventory retrieval for a vault. The inventory contains the
// archive IDs you use to delete archives using Delete Archive (DELETE archive) (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-delete.html)
// . This operation is idempotent. An AWS account has full permission to perform
// all operations (actions). However, AWS Identity and Access Management (IAM)
// users don't have any permissions by default. You must grant them explicit
// permission to perform specific actions. For more information, see Access
// Control Using AWS Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Deleting a Vault in
// Amazon Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/deleting-vaults.html)
// and Delete Vault (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-delete.html)
// in the Amazon S3 Glacier Developer Guide.
func (c *Client) DeleteVault(ctx context.Context, params *DeleteVaultInput, optFns ...func(*Options)) (*DeleteVaultOutput, error) {
if params == nil {
params = &DeleteVaultInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteVault", params, optFns, c.addOperationDeleteVaultMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteVaultOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for deleting a vault from Amazon S3 Glacier.
type DeleteVaultInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
type DeleteVaultOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteVaultMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteVault{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteVault{}, 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 = addOpDeleteVaultValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteVault(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteVault(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "DeleteVault",
}
}
| 156 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation deletes the access policy associated with the specified vault.
// The operation is eventually consistent; that is, it might take some time for
// Amazon S3 Glacier to completely remove the access policy, and you might still
// see the effect of the policy for a short time after you send the delete request.
// This operation is idempotent. You can invoke delete multiple times, even if
// there is no policy associated with the vault. For more information about vault
// access policies, see Amazon Glacier Access Control with Vault Access Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html)
// .
func (c *Client) DeleteVaultAccessPolicy(ctx context.Context, params *DeleteVaultAccessPolicyInput, optFns ...func(*Options)) (*DeleteVaultAccessPolicyOutput, error) {
if params == nil {
params = &DeleteVaultAccessPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteVaultAccessPolicy", params, optFns, c.addOperationDeleteVaultAccessPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteVaultAccessPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
// DeleteVaultAccessPolicy input.
type DeleteVaultAccessPolicyInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
type DeleteVaultAccessPolicyOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteVaultAccessPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteVaultAccessPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteVaultAccessPolicy{}, 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 = addOpDeleteVaultAccessPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteVaultAccessPolicy(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteVaultAccessPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "DeleteVaultAccessPolicy",
}
}
| 147 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation deletes the notification configuration set for a vault. The
// operation is eventually consistent; that is, it might take some time for Amazon
// S3 Glacier to completely disable the notifications and you might still receive
// some notifications for a short time after you send the delete request. An AWS
// account has full permission to perform all operations (actions). However, AWS
// Identity and Access Management (IAM) users don't have any permissions by
// default. You must grant them explicit permission to perform specific actions.
// For more information, see Access Control Using AWS Identity and Access
// Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Configuring Vault
// Notifications in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html)
// and Delete Vault Notification Configuration (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-delete.html)
// in the Amazon S3 Glacier Developer Guide.
func (c *Client) DeleteVaultNotifications(ctx context.Context, params *DeleteVaultNotificationsInput, optFns ...func(*Options)) (*DeleteVaultNotificationsOutput, error) {
if params == nil {
params = &DeleteVaultNotificationsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteVaultNotifications", params, optFns, c.addOperationDeleteVaultNotificationsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteVaultNotificationsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for deleting a vault notification configuration from an Amazon
// Glacier vault.
type DeleteVaultNotificationsInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
type DeleteVaultNotificationsOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteVaultNotificationsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteVaultNotifications{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteVaultNotifications{}, 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 = addOpDeleteVaultNotificationsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteVaultNotifications(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDeleteVaultNotifications(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "DeleteVaultNotifications",
}
}
| 153 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation returns information about a job you previously initiated,
// including the job initiation date, the user who initiated the job, the job
// status code/message and the Amazon SNS topic to notify after Amazon S3 Glacier
// (Glacier) completes the job. For more information about initiating a job, see
// InitiateJob . This operation enables you to check the status of your job.
// However, it is strongly recommended that you set up an Amazon SNS topic and
// specify it in your initiate job request so that Glacier can notify the topic
// after it completes the job. A job ID will not expire for at least 24 hours after
// Glacier completes the job. An AWS account has full permission to perform all
// operations (actions). However, AWS Identity and Access Management (IAM) users
// don't have any permissions by default. You must grant them explicit permission
// to perform specific actions. For more information, see Access Control Using AWS
// Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For more information about using this operation, see the documentation for the
// underlying REST API Describe Job (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-describe-job-get.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) DescribeJob(ctx context.Context, params *DescribeJobInput, optFns ...func(*Options)) (*DescribeJobOutput, error) {
if params == nil {
params = &DescribeJobInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeJob", params, optFns, c.addOperationDescribeJobMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeJobOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for retrieving a job description.
type DescribeJobInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The ID of the job to describe.
//
// This member is required.
JobId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
// Contains the description of an Amazon S3 Glacier job.
type DescribeJobOutput struct {
// The job type. This value is either ArchiveRetrieval , InventoryRetrieval , or
// Select .
Action types.ActionCode
// The archive ID requested for a select job or archive retrieval. Otherwise, this
// field is null.
ArchiveId *string
// The SHA256 tree hash of the entire archive for an archive retrieval. For
// inventory retrieval or select jobs, this field is null.
ArchiveSHA256TreeHash *string
// For an archive retrieval job, this value is the size in bytes of the archive
// being requested for download. For an inventory retrieval or select job, this
// value is null.
ArchiveSizeInBytes *int64
// The job status. When a job is completed, you get the job's output using Get Job
// Output (GET output).
Completed bool
// The UTC time that the job request completed. While the job is in progress, the
// value is null.
CompletionDate *string
// The UTC date when the job was created. This value is a string representation of
// ISO 8601 date format, for example "2012-03-20T17:03:43.221Z" .
CreationDate *string
// Parameters used for range inventory retrieval.
InventoryRetrievalParameters *types.InventoryRetrievalJobDescription
// For an inventory retrieval job, this value is the size in bytes of the
// inventory requested for download. For an archive retrieval or select job, this
// value is null.
InventorySizeInBytes *int64
// The job description provided when initiating the job.
JobDescription *string
// An opaque string that identifies an Amazon S3 Glacier job.
JobId *string
// Contains the job output location.
JobOutputPath *string
// Contains the location where the data from the select job is stored.
OutputLocation *types.OutputLocation
// The retrieved byte range for archive retrieval jobs in the form
// StartByteValue-EndByteValue. If no range was specified in the archive retrieval,
// then the whole archive is retrieved. In this case, StartByteValue equals 0 and
// EndByteValue equals the size of the archive minus 1. For inventory retrieval or
// select jobs, this field is null.
RetrievalByteRange *string
// For an archive retrieval job, this value is the checksum of the archive.
// Otherwise, this value is null. The SHA256 tree hash value for the requested
// range of an archive. If the InitiateJob request for an archive specified a
// tree-hash aligned range, then this field returns a value. If the whole archive
// is retrieved, this value is the same as the ArchiveSHA256TreeHash value. This
// field is null for the following:
// - Archive retrieval jobs that specify a range that is not tree-hash aligned
//
// - Archival jobs that specify a range that is equal to the whole archive, when
// the job status is InProgress
//
// - Inventory jobs
// - Select jobs
SHA256TreeHash *string
// An Amazon SNS topic that receives notification.
SNSTopic *string
// Contains the parameters used for a select.
SelectParameters *types.SelectParameters
// The status code can be InProgress , Succeeded , or Failed , and indicates the
// status of the job.
StatusCode types.StatusCode
// A friendly message that describes the job status.
StatusMessage *string
// The tier to use for a select or an archive retrieval. Valid values are Expedited
// , Standard , or Bulk . Standard is the default.
Tier *string
// The Amazon Resource Name (ARN) of the vault from which an archive retrieval was
// requested.
VaultARN *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpDescribeJob{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDescribeJob{}, 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 = addOpDescribeJobValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeJob(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opDescribeJob(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "DescribeJob",
}
}
| 255 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
"errors"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/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"
"time"
)
// This operation returns information about a vault, including the vault's Amazon
// Resource Name (ARN), the date the vault was created, the number of archives it
// contains, and the total size of all the archives in the vault. The number of
// archives and their total size are as of the last inventory generation. This
// means that if you add or remove an archive from a vault, and then immediately
// use Describe Vault, the change in contents will not be immediately reflected. If
// you want to retrieve the latest inventory of the vault, use InitiateJob . Amazon
// S3 Glacier generates vault inventories approximately daily. For more
// information, see Downloading a Vault Inventory in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html)
// . An AWS account has full permission to perform all operations (actions).
// However, AWS Identity and Access Management (IAM) users don't have any
// permissions by default. You must grant them explicit permission to perform
// specific actions. For more information, see Access Control Using AWS Identity
// and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Retrieving Vault
// Metadata in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/retrieving-vault-info.html)
// and Describe Vault (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-get.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) DescribeVault(ctx context.Context, params *DescribeVaultInput, optFns ...func(*Options)) (*DescribeVaultOutput, error) {
if params == nil {
params = &DescribeVaultInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeVault", params, optFns, c.addOperationDescribeVaultMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeVaultOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for retrieving metadata for a specific vault in Amazon Glacier.
type DescribeVaultInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type DescribeVaultOutput struct {
// The Universal Coordinated Time (UTC) date when the vault was created. This
// value should be a string in the ISO 8601 date format, for example
// 2012-03-20T17:03:43.221Z .
CreationDate *string
// The Universal Coordinated Time (UTC) date when Amazon S3 Glacier completed the
// last vault inventory. This value should be a string in the ISO 8601 date format,
// for example 2012-03-20T17:03:43.221Z .
LastInventoryDate *string
// The number of archives in the vault as of the last inventory date. This field
// will return null if an inventory has not yet run on the vault, for example if
// you just created the vault.
NumberOfArchives int64
// Total size, in bytes, of the archives in the vault as of the last inventory
// date. This field will return null if an inventory has not yet run on the vault,
// for example if you just created the vault.
SizeInBytes int64
// The Amazon Resource Name (ARN) of the vault.
VaultARN *string
// The name of the vault.
VaultName *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeVaultMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpDescribeVault{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDescribeVault{}, 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 = addOpDescribeVaultValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeVault(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// DescribeVaultAPIClient is a client that implements the DescribeVault operation.
type DescribeVaultAPIClient interface {
DescribeVault(context.Context, *DescribeVaultInput, ...func(*Options)) (*DescribeVaultOutput, error)
}
var _ DescribeVaultAPIClient = (*Client)(nil)
// VaultExistsWaiterOptions are waiter options for VaultExistsWaiter
type VaultExistsWaiterOptions 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,
// VaultExistsWaiter will use default minimum delay of 3 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, VaultExistsWaiter 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, *DescribeVaultInput, *DescribeVaultOutput, error) (bool, error)
}
// VaultExistsWaiter defines the waiters for VaultExists
type VaultExistsWaiter struct {
client DescribeVaultAPIClient
options VaultExistsWaiterOptions
}
// NewVaultExistsWaiter constructs a VaultExistsWaiter.
func NewVaultExistsWaiter(client DescribeVaultAPIClient, optFns ...func(*VaultExistsWaiterOptions)) *VaultExistsWaiter {
options := VaultExistsWaiterOptions{}
options.MinDelay = 3 * time.Second
options.MaxDelay = 120 * time.Second
options.Retryable = vaultExistsStateRetryable
for _, fn := range optFns {
fn(&options)
}
return &VaultExistsWaiter{
client: client,
options: options,
}
}
// Wait calls the waiter function for VaultExists waiter. The maxWaitDur is the
// maximum wait duration the waiter will wait. The maxWaitDur is required and must
// be greater than zero.
func (w *VaultExistsWaiter) Wait(ctx context.Context, params *DescribeVaultInput, maxWaitDur time.Duration, optFns ...func(*VaultExistsWaiterOptions)) error {
_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)
return err
}
// WaitForOutput calls the waiter function for VaultExists 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 *VaultExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeVaultInput, maxWaitDur time.Duration, optFns ...func(*VaultExistsWaiterOptions)) (*DescribeVaultOutput, 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.DescribeVault(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 VaultExists waiter")
}
func vaultExistsStateRetryable(ctx context.Context, input *DescribeVaultInput, output *DescribeVaultOutput, err error) (bool, error) {
if err == nil {
return false, nil
}
if err != nil {
var errorType *types.ResourceNotFoundException
if errors.As(err, &errorType) {
return true, nil
}
}
return true, nil
}
// VaultNotExistsWaiterOptions are waiter options for VaultNotExistsWaiter
type VaultNotExistsWaiterOptions 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,
// VaultNotExistsWaiter will use default minimum delay of 3 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, VaultNotExistsWaiter 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, *DescribeVaultInput, *DescribeVaultOutput, error) (bool, error)
}
// VaultNotExistsWaiter defines the waiters for VaultNotExists
type VaultNotExistsWaiter struct {
client DescribeVaultAPIClient
options VaultNotExistsWaiterOptions
}
// NewVaultNotExistsWaiter constructs a VaultNotExistsWaiter.
func NewVaultNotExistsWaiter(client DescribeVaultAPIClient, optFns ...func(*VaultNotExistsWaiterOptions)) *VaultNotExistsWaiter {
options := VaultNotExistsWaiterOptions{}
options.MinDelay = 3 * time.Second
options.MaxDelay = 120 * time.Second
options.Retryable = vaultNotExistsStateRetryable
for _, fn := range optFns {
fn(&options)
}
return &VaultNotExistsWaiter{
client: client,
options: options,
}
}
// Wait calls the waiter function for VaultNotExists waiter. The maxWaitDur is the
// maximum wait duration the waiter will wait. The maxWaitDur is required and must
// be greater than zero.
func (w *VaultNotExistsWaiter) Wait(ctx context.Context, params *DescribeVaultInput, maxWaitDur time.Duration, optFns ...func(*VaultNotExistsWaiterOptions)) error {
_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)
return err
}
// WaitForOutput calls the waiter function for VaultNotExists 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 *VaultNotExistsWaiter) WaitForOutput(ctx context.Context, params *DescribeVaultInput, maxWaitDur time.Duration, optFns ...func(*VaultNotExistsWaiterOptions)) (*DescribeVaultOutput, 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.DescribeVault(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 VaultNotExists waiter")
}
func vaultNotExistsStateRetryable(ctx context.Context, input *DescribeVaultInput, output *DescribeVaultOutput, err error) (bool, error) {
if err == nil {
return true, nil
}
if err != nil {
var errorType *types.ResourceNotFoundException
if errors.As(err, &errorType) {
return false, nil
}
}
return true, nil
}
func newServiceMetadataMiddleware_opDescribeVault(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "DescribeVault",
}
}
| 505 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation returns the current data retrieval policy for the account and
// region specified in the GET request. For more information about data retrieval
// policies, see Amazon Glacier Data Retrieval Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/data-retrieval-policy.html)
// .
func (c *Client) GetDataRetrievalPolicy(ctx context.Context, params *GetDataRetrievalPolicyInput, optFns ...func(*Options)) (*GetDataRetrievalPolicyOutput, error) {
if params == nil {
params = &GetDataRetrievalPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetDataRetrievalPolicy", params, optFns, c.addOperationGetDataRetrievalPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetDataRetrievalPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
// Input for GetDataRetrievalPolicy.
type GetDataRetrievalPolicyInput struct {
// The AccountId value is the AWS account ID. This value must match the AWS
// account ID associated with the credentials used to sign the request. You can
// either specify an AWS account ID or optionally a single ' - ' (hyphen), in which
// case Amazon Glacier uses the AWS account ID associated with the credentials used
// to sign the request. If you specify your account ID, do not include any hyphens
// ('-') in the ID.
//
// This member is required.
AccountId *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to the GetDataRetrievalPolicy request.
type GetDataRetrievalPolicyOutput struct {
// Contains the returned data retrieval policy in JSON format.
Policy *types.DataRetrievalPolicy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetDataRetrievalPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetDataRetrievalPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetDataRetrievalPolicy{}, 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 = addOpGetDataRetrievalPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDataRetrievalPolicy(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetDataRetrievalPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "GetDataRetrievalPolicy",
}
}
| 145 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
)
// This operation downloads the output of the job you initiated using InitiateJob .
// Depending on the job type you specified when you initiated the job, the output
// will be either the content of an archive or a vault inventory. You can download
// all the job output or download a portion of the output by specifying a byte
// range. In the case of an archive retrieval job, depending on the byte range you
// specify, Amazon S3 Glacier (Glacier) returns the checksum for the portion of the
// data. You can compute the checksum on the client and verify that the values
// match to ensure the portion you downloaded is the correct data. A job ID will
// not expire for at least 24 hours after Glacier completes the job. That a byte
// range. For both archive and inventory retrieval jobs, you should verify the
// downloaded size against the size returned in the headers from the Get Job Output
// response. For archive retrieval jobs, you should also verify that the size is
// what you expected. If you download a portion of the output, the expected size is
// based on the range of bytes you specified. For example, if you specify a range
// of bytes=0-1048575 , you should verify your download size is 1,048,576 bytes. If
// you download an entire archive, the expected size is the size of the archive
// when you uploaded it to Amazon S3 Glacier The expected size is also returned in
// the headers from the Get Job Output response. In the case of an archive
// retrieval job, depending on the byte range you specify, Glacier returns the
// checksum for the portion of the data. To ensure the portion you downloaded is
// the correct data, compute the checksum on the client, verify that the values
// match, and verify that the size is what you expected. A job ID does not expire
// for at least 24 hours after Glacier completes the job. That is, you can download
// the job output within the 24 hours period after Amazon Glacier completes the
// job. An AWS account has full permission to perform all operations (actions).
// However, AWS Identity and Access Management (IAM) users don't have any
// permissions by default. You must grant them explicit permission to perform
// specific actions. For more information, see Access Control Using AWS Identity
// and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and the underlying REST API, see Downloading a
// Vault Inventory (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-inventory.html)
// , Downloading an Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/downloading-an-archive.html)
// , and Get Job Output (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-job-output-get.html)
func (c *Client) GetJobOutput(ctx context.Context, params *GetJobOutputInput, optFns ...func(*Options)) (*GetJobOutputOutput, error) {
if params == nil {
params = &GetJobOutputInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetJobOutput", params, optFns, c.addOperationGetJobOutputMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetJobOutputOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for downloading output of an Amazon S3 Glacier job.
type GetJobOutputInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The job ID whose data is downloaded.
//
// This member is required.
JobId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The range of bytes to retrieve from the output. For example, if you want to
// download the first 1,048,576 bytes, specify the range as bytes=0-1048575 . By
// default, this operation downloads the entire output. If the job output is large,
// then you can use a range to retrieve a portion of the output. This allows you to
// download the entire output in smaller chunks of bytes. For example, suppose you
// have 1 GB of job output you want to download and you decide to download 128 MB
// chunks of data at a time, which is a total of eight Get Job Output requests. You
// use the following process to download the job output:
// - Download a 128 MB chunk of output by specifying the appropriate byte range.
// Verify that all 128 MB of data was received.
// - Along with the data, the response includes a SHA256 tree hash of the
// payload. You compute the checksum of the payload on the client and compare it
// with the checksum you received in the response to ensure you received all the
// expected data.
// - Repeat steps 1 and 2 for all the eight 128 MB chunks of output data, each
// time specifying the appropriate byte range.
// - After downloading all the parts of the job output, you have a list of eight
// checksum values. Compute the tree hash of these values to find the checksum of
// the entire output. Using the DescribeJob API, obtain job information of the
// job that provided you the output. The response includes the checksum of the
// entire archive stored in Amazon S3 Glacier. You compare this value with the
// checksum you computed to ensure you have downloaded the entire archive content
// with no errors.
Range *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type GetJobOutputOutput struct {
// Indicates the range units accepted. For more information, see RFC2616 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)
// .
AcceptRanges *string
// The description of an archive.
ArchiveDescription *string
// The job data, either archive data or inventory data.
Body io.ReadCloser
// The checksum of the data in the response. This header is returned only when
// retrieving the output for an archive retrieval job. Furthermore, this header
// appears only under the following conditions:
// - You get the entire range of the archive.
// - You request a range to return of the archive that starts and ends on a
// multiple of 1 MB. For example, if you have an 3.1 MB archive and you specify a
// range to return that starts at 1 MB and ends at 2 MB, then the
// x-amz-sha256-tree-hash is returned as a response header.
// - You request a range of the archive to return that starts on a multiple of 1
// MB and goes to the end of the archive. For example, if you have a 3.1 MB archive
// and you specify a range that starts at 2 MB and ends at 3.1 MB (the end of the
// archive), then the x-amz-sha256-tree-hash is returned as a response header.
Checksum *string
// The range of bytes returned by Amazon S3 Glacier. If only partial output is
// downloaded, the response provides the range of bytes Amazon S3 Glacier returned.
// For example, bytes 0-1048575/8388608 returns the first 1 MB from 8 MB.
ContentRange *string
// The Content-Type depends on whether the job output is an archive or a vault
// inventory. For archive data, the Content-Type is application/octet-stream. For
// vault inventory, if you requested CSV format when you initiated the job, the
// Content-Type is text/csv. Otherwise, by default, vault inventory is returned as
// JSON, and the Content-Type is application/json.
ContentType *string
// The HTTP response code for a job output request. The value depends on whether a
// range was specified in the request.
Status int32
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetJobOutputMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetJobOutput{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetJobOutput{}, 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 = addOpGetJobOutputValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetJobOutput(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetJobOutput(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "GetJobOutput",
}
}
| 242 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation retrieves the access-policy subresource set on the vault; for
// more information on setting this subresource, see Set Vault Access Policy (PUT
// access-policy) (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-SetVaultAccessPolicy.html)
// . If there is no access policy set on the vault, the operation returns a 404
// Not found error. For more information about vault access policies, see Amazon
// Glacier Access Control with Vault Access Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html)
// .
func (c *Client) GetVaultAccessPolicy(ctx context.Context, params *GetVaultAccessPolicyInput, optFns ...func(*Options)) (*GetVaultAccessPolicyOutput, error) {
if params == nil {
params = &GetVaultAccessPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetVaultAccessPolicy", params, optFns, c.addOperationGetVaultAccessPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetVaultAccessPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
// Input for GetVaultAccessPolicy.
type GetVaultAccessPolicyInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
// Output for GetVaultAccessPolicy.
type GetVaultAccessPolicyOutput struct {
// Contains the returned vault access policy as a JSON string.
Policy *types.VaultAccessPolicy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetVaultAccessPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetVaultAccessPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetVaultAccessPolicy{}, 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 = addOpGetVaultAccessPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetVaultAccessPolicy(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetVaultAccessPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "GetVaultAccessPolicy",
}
}
| 152 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation retrieves the following attributes from the lock-policy
// subresource set on the specified vault:
// - The vault lock policy set on the vault.
// - The state of the vault lock, which is either InProgess or Locked .
// - When the lock ID expires. The lock ID is used to complete the vault locking
// process.
// - When the vault lock was initiated and put into the InProgress state.
//
// A vault lock is put into the InProgress state by calling InitiateVaultLock . A
// vault lock is put into the Locked state by calling CompleteVaultLock . You can
// abort the vault locking process by calling AbortVaultLock . For more information
// about the vault locking process, Amazon Glacier Vault Lock (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html)
// . If there is no vault lock policy set on the vault, the operation returns a
// 404 Not found error. For more information about vault lock policies, Amazon
// Glacier Access Control with Vault Lock Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html)
// .
func (c *Client) GetVaultLock(ctx context.Context, params *GetVaultLockInput, optFns ...func(*Options)) (*GetVaultLockOutput, error) {
if params == nil {
params = &GetVaultLockInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetVaultLock", params, optFns, c.addOperationGetVaultLockMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetVaultLockOutput)
out.ResultMetadata = metadata
return out, nil
}
// The input values for GetVaultLock .
type GetVaultLockInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type GetVaultLockOutput struct {
// The UTC date and time at which the vault lock was put into the InProgress state.
CreationDate *string
// The UTC date and time at which the lock ID expires. This value can be null if
// the vault lock is in a Locked state.
ExpirationDate *string
// The vault lock policy as a JSON string, which uses "\" as an escape character.
Policy *string
// The state of the vault lock. InProgress or Locked .
State *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetVaultLockMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetVaultLock{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetVaultLock{}, 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 = addOpGetVaultLockValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetVaultLock(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetVaultLock(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "GetVaultLock",
}
}
| 170 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation retrieves the notification-configuration subresource of the
// specified vault. For information about setting a notification configuration on a
// vault, see SetVaultNotifications . If a notification configuration for a vault
// is not set, the operation returns a 404 Not Found error. For more information
// about vault notifications, see Configuring Vault Notifications in Amazon S3
// Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html)
// . An AWS account has full permission to perform all operations (actions).
// However, AWS Identity and Access Management (IAM) users don't have any
// permissions by default. You must grant them explicit permission to perform
// specific actions. For more information, see Access Control Using AWS Identity
// and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Configuring Vault
// Notifications in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html)
// and Get Vault Notification Configuration (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-get.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) GetVaultNotifications(ctx context.Context, params *GetVaultNotificationsInput, optFns ...func(*Options)) (*GetVaultNotificationsOutput, error) {
if params == nil {
params = &GetVaultNotificationsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetVaultNotifications", params, optFns, c.addOperationGetVaultNotificationsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetVaultNotificationsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for retrieving the notification configuration set on an Amazon
// Glacier vault.
type GetVaultNotificationsInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type GetVaultNotificationsOutput struct {
// Returns the notification configuration set on the vault.
VaultNotificationConfig *types.VaultNotificationConfig
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetVaultNotificationsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetVaultNotifications{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetVaultNotifications{}, 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 = addOpGetVaultNotificationsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetVaultNotifications(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opGetVaultNotifications(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "GetVaultNotifications",
}
}
| 161 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation initiates a job of the specified type, which can be a select, an
// archival retrieval, or a vault retrieval. For more information about using this
// operation, see the documentation for the underlying REST API Initiate a Job (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html)
// .
func (c *Client) InitiateJob(ctx context.Context, params *InitiateJobInput, optFns ...func(*Options)) (*InitiateJobOutput, error) {
if params == nil {
params = &InitiateJobInput{}
}
result, metadata, err := c.invokeOperation(ctx, "InitiateJob", params, optFns, c.addOperationInitiateJobMiddlewares)
if err != nil {
return nil, err
}
out := result.(*InitiateJobOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for initiating an Amazon S3 Glacier job.
type InitiateJobInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// Provides options for specifying job information.
JobParameters *types.JobParameters
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type InitiateJobOutput struct {
// The ID of the job.
JobId *string
// The path to the location of where the select results are stored.
JobOutputPath *string
// The relative URI path of the job.
Location *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationInitiateJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpInitiateJob{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpInitiateJob{}, 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 = addOpInitiateJobValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opInitiateJob(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opInitiateJob(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "InitiateJob",
}
}
| 158 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation initiates a multipart upload. Amazon S3 Glacier creates a
// multipart upload resource and returns its ID in the response. The multipart
// upload ID is used in subsequent requests to upload parts of an archive (see
// UploadMultipartPart ). When you initiate a multipart upload, you specify the
// part size in number of bytes. The part size must be a megabyte (1024 KB)
// multiplied by a power of 2-for example, 1048576 (1 MB), 2097152 (2 MB), 4194304
// (4 MB), 8388608 (8 MB), and so on. The minimum allowable part size is 1 MB, and
// the maximum is 4 GB. Every part you upload to this resource (see
// UploadMultipartPart ), except the last one, must have the same size. The last
// one can be the same size or smaller. For example, suppose you want to upload a
// 16.2 MB file. If you initiate the multipart upload with a part size of 4 MB, you
// will upload four parts of 4 MB each and one part of 0.2 MB. You don't need to
// know the size of the archive when you start a multipart upload because Amazon S3
// Glacier does not require you to specify the overall archive size. After you
// complete the multipart upload, Amazon S3 Glacier (Glacier) removes the multipart
// upload resource referenced by the ID. Glacier also removes the multipart upload
// resource if you cancel the multipart upload or it may be removed if there is no
// activity for a period of 24 hours. An AWS account has full permission to perform
// all operations (actions). However, AWS Identity and Access Management (IAM)
// users don't have any permissions by default. You must grant them explicit
// permission to perform specific actions. For more information, see Access
// Control Using AWS Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Uploading Large
// Archives in Parts (Multipart Upload) (https://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html)
// and Initiate Multipart Upload (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-initiate-upload.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) InitiateMultipartUpload(ctx context.Context, params *InitiateMultipartUploadInput, optFns ...func(*Options)) (*InitiateMultipartUploadOutput, error) {
if params == nil {
params = &InitiateMultipartUploadInput{}
}
result, metadata, err := c.invokeOperation(ctx, "InitiateMultipartUpload", params, optFns, c.addOperationInitiateMultipartUploadMiddlewares)
if err != nil {
return nil, err
}
out := result.(*InitiateMultipartUploadOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for initiating a multipart upload to an Amazon S3 Glacier
// vault.
type InitiateMultipartUploadInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The archive description that you are uploading in parts. The part size must be
// a megabyte (1024 KB) multiplied by a power of 2, for example 1048576 (1 MB),
// 2097152 (2 MB), 4194304 (4 MB), 8388608 (8 MB), and so on. The minimum allowable
// part size is 1 MB, and the maximum is 4 GB (4096 MB).
ArchiveDescription *string
// The size of each part except the last, in bytes. The last part can be smaller
// than this part size.
PartSize *string
noSmithyDocumentSerde
}
// The Amazon S3 Glacier response to your request.
type InitiateMultipartUploadOutput struct {
// The relative URI path of the multipart upload ID Amazon S3 Glacier created.
Location *string
// The ID of the multipart upload. This value is also included as part of the
// location.
UploadId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationInitiateMultipartUploadMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpInitiateMultipartUpload{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpInitiateMultipartUpload{}, 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 = addOpInitiateMultipartUploadValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opInitiateMultipartUpload(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opInitiateMultipartUpload(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "InitiateMultipartUpload",
}
}
| 185 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation initiates the vault locking process by doing the following:
// - Installing a vault lock policy on the specified vault.
// - Setting the lock state of vault lock to InProgress .
// - Returning a lock ID, which is used to complete the vault locking process.
//
// You can set one vault lock policy for each vault and this policy can be up to
// 20 KB in size. For more information about vault lock policies, see Amazon
// Glacier Access Control with Vault Lock Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock-policy.html)
// . You must complete the vault locking process within 24 hours after the vault
// lock enters the InProgress state. After the 24 hour window ends, the lock ID
// expires, the vault automatically exits the InProgress state, and the vault lock
// policy is removed from the vault. You call CompleteVaultLock to complete the
// vault locking process by setting the state of the vault lock to Locked . After a
// vault lock is in the Locked state, you cannot initiate a new vault lock for the
// vault. You can abort the vault locking process by calling AbortVaultLock . You
// can get the state of the vault lock by calling GetVaultLock . For more
// information about the vault locking process, Amazon Glacier Vault Lock (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-lock.html)
// . If this operation is called when the vault lock is in the InProgress state,
// the operation returns an AccessDeniedException error. When the vault lock is in
// the InProgress state you must call AbortVaultLock before you can initiate a new
// vault lock policy.
func (c *Client) InitiateVaultLock(ctx context.Context, params *InitiateVaultLockInput, optFns ...func(*Options)) (*InitiateVaultLockOutput, error) {
if params == nil {
params = &InitiateVaultLockInput{}
}
result, metadata, err := c.invokeOperation(ctx, "InitiateVaultLock", params, optFns, c.addOperationInitiateVaultLockMiddlewares)
if err != nil {
return nil, err
}
out := result.(*InitiateVaultLockOutput)
out.ResultMetadata = metadata
return out, nil
}
// The input values for InitiateVaultLock .
type InitiateVaultLockInput struct {
// The AccountId value is the AWS account ID. This value must match the AWS
// account ID associated with the credentials used to sign the request. You can
// either specify an AWS account ID or optionally a single ' - ' (hyphen), in which
// case Amazon Glacier uses the AWS account ID associated with the credentials used
// to sign the request. If you specify your account ID, do not include any hyphens
// ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The vault lock policy as a JSON string, which uses "\" as an escape character.
Policy *types.VaultLockPolicy
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type InitiateVaultLockOutput struct {
// The lock ID, which is used to complete the vault locking process.
LockId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationInitiateVaultLockMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpInitiateVaultLock{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpInitiateVaultLock{}, 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 = addOpInitiateVaultLockValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opInitiateVaultLock(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opInitiateVaultLock(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "InitiateVaultLock",
}
}
| 170 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation lists jobs for a vault, including jobs that are in-progress and
// jobs that have recently finished. The List Job operation returns a list of these
// jobs sorted by job initiation time. Amazon Glacier retains recently completed
// jobs for a period before deleting them; however, it eventually removes completed
// jobs. The output of completed jobs can be retrieved. Retaining completed jobs
// for a period of time after they have completed enables you to get a job output
// in the event you miss the job completion notification or your first attempt to
// download it fails. For example, suppose you start an archive retrieval job to
// download an archive. After the job completes, you start to download the archive
// but encounter a network error. In this scenario, you can retry and download the
// archive while the job exists. The List Jobs operation supports pagination. You
// should always check the response Marker field. If there are no more jobs to
// list, the Marker field is set to null . If there are more jobs to list, the
// Marker field is set to a non-null value, which you can use to continue the
// pagination of the list. To return a list of jobs that begins at a specific job,
// set the marker request parameter to the Marker value for that job that you
// obtained from a previous List Jobs request. You can set a maximum limit for the
// number of jobs returned in the response by specifying the limit parameter in
// the request. The default limit is 50. The number of jobs returned might be fewer
// than the limit, but the number of returned jobs never exceeds the limit.
// Additionally, you can filter the jobs list returned by specifying the optional
// statuscode parameter or completed parameter, or both. Using the statuscode
// parameter, you can specify to return only jobs that match either the InProgress
// , Succeeded , or Failed status. Using the completed parameter, you can specify
// to return only jobs that were completed ( true ) or jobs that were not completed
// ( false ). For more information about using this operation, see the
// documentation for the underlying REST API List Jobs (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-jobs-get.html)
// .
func (c *Client) ListJobs(ctx context.Context, params *ListJobsInput, optFns ...func(*Options)) (*ListJobsOutput, error) {
if params == nil {
params = &ListJobsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListJobs", params, optFns, c.addOperationListJobsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListJobsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for retrieving a job list for an Amazon S3 Glacier vault.
type ListJobsInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The state of the jobs to return. You can specify true or false .
Completed *string
// The maximum number of jobs to be returned. The default limit is 50. The number
// of jobs returned might be fewer than the specified limit, but the number of
// returned jobs never exceeds the limit.
Limit *int32
// An opaque string used for pagination. This value specifies the job at which the
// listing of jobs should begin. Get the marker value from a previous List Jobs
// response. You only need to include the marker if you are continuing the
// pagination of results started in a previous List Jobs request.
Marker *string
// The type of job status to return. You can specify the following values:
// InProgress , Succeeded , or Failed .
Statuscode *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type ListJobsOutput struct {
// A list of job objects. Each job object contains metadata describing the job.
JobList []types.GlacierJobDescription
// An opaque string used for pagination that specifies the job at which the
// listing of jobs should begin. You get the marker value from a previous List
// Jobs response. You only need to include the marker if you are continuing the
// pagination of the results started in a previous List Jobs request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListJobsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListJobs{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListJobs{}, 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 = addOpListJobsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListJobs(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// ListJobsAPIClient is a client that implements the ListJobs operation.
type ListJobsAPIClient interface {
ListJobs(context.Context, *ListJobsInput, ...func(*Options)) (*ListJobsOutput, error)
}
var _ ListJobsAPIClient = (*Client)(nil)
// ListJobsPaginatorOptions is the paginator options for ListJobs
type ListJobsPaginatorOptions struct {
// The maximum number of jobs to be returned. The default limit is 50. The number
// of jobs returned might be fewer than the specified limit, but the number of
// returned jobs never exceeds the limit.
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
}
// ListJobsPaginator is a paginator for ListJobs
type ListJobsPaginator struct {
options ListJobsPaginatorOptions
client ListJobsAPIClient
params *ListJobsInput
nextToken *string
firstPage bool
}
// NewListJobsPaginator returns a new ListJobsPaginator
func NewListJobsPaginator(client ListJobsAPIClient, params *ListJobsInput, optFns ...func(*ListJobsPaginatorOptions)) *ListJobsPaginator {
if params == nil {
params = &ListJobsInput{}
}
options := ListJobsPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &ListJobsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListJobsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListJobs page.
func (p *ListJobsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListJobsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.ListJobs(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListJobs(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "ListJobs",
}
}
| 289 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation lists in-progress multipart uploads for the specified vault. An
// in-progress multipart upload is a multipart upload that has been initiated by an
// InitiateMultipartUpload request, but has not yet been completed or aborted. The
// list returned in the List Multipart Upload response has no guaranteed order. The
// List Multipart Uploads operation supports pagination. By default, this operation
// returns up to 50 multipart uploads in the response. You should always check the
// response for a marker at which to continue the list; if there are no more items
// the marker is null . To return a list of multipart uploads that begins at a
// specific upload, set the marker request parameter to the value you obtained
// from a previous List Multipart Upload request. You can also limit the number of
// uploads returned in the response by specifying the limit parameter in the
// request. Note the difference between this operation and listing parts ( ListParts
// ). The List Multipart Uploads operation lists all multipart uploads for a vault
// and does not require a multipart upload ID. The List Parts operation requires a
// multipart upload ID since parts are associated with a single upload. An AWS
// account has full permission to perform all operations (actions). However, AWS
// Identity and Access Management (IAM) users don't have any permissions by
// default. You must grant them explicit permission to perform specific actions.
// For more information, see Access Control Using AWS Identity and Access
// Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and the underlying REST API, see Working with
// Archives in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html)
// and List Multipart Uploads (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-list-uploads.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) ListMultipartUploads(ctx context.Context, params *ListMultipartUploadsInput, optFns ...func(*Options)) (*ListMultipartUploadsOutput, error) {
if params == nil {
params = &ListMultipartUploadsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListMultipartUploads", params, optFns, c.addOperationListMultipartUploadsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListMultipartUploadsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for retrieving list of in-progress multipart uploads for an
// Amazon Glacier vault.
type ListMultipartUploadsInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// Specifies the maximum number of uploads returned in the response body. If this
// value is not specified, the List Uploads operation returns up to 50 uploads.
Limit *int32
// An opaque string used for pagination. This value specifies the upload at which
// the listing of uploads should begin. Get the marker value from a previous List
// Uploads response. You need only include the marker if you are continuing the
// pagination of results started in a previous List Uploads request.
Marker *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type ListMultipartUploadsOutput struct {
// An opaque string that represents where to continue pagination of the results.
// You use the marker in a new List Multipart Uploads request to obtain more
// uploads in the list. If there are no more uploads, this value is null .
Marker *string
// A list of in-progress multipart uploads.
UploadsList []types.UploadListElement
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListMultipartUploadsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListMultipartUploads{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListMultipartUploads{}, 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 = addOpListMultipartUploadsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListMultipartUploads(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// ListMultipartUploadsAPIClient is a client that implements the
// ListMultipartUploads operation.
type ListMultipartUploadsAPIClient interface {
ListMultipartUploads(context.Context, *ListMultipartUploadsInput, ...func(*Options)) (*ListMultipartUploadsOutput, error)
}
var _ ListMultipartUploadsAPIClient = (*Client)(nil)
// ListMultipartUploadsPaginatorOptions is the paginator options for
// ListMultipartUploads
type ListMultipartUploadsPaginatorOptions struct {
// Specifies the maximum number of uploads returned in the response body. If this
// value is not specified, the List Uploads operation returns up to 50 uploads.
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
}
// ListMultipartUploadsPaginator is a paginator for ListMultipartUploads
type ListMultipartUploadsPaginator struct {
options ListMultipartUploadsPaginatorOptions
client ListMultipartUploadsAPIClient
params *ListMultipartUploadsInput
nextToken *string
firstPage bool
}
// NewListMultipartUploadsPaginator returns a new ListMultipartUploadsPaginator
func NewListMultipartUploadsPaginator(client ListMultipartUploadsAPIClient, params *ListMultipartUploadsInput, optFns ...func(*ListMultipartUploadsPaginatorOptions)) *ListMultipartUploadsPaginator {
if params == nil {
params = &ListMultipartUploadsInput{}
}
options := ListMultipartUploadsPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &ListMultipartUploadsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListMultipartUploadsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListMultipartUploads page.
func (p *ListMultipartUploadsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListMultipartUploadsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.ListMultipartUploads(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListMultipartUploads(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "ListMultipartUploads",
}
}
| 278 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation lists the parts of an archive that have been uploaded in a
// specific multipart upload. You can make this request at any time during an
// in-progress multipart upload before you complete the upload (see
// CompleteMultipartUpload . List Parts returns an error for completed uploads. The
// list returned in the List Parts response is sorted by part range. The List Parts
// operation supports pagination. By default, this operation returns up to 50
// uploaded parts in the response. You should always check the response for a
// marker at which to continue the list; if there are no more items the marker is
// null . To return a list of parts that begins at a specific part, set the marker
// request parameter to the value you obtained from a previous List Parts request.
// You can also limit the number of parts returned in the response by specifying
// the limit parameter in the request. An AWS account has full permission to
// perform all operations (actions). However, AWS Identity and Access Management
// (IAM) users don't have any permissions by default. You must grant them explicit
// permission to perform specific actions. For more information, see Access
// Control Using AWS Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and the underlying REST API, see Working with
// Archives in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html)
// and List Parts (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-multipart-list-parts.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) ListParts(ctx context.Context, params *ListPartsInput, optFns ...func(*Options)) (*ListPartsOutput, error) {
if params == nil {
params = &ListPartsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListParts", params, optFns, c.addOperationListPartsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListPartsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options for retrieving a list of parts of an archive that have been
// uploaded in a specific multipart upload.
type ListPartsInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The upload ID of the multipart upload.
//
// This member is required.
UploadId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The maximum number of parts to be returned. The default limit is 50. The number
// of parts returned might be fewer than the specified limit, but the number of
// returned parts never exceeds the limit.
Limit *int32
// An opaque string used for pagination. This value specifies the part at which
// the listing of parts should begin. Get the marker value from the response of a
// previous List Parts response. You need only include the marker if you are
// continuing the pagination of results started in a previous List Parts request.
Marker *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type ListPartsOutput struct {
// The description of the archive that was specified in the Initiate Multipart
// Upload request.
ArchiveDescription *string
// The UTC time at which the multipart upload was initiated.
CreationDate *string
// An opaque string that represents where to continue pagination of the results.
// You use the marker in a new List Parts request to obtain more jobs in the list.
// If there are no more parts, this value is null .
Marker *string
// The ID of the upload to which the parts are associated.
MultipartUploadId *string
// The part size in bytes. This is the same value that you specified in the
// Initiate Multipart Upload request.
PartSizeInBytes int64
// A list of the part sizes of the multipart upload. Each object in the array
// contains a RangeBytes and sha256-tree-hash name/value pair.
Parts []types.PartListElement
// The Amazon Resource Name (ARN) of the vault to which the multipart upload was
// initiated.
VaultARN *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListPartsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListParts{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListParts{}, 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 = addOpListPartsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListParts(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// ListPartsAPIClient is a client that implements the ListParts operation.
type ListPartsAPIClient interface {
ListParts(context.Context, *ListPartsInput, ...func(*Options)) (*ListPartsOutput, error)
}
var _ ListPartsAPIClient = (*Client)(nil)
// ListPartsPaginatorOptions is the paginator options for ListParts
type ListPartsPaginatorOptions struct {
// The maximum number of parts to be returned. The default limit is 50. The number
// of parts returned might be fewer than the specified limit, but the number of
// returned parts never exceeds the limit.
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
}
// ListPartsPaginator is a paginator for ListParts
type ListPartsPaginator struct {
options ListPartsPaginatorOptions
client ListPartsAPIClient
params *ListPartsInput
nextToken *string
firstPage bool
}
// NewListPartsPaginator returns a new ListPartsPaginator
func NewListPartsPaginator(client ListPartsAPIClient, params *ListPartsInput, optFns ...func(*ListPartsPaginatorOptions)) *ListPartsPaginator {
if params == nil {
params = &ListPartsInput{}
}
options := ListPartsPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &ListPartsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListPartsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListParts page.
func (p *ListPartsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListPartsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.ListParts(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListParts(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "ListParts",
}
}
| 298 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation lists the provisioned capacity units for the specified AWS
// account.
func (c *Client) ListProvisionedCapacity(ctx context.Context, params *ListProvisionedCapacityInput, optFns ...func(*Options)) (*ListProvisionedCapacityOutput, error) {
if params == nil {
params = &ListProvisionedCapacityInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListProvisionedCapacity", params, optFns, c.addOperationListProvisionedCapacityMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListProvisionedCapacityOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListProvisionedCapacityInput struct {
// The AWS account ID of the account that owns the vault. You can either specify
// an AWS account ID or optionally a single '-' (hyphen), in which case Amazon S3
// Glacier uses the AWS account ID associated with the credentials used to sign the
// request. If you use an account ID, don't include any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
noSmithyDocumentSerde
}
type ListProvisionedCapacityOutput struct {
// The response body contains the following JSON fields.
ProvisionedCapacityList []types.ProvisionedCapacityDescription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListProvisionedCapacityMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListProvisionedCapacity{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListProvisionedCapacity{}, 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 = addOpListProvisionedCapacityValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListProvisionedCapacity(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opListProvisionedCapacity(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "ListProvisionedCapacity",
}
}
| 139 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation lists all the tags attached to a vault. The operation returns an
// empty map if there are no tags. For more information about tags, see Tagging
// Amazon S3 Glacier Resources (https://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html)
// .
func (c *Client) ListTagsForVault(ctx context.Context, params *ListTagsForVaultInput, optFns ...func(*Options)) (*ListTagsForVaultOutput, error) {
if params == nil {
params = &ListTagsForVaultInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListTagsForVault", params, optFns, c.addOperationListTagsForVaultMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListTagsForVaultOutput)
out.ResultMetadata = metadata
return out, nil
}
// The input value for ListTagsForVaultInput .
type ListTagsForVaultInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type ListTagsForVaultOutput struct {
// The tags attached to the vault. Each tag is composed of a key and a value.
Tags map[string]string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListTagsForVaultMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListTagsForVault{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTagsForVault{}, 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 = addOpListTagsForVaultValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForVault(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opListTagsForVault(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "ListTagsForVault",
}
}
| 148 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation lists all vaults owned by the calling user's account. The list
// returned in the response is ASCII-sorted by vault name. By default, this
// operation returns up to 10 items. If there are more vaults to list, the response
// marker field contains the vault Amazon Resource Name (ARN) at which to continue
// the list with a new List Vaults request; otherwise, the marker field is null .
// To return a list of vaults that begins at a specific vault, set the marker
// request parameter to the vault ARN you obtained from a previous List Vaults
// request. You can also limit the number of vaults returned in the response by
// specifying the limit parameter in the request. An AWS account has full
// permission to perform all operations (actions). However, AWS Identity and Access
// Management (IAM) users don't have any permissions by default. You must grant
// them explicit permission to perform specific actions. For more information, see
// Access Control Using AWS Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Retrieving Vault
// Metadata in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/retrieving-vault-info.html)
// and List Vaults (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vaults-get.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) ListVaults(ctx context.Context, params *ListVaultsInput, optFns ...func(*Options)) (*ListVaultsOutput, error) {
if params == nil {
params = &ListVaultsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListVaults", params, optFns, c.addOperationListVaultsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListVaultsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options to retrieve the vault list owned by the calling user's
// account. The list provides metadata information for each vault.
type ListVaultsInput struct {
// The AccountId value is the AWS account ID. This value must match the AWS
// account ID associated with the credentials used to sign the request. You can
// either specify an AWS account ID or optionally a single ' - ' (hyphen), in which
// case Amazon Glacier uses the AWS account ID associated with the credentials used
// to sign the request. If you specify your account ID, do not include any hyphens
// ('-') in the ID.
//
// This member is required.
AccountId *string
// The maximum number of vaults to be returned. The default limit is 10. The
// number of vaults returned might be fewer than the specified limit, but the
// number of returned vaults never exceeds the limit.
Limit *int32
// A string used for pagination. The marker specifies the vault ARN after which
// the listing of vaults should begin.
Marker *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type ListVaultsOutput struct {
// The vault ARN at which to continue pagination of the results. You use the
// marker in another List Vaults request to obtain more vaults in the list.
Marker *string
// List of vaults.
VaultList []types.DescribeVaultOutput
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListVaultsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListVaults{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListVaults{}, 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 = addOpListVaultsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListVaults(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
// ListVaultsAPIClient is a client that implements the ListVaults operation.
type ListVaultsAPIClient interface {
ListVaults(context.Context, *ListVaultsInput, ...func(*Options)) (*ListVaultsOutput, error)
}
var _ ListVaultsAPIClient = (*Client)(nil)
// ListVaultsPaginatorOptions is the paginator options for ListVaults
type ListVaultsPaginatorOptions struct {
// The maximum number of vaults to be returned. The default limit is 10. The
// number of vaults returned might be fewer than the specified limit, but the
// number of returned vaults never exceeds the limit.
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
}
// ListVaultsPaginator is a paginator for ListVaults
type ListVaultsPaginator struct {
options ListVaultsPaginatorOptions
client ListVaultsAPIClient
params *ListVaultsInput
nextToken *string
firstPage bool
}
// NewListVaultsPaginator returns a new ListVaultsPaginator
func NewListVaultsPaginator(client ListVaultsAPIClient, params *ListVaultsInput, optFns ...func(*ListVaultsPaginatorOptions)) *ListVaultsPaginator {
if params == nil {
params = &ListVaultsInput{}
}
options := ListVaultsPaginatorOptions{}
if params.Limit != nil {
options.Limit = *params.Limit
}
for _, fn := range optFns {
fn(&options)
}
return &ListVaultsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListVaultsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListVaults page.
func (p *ListVaultsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListVaultsOutput, error) {
if !p.HasMorePages() {
return nil, fmt.Errorf("no more pages available")
}
params := *p.params
params.Marker = p.nextToken
var limit *int32
if p.options.Limit > 0 {
limit = &p.options.Limit
}
params.Limit = limit
result, err := p.client.ListVaults(ctx, ¶ms, optFns...)
if err != nil {
return nil, err
}
p.firstPage = false
prevToken := p.nextToken
p.nextToken = result.Marker
if p.options.StopOnDuplicateToken &&
prevToken != nil &&
p.nextToken != nil &&
*prevToken == *p.nextToken {
p.nextToken = nil
}
return result, nil
}
func newServiceMetadataMiddleware_opListVaults(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "ListVaults",
}
}
| 264 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation purchases a provisioned capacity unit for an AWS account.
func (c *Client) PurchaseProvisionedCapacity(ctx context.Context, params *PurchaseProvisionedCapacityInput, optFns ...func(*Options)) (*PurchaseProvisionedCapacityOutput, error) {
if params == nil {
params = &PurchaseProvisionedCapacityInput{}
}
result, metadata, err := c.invokeOperation(ctx, "PurchaseProvisionedCapacity", params, optFns, c.addOperationPurchaseProvisionedCapacityMiddlewares)
if err != nil {
return nil, err
}
out := result.(*PurchaseProvisionedCapacityOutput)
out.ResultMetadata = metadata
return out, nil
}
type PurchaseProvisionedCapacityInput struct {
// The AWS account ID of the account that owns the vault. You can either specify
// an AWS account ID or optionally a single '-' (hyphen), in which case Amazon S3
// Glacier uses the AWS account ID associated with the credentials used to sign the
// request. If you use an account ID, don't include any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
noSmithyDocumentSerde
}
type PurchaseProvisionedCapacityOutput struct {
// The ID that identifies the provisioned capacity unit.
CapacityId *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationPurchaseProvisionedCapacityMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpPurchaseProvisionedCapacity{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpPurchaseProvisionedCapacity{}, 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 = addOpPurchaseProvisionedCapacityValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPurchaseProvisionedCapacity(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opPurchaseProvisionedCapacity(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "PurchaseProvisionedCapacity",
}
}
| 137 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation removes one or more tags from the set of tags attached to a
// vault. For more information about tags, see Tagging Amazon S3 Glacier Resources (https://docs.aws.amazon.com/amazonglacier/latest/dev/tagging.html)
// . This operation is idempotent. The operation will be successful, even if there
// are no tags attached to the vault.
func (c *Client) RemoveTagsFromVault(ctx context.Context, params *RemoveTagsFromVaultInput, optFns ...func(*Options)) (*RemoveTagsFromVaultOutput, error) {
if params == nil {
params = &RemoveTagsFromVaultInput{}
}
result, metadata, err := c.invokeOperation(ctx, "RemoveTagsFromVault", params, optFns, c.addOperationRemoveTagsFromVaultMiddlewares)
if err != nil {
return nil, err
}
out := result.(*RemoveTagsFromVaultOutput)
out.ResultMetadata = metadata
return out, nil
}
// The input value for RemoveTagsFromVaultInput .
type RemoveTagsFromVaultInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// A list of tag keys. Each corresponding tag is removed from the vault.
TagKeys []string
noSmithyDocumentSerde
}
type RemoveTagsFromVaultOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationRemoveTagsFromVaultMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpRemoveTagsFromVault{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpRemoveTagsFromVault{}, 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 = addOpRemoveTagsFromVaultValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRemoveTagsFromVault(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opRemoveTagsFromVault(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "RemoveTagsFromVault",
}
}
| 146 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation sets and then enacts a data retrieval policy in the region
// specified in the PUT request. You can set one policy per region for an AWS
// account. The policy is enacted within a few minutes of a successful PUT
// operation. The set policy operation does not affect retrieval jobs that were in
// progress before the policy was enacted. For more information about data
// retrieval policies, see Amazon Glacier Data Retrieval Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/data-retrieval-policy.html)
// .
func (c *Client) SetDataRetrievalPolicy(ctx context.Context, params *SetDataRetrievalPolicyInput, optFns ...func(*Options)) (*SetDataRetrievalPolicyOutput, error) {
if params == nil {
params = &SetDataRetrievalPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "SetDataRetrievalPolicy", params, optFns, c.addOperationSetDataRetrievalPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*SetDataRetrievalPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
// SetDataRetrievalPolicy input.
type SetDataRetrievalPolicyInput struct {
// The AccountId value is the AWS account ID. This value must match the AWS
// account ID associated with the credentials used to sign the request. You can
// either specify an AWS account ID or optionally a single ' - ' (hyphen), in which
// case Amazon Glacier uses the AWS account ID associated with the credentials used
// to sign the request. If you specify your account ID, do not include any hyphens
// ('-') in the ID.
//
// This member is required.
AccountId *string
// The data retrieval policy in JSON format.
Policy *types.DataRetrievalPolicy
noSmithyDocumentSerde
}
type SetDataRetrievalPolicyOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationSetDataRetrievalPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpSetDataRetrievalPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSetDataRetrievalPolicy{}, 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 = addOpSetDataRetrievalPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSetDataRetrievalPolicy(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opSetDataRetrievalPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "SetDataRetrievalPolicy",
}
}
| 146 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation configures an access policy for a vault and will overwrite an
// existing policy. To configure a vault access policy, send a PUT request to the
// access-policy subresource of the vault. An access policy is specific to a vault
// and is also called a vault subresource. You can set one access policy per vault
// and the policy can be up to 20 KB in size. For more information about vault
// access policies, see Amazon Glacier Access Control with Vault Access Policies (https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html)
// .
func (c *Client) SetVaultAccessPolicy(ctx context.Context, params *SetVaultAccessPolicyInput, optFns ...func(*Options)) (*SetVaultAccessPolicyOutput, error) {
if params == nil {
params = &SetVaultAccessPolicyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "SetVaultAccessPolicy", params, optFns, c.addOperationSetVaultAccessPolicyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*SetVaultAccessPolicyOutput)
out.ResultMetadata = metadata
return out, nil
}
// SetVaultAccessPolicy input.
type SetVaultAccessPolicyInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The vault access policy as a JSON string.
Policy *types.VaultAccessPolicy
noSmithyDocumentSerde
}
type SetVaultAccessPolicyOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationSetVaultAccessPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpSetVaultAccessPolicy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSetVaultAccessPolicy{}, 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 = addOpSetVaultAccessPolicyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSetVaultAccessPolicy(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opSetVaultAccessPolicy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "SetVaultAccessPolicy",
}
}
| 150 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// This operation configures notifications that will be sent when specific events
// happen to a vault. By default, you don't get any notifications. To configure
// vault notifications, send a PUT request to the notification-configuration
// subresource of the vault. The request should include a JSON document that
// provides an Amazon SNS topic and specific events for which you want Amazon S3
// Glacier to send notifications to the topic. Amazon SNS topics must grant
// permission to the vault to be allowed to publish notifications to the topic. You
// can configure a vault to publish a notification for the following vault events:
// - ArchiveRetrievalCompleted This event occurs when a job that was initiated
// for an archive retrieval is completed ( InitiateJob ). The status of the
// completed job can be "Succeeded" or "Failed". The notification sent to the SNS
// topic is the same output as returned from DescribeJob .
// - InventoryRetrievalCompleted This event occurs when a job that was initiated
// for an inventory retrieval is completed ( InitiateJob ). The status of the
// completed job can be "Succeeded" or "Failed". The notification sent to the SNS
// topic is the same output as returned from DescribeJob .
//
// An AWS account has full permission to perform all operations (actions).
// However, AWS Identity and Access Management (IAM) users don't have any
// permissions by default. You must grant them explicit permission to perform
// specific actions. For more information, see Access Control Using AWS Identity
// and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Configuring Vault
// Notifications in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications.html)
// and Set Vault Notification Configuration (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-vault-notifications-put.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) SetVaultNotifications(ctx context.Context, params *SetVaultNotificationsInput, optFns ...func(*Options)) (*SetVaultNotificationsOutput, error) {
if params == nil {
params = &SetVaultNotificationsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "SetVaultNotifications", params, optFns, c.addOperationSetVaultNotificationsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*SetVaultNotificationsOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options to configure notifications that will be sent when specific
// events happen to a vault.
type SetVaultNotificationsInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// Provides options for specifying notification configuration.
VaultNotificationConfig *types.VaultNotificationConfig
noSmithyDocumentSerde
}
type SetVaultNotificationsOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationSetVaultNotificationsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpSetVaultNotifications{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpSetVaultNotifications{}, 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 = addOpSetVaultNotificationsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSetVaultNotifications(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opSetVaultNotifications(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "SetVaultNotifications",
}
}
| 170 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
)
// This operation adds an archive to a vault. This is a synchronous operation, and
// for a successful upload, your data is durably persisted. Amazon S3 Glacier
// returns the archive ID in the x-amz-archive-id header of the response. You must
// use the archive ID to access your data in Amazon S3 Glacier. After you upload an
// archive, you should save the archive ID returned so that you can retrieve or
// delete the archive later. Besides saving the archive ID, you can also index it
// and give it a friendly name to allow for better searching. You can also use the
// optional archive description field to specify how the archive is referred to in
// an external index of archives, such as you might create in Amazon DynamoDB. You
// can also get the vault inventory to obtain a list of archive IDs in a vault. For
// more information, see InitiateJob . You must provide a SHA256 tree hash of the
// data you are uploading. For information about computing a SHA256 tree hash, see
// Computing Checksums (https://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html)
// . You can optionally specify an archive description of up to 1,024 printable
// ASCII characters. You can get the archive description when you either retrieve
// the archive or get the vault inventory. For more information, see InitiateJob .
// Amazon Glacier does not interpret the description in any way. An archive
// description does not need to be unique. You cannot use the description to
// retrieve or sort the archive list. Archives are immutable. After you upload an
// archive, you cannot edit the archive or its description. An AWS account has full
// permission to perform all operations (actions). However, AWS Identity and Access
// Management (IAM) users don't have any permissions by default. You must grant
// them explicit permission to perform specific actions. For more information, see
// Access Control Using AWS Identity and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Uploading an Archive
// in Amazon Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-an-archive.html)
// and Upload Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-post.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) UploadArchive(ctx context.Context, params *UploadArchiveInput, optFns ...func(*Options)) (*UploadArchiveOutput, error) {
if params == nil {
params = &UploadArchiveInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UploadArchive", params, optFns, c.addOperationUploadArchiveMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UploadArchiveOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options to add an archive to a vault.
type UploadArchiveInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The optional description of the archive you are uploading.
ArchiveDescription *string
// The data to upload.
Body io.Reader
// The SHA256 tree hash of the data being uploaded.
Checksum *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request. For information about
// the underlying REST API, see Upload Archive (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-archive-post.html)
// . For conceptual information, see Working with Archives in Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/working-with-archives.html)
// .
type UploadArchiveOutput struct {
// The ID of the archive. This value is also included as part of the location.
ArchiveId *string
// The checksum of the archive computed by Amazon S3 Glacier.
Checksum *string
// The relative URI path of the newly added archive resource.
Location *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUploadArchiveMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpUploadArchive{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUploadArchive{}, 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 = addOpUploadArchiveValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUploadArchive(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opUploadArchive(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "UploadArchive",
}
}
| 191 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
glaciercust "github.com/aws/aws-sdk-go-v2/service/glacier/internal/customizations"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
)
// This operation uploads a part of an archive. You can upload archive parts in
// any order. You can also upload them in parallel. You can upload up to 10,000
// parts for a multipart upload. Amazon Glacier rejects your upload part request if
// any of the following conditions is true:
// - SHA256 tree hash does not matchTo ensure that part data is not corrupted in
// transmission, you compute a SHA256 tree hash of the part and include it in your
// request. Upon receiving the part data, Amazon S3 Glacier also computes a SHA256
// tree hash. If these hash values don't match, the operation fails. For
// information about computing a SHA256 tree hash, see Computing Checksums (https://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html)
// .
// - Part size does not matchThe size of each part except the last must match
// the size specified in the corresponding InitiateMultipartUpload request. The
// size of the last part must be the same size as, or smaller than, the specified
// size. If you upload a part whose size is smaller than the part size you
// specified in your initiate multipart upload request and that part is not the
// last part, then the upload part request will succeed. However, the subsequent
// Complete Multipart Upload request will fail.
// - Range does not alignThe byte range value in the request does not align with
// the part size specified in the corresponding initiate request. For example, if
// you specify a part size of 4194304 bytes (4 MB), then 0 to 4194303 bytes (4 MB -
// 1) and 4194304 (4 MB) to 8388607 (8 MB - 1) are valid part ranges. However, if
// you set a range value of 2 MB to 6 MB, the range does not align with the part
// size and the upload will fail.
//
// This operation is idempotent. If you upload the same part multiple times, the
// data included in the most recent request overwrites the previously uploaded
// data. An AWS account has full permission to perform all operations (actions).
// However, AWS Identity and Access Management (IAM) users don't have any
// permissions by default. You must grant them explicit permission to perform
// specific actions. For more information, see Access Control Using AWS Identity
// and Access Management (IAM) (https://docs.aws.amazon.com/amazonglacier/latest/dev/using-iam-with-amazon-glacier.html)
// . For conceptual information and underlying REST API, see Uploading Large
// Archives in Parts (Multipart Upload) (https://docs.aws.amazon.com/amazonglacier/latest/dev/uploading-archive-mpu.html)
// and Upload Part (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-upload-part.html)
// in the Amazon Glacier Developer Guide.
func (c *Client) UploadMultipartPart(ctx context.Context, params *UploadMultipartPartInput, optFns ...func(*Options)) (*UploadMultipartPartOutput, error) {
if params == nil {
params = &UploadMultipartPartInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UploadMultipartPart", params, optFns, c.addOperationUploadMultipartPartMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UploadMultipartPartOutput)
out.ResultMetadata = metadata
return out, nil
}
// Provides options to upload a part of an archive in a multipart upload operation.
type UploadMultipartPartInput struct {
// The AccountId value is the AWS account ID of the account that owns the vault.
// You can either specify an AWS account ID or optionally a single ' - ' (hyphen),
// in which case Amazon S3 Glacier uses the AWS account ID associated with the
// credentials used to sign the request. If you use an account ID, do not include
// any hyphens ('-') in the ID.
//
// This member is required.
AccountId *string
// The upload ID of the multipart upload.
//
// This member is required.
UploadId *string
// The name of the vault.
//
// This member is required.
VaultName *string
// The data to upload.
Body io.Reader
// The SHA256 tree hash of the data being uploaded.
Checksum *string
// Identifies the range of bytes in the assembled archive that will be uploaded in
// this part. Amazon S3 Glacier uses this information to assemble the archive in
// the proper sequence. The format of this header follows RFC 2616. An example
// header is Content-Range:bytes 0-4194303/*.
Range *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type UploadMultipartPartOutput struct {
// The SHA256 tree hash that Amazon S3 Glacier computed for the uploaded part.
Checksum *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUploadMultipartPartMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpUploadMultipartPart{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUploadMultipartPart{}, 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 = addOpUploadMultipartPartValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUploadMultipartPart(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 = glaciercust.AddTreeHashMiddleware(stack); err != nil {
return err
}
if err = glaciercust.AddGlacierAPIVersionMiddleware(stack, ServiceAPIVersion); err != nil {
return err
}
if err = glaciercust.AddDefaultAccountIDMiddleware(stack, setDefaultAccountID); err != nil {
return err
}
if err = addRequestResponseLogging(stack, options); err != nil {
return err
}
return nil
}
func newServiceMetadataMiddleware_opUploadMultipartPart(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "glacier",
OperationName: "UploadMultipartPart",
}
}
| 197 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/glacier/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"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
"io/ioutil"
"strings"
)
type awsRestjson1_deserializeOpAbortMultipartUpload struct {
}
func (*awsRestjson1_deserializeOpAbortMultipartUpload) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAbortMultipartUpload) 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, awsRestjson1_deserializeOpErrorAbortMultipartUpload(response, &metadata)
}
output := &AbortMultipartUploadOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorAbortMultipartUpload(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpAbortVaultLock struct {
}
func (*awsRestjson1_deserializeOpAbortVaultLock) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAbortVaultLock) 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, awsRestjson1_deserializeOpErrorAbortVaultLock(response, &metadata)
}
output := &AbortVaultLockOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorAbortVaultLock(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpAddTagsToVault struct {
}
func (*awsRestjson1_deserializeOpAddTagsToVault) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAddTagsToVault) 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, awsRestjson1_deserializeOpErrorAddTagsToVault(response, &metadata)
}
output := &AddTagsToVaultOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorAddTagsToVault(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("LimitExceededException", errorCode):
return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpCompleteMultipartUpload struct {
}
func (*awsRestjson1_deserializeOpCompleteMultipartUpload) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCompleteMultipartUpload) 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, awsRestjson1_deserializeOpErrorCompleteMultipartUpload(response, &metadata)
}
output := &CompleteMultipartUploadOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsCompleteMultipartUploadOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCompleteMultipartUpload(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsCompleteMultipartUploadOutput(v *CompleteMultipartUploadOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("x-amz-archive-id"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.ArchiveId = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("x-amz-sha256-tree-hash"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Checksum = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("Location"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Location = ptr.String(headerValues[0])
}
return nil
}
type awsRestjson1_deserializeOpCompleteVaultLock struct {
}
func (*awsRestjson1_deserializeOpCompleteVaultLock) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCompleteVaultLock) 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, awsRestjson1_deserializeOpErrorCompleteVaultLock(response, &metadata)
}
output := &CompleteVaultLockOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCompleteVaultLock(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpCreateVault struct {
}
func (*awsRestjson1_deserializeOpCreateVault) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateVault) 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, awsRestjson1_deserializeOpErrorCreateVault(response, &metadata)
}
output := &CreateVaultOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsCreateVaultOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorCreateVault(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("LimitExceededException", errorCode):
return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsCreateVaultOutput(v *CreateVaultOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("Location"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Location = ptr.String(headerValues[0])
}
return nil
}
type awsRestjson1_deserializeOpDeleteArchive struct {
}
func (*awsRestjson1_deserializeOpDeleteArchive) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteArchive) 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, awsRestjson1_deserializeOpErrorDeleteArchive(response, &metadata)
}
output := &DeleteArchiveOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteArchive(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDeleteVault struct {
}
func (*awsRestjson1_deserializeOpDeleteVault) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteVault) 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, awsRestjson1_deserializeOpErrorDeleteVault(response, &metadata)
}
output := &DeleteVaultOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteVault(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDeleteVaultAccessPolicy struct {
}
func (*awsRestjson1_deserializeOpDeleteVaultAccessPolicy) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteVaultAccessPolicy) 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, awsRestjson1_deserializeOpErrorDeleteVaultAccessPolicy(response, &metadata)
}
output := &DeleteVaultAccessPolicyOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteVaultAccessPolicy(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDeleteVaultNotifications struct {
}
func (*awsRestjson1_deserializeOpDeleteVaultNotifications) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteVaultNotifications) 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, awsRestjson1_deserializeOpErrorDeleteVaultNotifications(response, &metadata)
}
output := &DeleteVaultNotificationsOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteVaultNotifications(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpDescribeJob struct {
}
func (*awsRestjson1_deserializeOpDescribeJob) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDescribeJob) 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, awsRestjson1_deserializeOpErrorDescribeJob(response, &metadata)
}
output := &DescribeJobOutput{}
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 = awsRestjson1_deserializeOpDocumentDescribeJobOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDescribeJob(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDescribeJobOutput(v **DescribeJobOutput, 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 *DescribeJobOutput
if *v == nil {
sv = &DescribeJobOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Action":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ActionCode to be of type string, got %T instead", value)
}
sv.Action = types.ActionCode(jtv)
}
case "ArchiveId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ArchiveId = ptr.String(jtv)
}
case "ArchiveSHA256TreeHash":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ArchiveSHA256TreeHash = ptr.String(jtv)
}
case "ArchiveSizeInBytes":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Size to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.ArchiveSizeInBytes = ptr.Int64(i64)
}
case "Completed":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected boolean to be of type *bool, got %T instead", value)
}
sv.Completed = jtv
}
case "CompletionDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CompletionDate = ptr.String(jtv)
}
case "CreationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CreationDate = ptr.String(jtv)
}
case "InventoryRetrievalParameters":
if err := awsRestjson1_deserializeDocumentInventoryRetrievalJobDescription(&sv.InventoryRetrievalParameters, value); err != nil {
return err
}
case "InventorySizeInBytes":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Size to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.InventorySizeInBytes = ptr.Int64(i64)
}
case "JobDescription":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.JobDescription = ptr.String(jtv)
}
case "JobId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.JobId = ptr.String(jtv)
}
case "JobOutputPath":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.JobOutputPath = ptr.String(jtv)
}
case "OutputLocation":
if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil {
return err
}
case "RetrievalByteRange":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.RetrievalByteRange = ptr.String(jtv)
}
case "SelectParameters":
if err := awsRestjson1_deserializeDocumentSelectParameters(&sv.SelectParameters, value); err != nil {
return err
}
case "SHA256TreeHash":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.SHA256TreeHash = ptr.String(jtv)
}
case "SNSTopic":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.SNSTopic = ptr.String(jtv)
}
case "StatusCode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StatusCode to be of type string, got %T instead", value)
}
sv.StatusCode = types.StatusCode(jtv)
}
case "StatusMessage":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.StatusMessage = ptr.String(jtv)
}
case "Tier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Tier = ptr.String(jtv)
}
case "VaultARN":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.VaultARN = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDescribeVault struct {
}
func (*awsRestjson1_deserializeOpDescribeVault) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDescribeVault) 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, awsRestjson1_deserializeOpErrorDescribeVault(response, &metadata)
}
output := &DescribeVaultOutput{}
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 = awsRestjson1_deserializeOpDocumentDescribeVaultOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDescribeVault(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDescribeVaultOutput(v **DescribeVaultOutput, 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 *DescribeVaultOutput
if *v == nil {
sv = &DescribeVaultOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "CreationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CreationDate = ptr.String(jtv)
}
case "LastInventoryDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.LastInventoryDate = ptr.String(jtv)
}
case "NumberOfArchives":
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.NumberOfArchives = i64
}
case "SizeInBytes":
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.SizeInBytes = i64
}
case "VaultARN":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.VaultARN = ptr.String(jtv)
}
case "VaultName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.VaultName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetDataRetrievalPolicy struct {
}
func (*awsRestjson1_deserializeOpGetDataRetrievalPolicy) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetDataRetrievalPolicy) 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, awsRestjson1_deserializeOpErrorGetDataRetrievalPolicy(response, &metadata)
}
output := &GetDataRetrievalPolicyOutput{}
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 = awsRestjson1_deserializeOpDocumentGetDataRetrievalPolicyOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetDataRetrievalPolicy(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetDataRetrievalPolicyOutput(v **GetDataRetrievalPolicyOutput, 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 *GetDataRetrievalPolicyOutput
if *v == nil {
sv = &GetDataRetrievalPolicyOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Policy":
if err := awsRestjson1_deserializeDocumentDataRetrievalPolicy(&sv.Policy, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetJobOutput struct {
}
func (*awsRestjson1_deserializeOpGetJobOutput) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetJobOutput) 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, awsRestjson1_deserializeOpErrorGetJobOutput(response, &metadata)
}
output := &GetJobOutputOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsGetJobOutputOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
err = awsRestjson1_deserializeOpDocumentGetJobOutputOutput(output, response.Body)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetJobOutput(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsGetJobOutputOutput(v *GetJobOutputOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("Accept-Ranges"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.AcceptRanges = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("x-amz-archive-description"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.ArchiveDescription = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("x-amz-sha256-tree-hash"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Checksum = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("Content-Range"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.ContentRange = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("Content-Type"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.ContentType = ptr.String(headerValues[0])
}
v.Status = int32(response.StatusCode)
return nil
}
func awsRestjson1_deserializeOpDocumentGetJobOutputOutput(v *GetJobOutputOutput, body io.ReadCloser) error {
if v == nil {
return fmt.Errorf("unsupported deserialization of nil %T", v)
}
v.Body = body
return nil
}
type awsRestjson1_deserializeOpGetVaultAccessPolicy struct {
}
func (*awsRestjson1_deserializeOpGetVaultAccessPolicy) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetVaultAccessPolicy) 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, awsRestjson1_deserializeOpErrorGetVaultAccessPolicy(response, &metadata)
}
output := &GetVaultAccessPolicyOutput{}
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 = awsRestjson1_deserializeDocumentVaultAccessPolicy(&output.Policy, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetVaultAccessPolicy(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetVaultAccessPolicyOutput(v **GetVaultAccessPolicyOutput, 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 *GetVaultAccessPolicyOutput
if *v == nil {
sv = &GetVaultAccessPolicyOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "policy":
if err := awsRestjson1_deserializeDocumentVaultAccessPolicy(&sv.Policy, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetVaultLock struct {
}
func (*awsRestjson1_deserializeOpGetVaultLock) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetVaultLock) 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, awsRestjson1_deserializeOpErrorGetVaultLock(response, &metadata)
}
output := &GetVaultLockOutput{}
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 = awsRestjson1_deserializeOpDocumentGetVaultLockOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetVaultLock(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetVaultLockOutput(v **GetVaultLockOutput, 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 *GetVaultLockOutput
if *v == nil {
sv = &GetVaultLockOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "CreationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CreationDate = ptr.String(jtv)
}
case "ExpirationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ExpirationDate = ptr.String(jtv)
}
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 "State":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.State = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetVaultNotifications struct {
}
func (*awsRestjson1_deserializeOpGetVaultNotifications) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetVaultNotifications) 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, awsRestjson1_deserializeOpErrorGetVaultNotifications(response, &metadata)
}
output := &GetVaultNotificationsOutput{}
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 = awsRestjson1_deserializeDocumentVaultNotificationConfig(&output.VaultNotificationConfig, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorGetVaultNotifications(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetVaultNotificationsOutput(v **GetVaultNotificationsOutput, 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 *GetVaultNotificationsOutput
if *v == nil {
sv = &GetVaultNotificationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "vaultNotificationConfig":
if err := awsRestjson1_deserializeDocumentVaultNotificationConfig(&sv.VaultNotificationConfig, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpInitiateJob struct {
}
func (*awsRestjson1_deserializeOpInitiateJob) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpInitiateJob) 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, awsRestjson1_deserializeOpErrorInitiateJob(response, &metadata)
}
output := &InitiateJobOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsInitiateJobOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorInitiateJob(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("InsufficientCapacityException", errorCode):
return awsRestjson1_deserializeErrorInsufficientCapacityException(response, errorBody)
case strings.EqualFold("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("PolicyEnforcedException", errorCode):
return awsRestjson1_deserializeErrorPolicyEnforcedException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsInitiateJobOutput(v *InitiateJobOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("x-amz-job-id"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.JobId = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("x-amz-job-output-path"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.JobOutputPath = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("Location"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Location = ptr.String(headerValues[0])
}
return nil
}
type awsRestjson1_deserializeOpInitiateMultipartUpload struct {
}
func (*awsRestjson1_deserializeOpInitiateMultipartUpload) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpInitiateMultipartUpload) 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, awsRestjson1_deserializeOpErrorInitiateMultipartUpload(response, &metadata)
}
output := &InitiateMultipartUploadOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsInitiateMultipartUploadOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorInitiateMultipartUpload(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsInitiateMultipartUploadOutput(v *InitiateMultipartUploadOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("Location"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Location = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("x-amz-multipart-upload-id"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.UploadId = ptr.String(headerValues[0])
}
return nil
}
type awsRestjson1_deserializeOpInitiateVaultLock struct {
}
func (*awsRestjson1_deserializeOpInitiateVaultLock) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpInitiateVaultLock) 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, awsRestjson1_deserializeOpErrorInitiateVaultLock(response, &metadata)
}
output := &InitiateVaultLockOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsInitiateVaultLockOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorInitiateVaultLock(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsInitiateVaultLockOutput(v *InitiateVaultLockOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("x-amz-lock-id"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.LockId = ptr.String(headerValues[0])
}
return nil
}
type awsRestjson1_deserializeOpListJobs struct {
}
func (*awsRestjson1_deserializeOpListJobs) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListJobs) 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, awsRestjson1_deserializeOpErrorListJobs(response, &metadata)
}
output := &ListJobsOutput{}
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 = awsRestjson1_deserializeOpDocumentListJobsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListJobs(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListJobsOutput(v **ListJobsOutput, 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 *ListJobsOutput
if *v == nil {
sv = &ListJobsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "JobList":
if err := awsRestjson1_deserializeDocumentJobList(&sv.JobList, value); err != nil {
return err
}
case "Marker":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Marker = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListMultipartUploads struct {
}
func (*awsRestjson1_deserializeOpListMultipartUploads) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListMultipartUploads) 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, awsRestjson1_deserializeOpErrorListMultipartUploads(response, &metadata)
}
output := &ListMultipartUploadsOutput{}
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 = awsRestjson1_deserializeOpDocumentListMultipartUploadsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListMultipartUploads(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListMultipartUploadsOutput(v **ListMultipartUploadsOutput, 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 *ListMultipartUploadsOutput
if *v == nil {
sv = &ListMultipartUploadsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Marker":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Marker = ptr.String(jtv)
}
case "UploadsList":
if err := awsRestjson1_deserializeDocumentUploadsList(&sv.UploadsList, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListParts struct {
}
func (*awsRestjson1_deserializeOpListParts) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListParts) 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, awsRestjson1_deserializeOpErrorListParts(response, &metadata)
}
output := &ListPartsOutput{}
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 = awsRestjson1_deserializeOpDocumentListPartsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListParts(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListPartsOutput(v **ListPartsOutput, 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 *ListPartsOutput
if *v == nil {
sv = &ListPartsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ArchiveDescription":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ArchiveDescription = ptr.String(jtv)
}
case "CreationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CreationDate = ptr.String(jtv)
}
case "Marker":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Marker = ptr.String(jtv)
}
case "MultipartUploadId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.MultipartUploadId = ptr.String(jtv)
}
case "Parts":
if err := awsRestjson1_deserializeDocumentPartList(&sv.Parts, value); err != nil {
return err
}
case "PartSizeInBytes":
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.PartSizeInBytes = i64
}
case "VaultARN":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.VaultARN = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListProvisionedCapacity struct {
}
func (*awsRestjson1_deserializeOpListProvisionedCapacity) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListProvisionedCapacity) 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, awsRestjson1_deserializeOpErrorListProvisionedCapacity(response, &metadata)
}
output := &ListProvisionedCapacityOutput{}
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 = awsRestjson1_deserializeOpDocumentListProvisionedCapacityOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListProvisionedCapacity(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListProvisionedCapacityOutput(v **ListProvisionedCapacityOutput, 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 *ListProvisionedCapacityOutput
if *v == nil {
sv = &ListProvisionedCapacityOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ProvisionedCapacityList":
if err := awsRestjson1_deserializeDocumentProvisionedCapacityList(&sv.ProvisionedCapacityList, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListTagsForVault struct {
}
func (*awsRestjson1_deserializeOpListTagsForVault) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListTagsForVault) 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, awsRestjson1_deserializeOpErrorListTagsForVault(response, &metadata)
}
output := &ListTagsForVaultOutput{}
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 = awsRestjson1_deserializeOpDocumentListTagsForVaultOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListTagsForVault(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListTagsForVaultOutput(v **ListTagsForVaultOutput, 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 *ListTagsForVaultOutput
if *v == nil {
sv = &ListTagsForVaultOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Tags":
if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListVaults struct {
}
func (*awsRestjson1_deserializeOpListVaults) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListVaults) 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, awsRestjson1_deserializeOpErrorListVaults(response, &metadata)
}
output := &ListVaultsOutput{}
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 = awsRestjson1_deserializeOpDocumentListVaultsOutput(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
Snapshot: snapshot.Bytes(),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorListVaults(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListVaultsOutput(v **ListVaultsOutput, 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 *ListVaultsOutput
if *v == nil {
sv = &ListVaultsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Marker":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Marker = ptr.String(jtv)
}
case "VaultList":
if err := awsRestjson1_deserializeDocumentVaultList(&sv.VaultList, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpPurchaseProvisionedCapacity struct {
}
func (*awsRestjson1_deserializeOpPurchaseProvisionedCapacity) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpPurchaseProvisionedCapacity) 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, awsRestjson1_deserializeOpErrorPurchaseProvisionedCapacity(response, &metadata)
}
output := &PurchaseProvisionedCapacityOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsPurchaseProvisionedCapacityOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorPurchaseProvisionedCapacity(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("LimitExceededException", errorCode):
return awsRestjson1_deserializeErrorLimitExceededException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsPurchaseProvisionedCapacityOutput(v *PurchaseProvisionedCapacityOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("x-amz-capacity-id"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.CapacityId = ptr.String(headerValues[0])
}
return nil
}
type awsRestjson1_deserializeOpRemoveTagsFromVault struct {
}
func (*awsRestjson1_deserializeOpRemoveTagsFromVault) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpRemoveTagsFromVault) 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, awsRestjson1_deserializeOpErrorRemoveTagsFromVault(response, &metadata)
}
output := &RemoveTagsFromVaultOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorRemoveTagsFromVault(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpSetDataRetrievalPolicy struct {
}
func (*awsRestjson1_deserializeOpSetDataRetrievalPolicy) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpSetDataRetrievalPolicy) 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, awsRestjson1_deserializeOpErrorSetDataRetrievalPolicy(response, &metadata)
}
output := &SetDataRetrievalPolicyOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorSetDataRetrievalPolicy(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpSetVaultAccessPolicy struct {
}
func (*awsRestjson1_deserializeOpSetVaultAccessPolicy) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpSetVaultAccessPolicy) 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, awsRestjson1_deserializeOpErrorSetVaultAccessPolicy(response, &metadata)
}
output := &SetVaultAccessPolicyOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorSetVaultAccessPolicy(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpSetVaultNotifications struct {
}
func (*awsRestjson1_deserializeOpSetVaultNotifications) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpSetVaultNotifications) 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, awsRestjson1_deserializeOpErrorSetVaultNotifications(response, &metadata)
}
output := &SetVaultNotificationsOutput{}
out.Result = output
if _, err = io.Copy(ioutil.Discard, response.Body); err != nil {
return out, metadata, &smithy.DeserializationError{
Err: fmt.Errorf("failed to discard response body, %w", err),
}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorSetVaultNotifications(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpUploadArchive struct {
}
func (*awsRestjson1_deserializeOpUploadArchive) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUploadArchive) 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, awsRestjson1_deserializeOpErrorUploadArchive(response, &metadata)
}
output := &UploadArchiveOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsUploadArchiveOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorUploadArchive(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("RequestTimeoutException", errorCode):
return awsRestjson1_deserializeErrorRequestTimeoutException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsUploadArchiveOutput(v *UploadArchiveOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("x-amz-archive-id"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.ArchiveId = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("x-amz-sha256-tree-hash"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Checksum = ptr.String(headerValues[0])
}
if headerValues := response.Header.Values("Location"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Location = ptr.String(headerValues[0])
}
return nil
}
type awsRestjson1_deserializeOpUploadMultipartPart struct {
}
func (*awsRestjson1_deserializeOpUploadMultipartPart) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUploadMultipartPart) 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, awsRestjson1_deserializeOpErrorUploadMultipartPart(response, &metadata)
}
output := &UploadMultipartPartOutput{}
out.Result = output
err = awsRestjson1_deserializeOpHttpBindingsUploadMultipartPartOutput(output, response)
if err != nil {
return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)}
}
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorUploadMultipartPart(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("InvalidParameterValueException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody)
case strings.EqualFold("MissingParameterValueException", errorCode):
return awsRestjson1_deserializeErrorMissingParameterValueException(response, errorBody)
case strings.EqualFold("RequestTimeoutException", errorCode):
return awsRestjson1_deserializeErrorRequestTimeoutException(response, errorBody)
case strings.EqualFold("ResourceNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpHttpBindingsUploadMultipartPartOutput(v *UploadMultipartPartOutput, response *smithyhttp.Response) error {
if v == nil {
return fmt.Errorf("unsupported deserialization for nil %T", v)
}
if headerValues := response.Header.Values("x-amz-sha256-tree-hash"); len(headerValues) != 0 {
headerValues[0] = strings.TrimSpace(headerValues[0])
v.Checksum = ptr.String(headerValues[0])
}
return nil
}
func awsRestjson1_deserializeErrorInsufficientCapacityException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InsufficientCapacityException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_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 awsRestjson1_deserializeErrorInvalidParameterValueException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InvalidParameterValueException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentInvalidParameterValueException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.LimitExceededException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentLimitExceededException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorMissingParameterValueException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.MissingParameterValueException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentMissingParameterValueException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorPolicyEnforcedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.PolicyEnforcedException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentPolicyEnforcedException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorRequestTimeoutException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.RequestTimeoutException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentRequestTimeoutException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceNotFoundException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_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 awsRestjson1_deserializeErrorServiceUnavailableException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ServiceUnavailableException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
var shape interface{}
if err := decoder.Decode(&shape); err != nil && err != io.EOF {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
err := awsRestjson1_deserializeDocumentServiceUnavailableException(&output, shape)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
return output
}
func awsRestjson1_deserializeDocumentAccessControlPolicyList(v *[]types.Grant, 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.Grant
if *v == nil {
cv = []types.Grant{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Grant
destAddr := &col
if err := awsRestjson1_deserializeDocumentGrant(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentCSVInput(v **types.CSVInput, 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.CSVInput
if *v == nil {
sv = &types.CSVInput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Comments":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Comments = ptr.String(jtv)
}
case "FieldDelimiter":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.FieldDelimiter = ptr.String(jtv)
}
case "FileHeaderInfo":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected FileHeaderInfo to be of type string, got %T instead", value)
}
sv.FileHeaderInfo = types.FileHeaderInfo(jtv)
}
case "QuoteCharacter":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.QuoteCharacter = ptr.String(jtv)
}
case "QuoteEscapeCharacter":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.QuoteEscapeCharacter = ptr.String(jtv)
}
case "RecordDelimiter":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.RecordDelimiter = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentCSVOutput(v **types.CSVOutput, 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.CSVOutput
if *v == nil {
sv = &types.CSVOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "FieldDelimiter":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.FieldDelimiter = ptr.String(jtv)
}
case "QuoteCharacter":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.QuoteCharacter = ptr.String(jtv)
}
case "QuoteEscapeCharacter":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.QuoteEscapeCharacter = ptr.String(jtv)
}
case "QuoteFields":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected QuoteFields to be of type string, got %T instead", value)
}
sv.QuoteFields = types.QuoteFields(jtv)
}
case "RecordDelimiter":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.RecordDelimiter = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDataRetrievalPolicy(v **types.DataRetrievalPolicy, 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.DataRetrievalPolicy
if *v == nil {
sv = &types.DataRetrievalPolicy{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Rules":
if err := awsRestjson1_deserializeDocumentDataRetrievalRulesList(&sv.Rules, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDataRetrievalRule(v **types.DataRetrievalRule, 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.DataRetrievalRule
if *v == nil {
sv = &types.DataRetrievalRule{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "BytesPerHour":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected NullableLong to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.BytesPerHour = ptr.Int64(i64)
}
case "Strategy":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Strategy = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentDataRetrievalRulesList(v *[]types.DataRetrievalRule, 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.DataRetrievalRule
if *v == nil {
cv = []types.DataRetrievalRule{}
} else {
cv = *v
}
for _, value := range shape {
var col types.DataRetrievalRule
destAddr := &col
if err := awsRestjson1_deserializeDocumentDataRetrievalRule(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentDescribeVaultOutput(v **types.DescribeVaultOutput, 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.DescribeVaultOutput
if *v == nil {
sv = &types.DescribeVaultOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "CreationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CreationDate = ptr.String(jtv)
}
case "LastInventoryDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.LastInventoryDate = ptr.String(jtv)
}
case "NumberOfArchives":
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.NumberOfArchives = i64
}
case "SizeInBytes":
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.SizeInBytes = i64
}
case "VaultARN":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.VaultARN = ptr.String(jtv)
}
case "VaultName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.VaultName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentEncryption(v **types.Encryption, 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.Encryption
if *v == nil {
sv = &types.Encryption{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "EncryptionType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected EncryptionType to be of type string, got %T instead", value)
}
sv.EncryptionType = types.EncryptionType(jtv)
}
case "KMSContext":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.KMSContext = ptr.String(jtv)
}
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)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentGlacierJobDescription(v **types.GlacierJobDescription, 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.GlacierJobDescription
if *v == nil {
sv = &types.GlacierJobDescription{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Action":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ActionCode to be of type string, got %T instead", value)
}
sv.Action = types.ActionCode(jtv)
}
case "ArchiveId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ArchiveId = ptr.String(jtv)
}
case "ArchiveSHA256TreeHash":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ArchiveSHA256TreeHash = ptr.String(jtv)
}
case "ArchiveSizeInBytes":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Size to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.ArchiveSizeInBytes = ptr.Int64(i64)
}
case "Completed":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected boolean to be of type *bool, got %T instead", value)
}
sv.Completed = jtv
}
case "CompletionDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CompletionDate = ptr.String(jtv)
}
case "CreationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CreationDate = ptr.String(jtv)
}
case "InventoryRetrievalParameters":
if err := awsRestjson1_deserializeDocumentInventoryRetrievalJobDescription(&sv.InventoryRetrievalParameters, value); err != nil {
return err
}
case "InventorySizeInBytes":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected Size to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.InventorySizeInBytes = ptr.Int64(i64)
}
case "JobDescription":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.JobDescription = ptr.String(jtv)
}
case "JobId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.JobId = ptr.String(jtv)
}
case "JobOutputPath":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.JobOutputPath = ptr.String(jtv)
}
case "OutputLocation":
if err := awsRestjson1_deserializeDocumentOutputLocation(&sv.OutputLocation, value); err != nil {
return err
}
case "RetrievalByteRange":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.RetrievalByteRange = ptr.String(jtv)
}
case "SelectParameters":
if err := awsRestjson1_deserializeDocumentSelectParameters(&sv.SelectParameters, value); err != nil {
return err
}
case "SHA256TreeHash":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.SHA256TreeHash = ptr.String(jtv)
}
case "SNSTopic":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.SNSTopic = ptr.String(jtv)
}
case "StatusCode":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StatusCode to be of type string, got %T instead", value)
}
sv.StatusCode = types.StatusCode(jtv)
}
case "StatusMessage":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.StatusMessage = ptr.String(jtv)
}
case "Tier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Tier = ptr.String(jtv)
}
case "VaultARN":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.VaultARN = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentGrant(v **types.Grant, 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.Grant
if *v == nil {
sv = &types.Grant{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Grantee":
if err := awsRestjson1_deserializeDocumentGrantee(&sv.Grantee, value); err != nil {
return err
}
case "Permission":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Permission to be of type string, got %T instead", value)
}
sv.Permission = types.Permission(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentGrantee(v **types.Grantee, 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.Grantee
if *v == nil {
sv = &types.Grantee{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "DisplayName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.DisplayName = ptr.String(jtv)
}
case "EmailAddress":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.EmailAddress = ptr.String(jtv)
}
case "ID":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ID = ptr.String(jtv)
}
case "Type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected Type to be of type string, got %T instead", value)
}
sv.Type = types.Type(jtv)
}
case "URI":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.URI = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentHashmap(v *map[string]string, 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 mv map[string]string
if *v == nil {
mv = map[string]string{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
parsedVal = jtv
}
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_deserializeDocumentInputSerialization(v **types.InputSerialization, 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.InputSerialization
if *v == nil {
sv = &types.InputSerialization{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "csv":
if err := awsRestjson1_deserializeDocumentCSVInput(&sv.Csv, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_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 "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Type = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInvalidParameterValueException(v **types.InvalidParameterValueException, 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.InvalidParameterValueException
if *v == nil {
sv = &types.InvalidParameterValueException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Type = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInventoryRetrievalJobDescription(v **types.InventoryRetrievalJobDescription, 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.InventoryRetrievalJobDescription
if *v == nil {
sv = &types.InventoryRetrievalJobDescription{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "EndDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
sv.EndDate = ptr.String(jtv)
}
case "Format":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Format = ptr.String(jtv)
}
case "Limit":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Limit = ptr.String(jtv)
}
case "Marker":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Marker = ptr.String(jtv)
}
case "StartDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected DateTime to be of type string, got %T instead", value)
}
sv.StartDate = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentJobList(v *[]types.GlacierJobDescription, 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.GlacierJobDescription
if *v == nil {
cv = []types.GlacierJobDescription{}
} else {
cv = *v
}
for _, value := range shape {
var col types.GlacierJobDescription
destAddr := &col
if err := awsRestjson1_deserializeDocumentGlacierJobDescription(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentLimitExceededException(v **types.LimitExceededException, 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.LimitExceededException
if *v == nil {
sv = &types.LimitExceededException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Type = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentMissingParameterValueException(v **types.MissingParameterValueException, 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.MissingParameterValueException
if *v == nil {
sv = &types.MissingParameterValueException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Type = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentNotificationEventList(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 awsRestjson1_deserializeDocumentOutputLocation(v **types.OutputLocation, 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.OutputLocation
if *v == nil {
sv = &types.OutputLocation{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "S3":
if err := awsRestjson1_deserializeDocumentS3Location(&sv.S3, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentOutputSerialization(v **types.OutputSerialization, 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.OutputSerialization
if *v == nil {
sv = &types.OutputSerialization{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "csv":
if err := awsRestjson1_deserializeDocumentCSVOutput(&sv.Csv, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPartList(v *[]types.PartListElement, 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.PartListElement
if *v == nil {
cv = []types.PartListElement{}
} else {
cv = *v
}
for _, value := range shape {
var col types.PartListElement
destAddr := &col
if err := awsRestjson1_deserializeDocumentPartListElement(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentPartListElement(v **types.PartListElement, 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.PartListElement
if *v == nil {
sv = &types.PartListElement{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "RangeInBytes":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.RangeInBytes = ptr.String(jtv)
}
case "SHA256TreeHash":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.SHA256TreeHash = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPolicyEnforcedException(v **types.PolicyEnforcedException, 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.PolicyEnforcedException
if *v == nil {
sv = &types.PolicyEnforcedException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Type = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentProvisionedCapacityDescription(v **types.ProvisionedCapacityDescription, 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.ProvisionedCapacityDescription
if *v == nil {
sv = &types.ProvisionedCapacityDescription{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "CapacityId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CapacityId = ptr.String(jtv)
}
case "ExpirationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ExpirationDate = ptr.String(jtv)
}
case "StartDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.StartDate = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentProvisionedCapacityList(v *[]types.ProvisionedCapacityDescription, 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.ProvisionedCapacityDescription
if *v == nil {
cv = []types.ProvisionedCapacityDescription{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ProvisionedCapacityDescription
destAddr := &col
if err := awsRestjson1_deserializeDocumentProvisionedCapacityDescription(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentRequestTimeoutException(v **types.RequestTimeoutException, 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.RequestTimeoutException
if *v == nil {
sv = &types.RequestTimeoutException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Type = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_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 "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Type = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentS3Location(v **types.S3Location, 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.S3Location
if *v == nil {
sv = &types.S3Location{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "AccessControlList":
if err := awsRestjson1_deserializeDocumentAccessControlPolicyList(&sv.AccessControlList, value); err != nil {
return err
}
case "BucketName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.BucketName = ptr.String(jtv)
}
case "CannedACL":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected CannedACL to be of type string, got %T instead", value)
}
sv.CannedACL = types.CannedACL(jtv)
}
case "Encryption":
if err := awsRestjson1_deserializeDocumentEncryption(&sv.Encryption, value); err != nil {
return err
}
case "Prefix":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Prefix = ptr.String(jtv)
}
case "StorageClass":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected StorageClass to be of type string, got %T instead", value)
}
sv.StorageClass = types.StorageClass(jtv)
}
case "Tagging":
if err := awsRestjson1_deserializeDocumentHashmap(&sv.Tagging, value); err != nil {
return err
}
case "UserMetadata":
if err := awsRestjson1_deserializeDocumentHashmap(&sv.UserMetadata, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentSelectParameters(v **types.SelectParameters, 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.SelectParameters
if *v == nil {
sv = &types.SelectParameters{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Expression":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Expression = ptr.String(jtv)
}
case "ExpressionType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ExpressionType to be of type string, got %T instead", value)
}
sv.ExpressionType = types.ExpressionType(jtv)
}
case "InputSerialization":
if err := awsRestjson1_deserializeDocumentInputSerialization(&sv.InputSerialization, value); err != nil {
return err
}
case "OutputSerialization":
if err := awsRestjson1_deserializeDocumentOutputSerialization(&sv.OutputSerialization, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentServiceUnavailableException(v **types.ServiceUnavailableException, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.ServiceUnavailableException
if *v == nil {
sv = &types.ServiceUnavailableException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "code":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Code = ptr.String(jtv)
}
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "type":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.Type = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentTagMap(v *map[string]string, 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 mv map[string]string
if *v == nil {
mv = map[string]string{}
} else {
mv = *v
}
for key, value := range shape {
var parsedVal string
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagValue to be of type string, got %T instead", value)
}
parsedVal = jtv
}
mv[key] = parsedVal
}
*v = mv
return nil
}
func awsRestjson1_deserializeDocumentUploadListElement(v **types.UploadListElement, 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.UploadListElement
if *v == nil {
sv = &types.UploadListElement{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ArchiveDescription":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.ArchiveDescription = ptr.String(jtv)
}
case "CreationDate":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.CreationDate = ptr.String(jtv)
}
case "MultipartUploadId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.MultipartUploadId = ptr.String(jtv)
}
case "PartSizeInBytes":
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.PartSizeInBytes = i64
}
case "VaultARN":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.VaultARN = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentUploadsList(v *[]types.UploadListElement, 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.UploadListElement
if *v == nil {
cv = []types.UploadListElement{}
} else {
cv = *v
}
for _, value := range shape {
var col types.UploadListElement
destAddr := &col
if err := awsRestjson1_deserializeDocumentUploadListElement(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentVaultAccessPolicy(v **types.VaultAccessPolicy, 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.VaultAccessPolicy
if *v == nil {
sv = &types.VaultAccessPolicy{}
} 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)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentVaultList(v *[]types.DescribeVaultOutput, 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.DescribeVaultOutput
if *v == nil {
cv = []types.DescribeVaultOutput{}
} else {
cv = *v
}
for _, value := range shape {
var col types.DescribeVaultOutput
destAddr := &col
if err := awsRestjson1_deserializeDocumentDescribeVaultOutput(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentVaultNotificationConfig(v **types.VaultNotificationConfig, 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.VaultNotificationConfig
if *v == nil {
sv = &types.VaultNotificationConfig{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Events":
if err := awsRestjson1_deserializeDocumentNotificationEventList(&sv.Events, value); err != nil {
return err
}
case "SNSTopic":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected string to be of type string, got %T instead", value)
}
sv.SNSTopic = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
| 6,925 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
// Package glacier provides the API client, operations, and parameter types for
// Amazon Glacier.
//
// Amazon S3 Glacier (Glacier) is a storage solution for "cold data." Glacier is
// an extremely low-cost storage service that provides secure, durable, and
// easy-to-use storage for data backup and archival. With Glacier, customers can
// store their data cost effectively for months, years, or decades. Glacier also
// enables customers to offload the administrative burdens of operating and scaling
// storage to AWS, so they don't have to worry about capacity planning, hardware
// provisioning, data replication, hardware failure and recovery, or time-consuming
// hardware migrations. Glacier is a great storage choice when low storage cost is
// paramount and your data is rarely retrieved. If your application requires fast
// or frequent access to your data, consider using Amazon S3. For more information,
// see Amazon Simple Storage Service (Amazon S3) (http://aws.amazon.com/s3/) . You
// can store any kind of data in any format. There is no maximum limit on the total
// amount of data you can store in Glacier. If you are a first-time user of
// Glacier, we recommend that you begin by reading the following sections in the
// Amazon S3 Glacier Developer Guide:
// - What is Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/introduction.html)
// - This section of the Developer Guide describes the underlying data model, the
// operations it supports, and the AWS SDKs that you can use to interact with the
// service.
// - Getting Started with Amazon S3 Glacier (https://docs.aws.amazon.com/amazonglacier/latest/dev/amazon-glacier-getting-started.html)
// - The Getting Started section walks you through the process of creating a vault,
// uploading archives, creating jobs to download archives, retrieving the job
// output, and deleting archives.
package glacier
| 30 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
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/glacier/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 = "glacier"
}
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 glacier
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.14.13"
| 7 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
| 4 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"bytes"
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/glacier/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"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
type awsRestjson1_serializeOpAbortMultipartUpload struct {
}
func (*awsRestjson1_serializeOpAbortMultipartUpload) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpAbortMultipartUpload) 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.(*AbortMultipartUploadInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsAbortMultipartUploadInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsAbortMultipartUploadInput(v *AbortMultipartUploadInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.UploadId == nil || len(*v.UploadId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member uploadId must not be empty")}
}
if v.UploadId != nil {
if err := encoder.SetURI("uploadId").String(*v.UploadId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpAbortVaultLock struct {
}
func (*awsRestjson1_serializeOpAbortVaultLock) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpAbortVaultLock) 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.(*AbortVaultLockInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/lock-policy")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsAbortVaultLockInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsAbortVaultLockInput(v *AbortVaultLockInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpAddTagsToVault struct {
}
func (*awsRestjson1_serializeOpAddTagsToVault) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpAddTagsToVault) 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.(*AddTagsToVaultInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/tags?operation=add")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsAddTagsToVaultInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentAddTagsToVaultInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsAddTagsToVaultInput(v *AddTagsToVaultInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentAddTagsToVaultInput(v *AddTagsToVaultInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Tags != nil {
ok := object.Key("Tags")
if err := awsRestjson1_serializeDocumentTagMap(v.Tags, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpCompleteMultipartUpload struct {
}
func (*awsRestjson1_serializeOpCompleteMultipartUpload) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCompleteMultipartUpload) 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.(*CompleteMultipartUploadInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsCompleteMultipartUploadInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsCompleteMultipartUploadInput(v *CompleteMultipartUploadInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.ArchiveSize != nil && len(*v.ArchiveSize) > 0 {
locationName := "X-Amz-Archive-Size"
encoder.SetHeader(locationName).String(*v.ArchiveSize)
}
if v.Checksum != nil && len(*v.Checksum) > 0 {
locationName := "X-Amz-Sha256-Tree-Hash"
encoder.SetHeader(locationName).String(*v.Checksum)
}
if v.UploadId == nil || len(*v.UploadId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member uploadId must not be empty")}
}
if v.UploadId != nil {
if err := encoder.SetURI("uploadId").String(*v.UploadId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpCompleteVaultLock struct {
}
func (*awsRestjson1_serializeOpCompleteVaultLock) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCompleteVaultLock) 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.(*CompleteVaultLockInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/lock-policy/{lockId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsCompleteVaultLockInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsCompleteVaultLockInput(v *CompleteVaultLockInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.LockId == nil || len(*v.LockId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member lockId must not be empty")}
}
if v.LockId != nil {
if err := encoder.SetURI("lockId").String(*v.LockId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpCreateVault struct {
}
func (*awsRestjson1_serializeOpCreateVault) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCreateVault) 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.(*CreateVaultInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PUT"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsCreateVaultInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsCreateVaultInput(v *CreateVaultInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDeleteArchive struct {
}
func (*awsRestjson1_serializeOpDeleteArchive) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeleteArchive) 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.(*DeleteArchiveInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/archives/{archiveId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDeleteArchiveInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDeleteArchiveInput(v *DeleteArchiveInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.ArchiveId == nil || len(*v.ArchiveId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member archiveId must not be empty")}
}
if v.ArchiveId != nil {
if err := encoder.SetURI("archiveId").String(*v.ArchiveId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDeleteVault struct {
}
func (*awsRestjson1_serializeOpDeleteVault) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeleteVault) 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.(*DeleteVaultInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDeleteVaultInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDeleteVaultInput(v *DeleteVaultInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDeleteVaultAccessPolicy struct {
}
func (*awsRestjson1_serializeOpDeleteVaultAccessPolicy) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeleteVaultAccessPolicy) 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.(*DeleteVaultAccessPolicyInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/access-policy")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDeleteVaultAccessPolicyInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDeleteVaultAccessPolicyInput(v *DeleteVaultAccessPolicyInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDeleteVaultNotifications struct {
}
func (*awsRestjson1_serializeOpDeleteVaultNotifications) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeleteVaultNotifications) 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.(*DeleteVaultNotificationsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/notification-configuration")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "DELETE"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDeleteVaultNotificationsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDeleteVaultNotificationsInput(v *DeleteVaultNotificationsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDescribeJob struct {
}
func (*awsRestjson1_serializeOpDescribeJob) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDescribeJob) 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.(*DescribeJobInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/jobs/{jobId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDescribeJobInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDescribeJobInput(v *DescribeJobInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.JobId == nil || len(*v.JobId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member jobId must not be empty")}
}
if v.JobId != nil {
if err := encoder.SetURI("jobId").String(*v.JobId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDescribeVault struct {
}
func (*awsRestjson1_serializeOpDescribeVault) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDescribeVault) 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.(*DescribeVaultInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsDescribeVaultInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsDescribeVaultInput(v *DescribeVaultInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetDataRetrievalPolicy struct {
}
func (*awsRestjson1_serializeOpGetDataRetrievalPolicy) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetDataRetrievalPolicy) 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.(*GetDataRetrievalPolicyInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/policies/data-retrieval")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetDataRetrievalPolicyInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetDataRetrievalPolicyInput(v *GetDataRetrievalPolicyInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetJobOutput struct {
}
func (*awsRestjson1_serializeOpGetJobOutput) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetJobOutput) 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.(*GetJobOutputInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/jobs/{jobId}/output")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetJobOutputInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetJobOutputInput(v *GetJobOutputInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.JobId == nil || len(*v.JobId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member jobId must not be empty")}
}
if v.JobId != nil {
if err := encoder.SetURI("jobId").String(*v.JobId); err != nil {
return err
}
}
if v.Range != nil && len(*v.Range) > 0 {
locationName := "Range"
encoder.SetHeader(locationName).String(*v.Range)
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetVaultAccessPolicy struct {
}
func (*awsRestjson1_serializeOpGetVaultAccessPolicy) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetVaultAccessPolicy) 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.(*GetVaultAccessPolicyInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/access-policy")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetVaultAccessPolicyInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetVaultAccessPolicyInput(v *GetVaultAccessPolicyInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetVaultLock struct {
}
func (*awsRestjson1_serializeOpGetVaultLock) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetVaultLock) 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.(*GetVaultLockInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/lock-policy")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetVaultLockInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetVaultLockInput(v *GetVaultLockInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetVaultNotifications struct {
}
func (*awsRestjson1_serializeOpGetVaultNotifications) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetVaultNotifications) 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.(*GetVaultNotificationsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/notification-configuration")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsGetVaultNotificationsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsGetVaultNotificationsInput(v *GetVaultNotificationsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpInitiateJob struct {
}
func (*awsRestjson1_serializeOpInitiateJob) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpInitiateJob) 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.(*InitiateJobInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/jobs")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsInitiateJobInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if !restEncoder.HasHeader("Content-Type") {
ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true)
restEncoder.SetHeader("Content-Type").String("application/json")
}
if input.JobParameters != nil {
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeDocumentJobParameters(input.JobParameters, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
payload := bytes.NewReader(jsonEncoder.Bytes())
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
} else {
jsonEncoder := smithyjson.NewEncoder()
jsonEncoder.Value.Object().Close()
payload := bytes.NewReader(jsonEncoder.Bytes())
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsInitiateJobInput(v *InitiateJobInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpInitiateMultipartUpload struct {
}
func (*awsRestjson1_serializeOpInitiateMultipartUpload) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpInitiateMultipartUpload) 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.(*InitiateMultipartUploadInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/multipart-uploads")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsInitiateMultipartUploadInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsInitiateMultipartUploadInput(v *InitiateMultipartUploadInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.ArchiveDescription != nil && len(*v.ArchiveDescription) > 0 {
locationName := "X-Amz-Archive-Description"
encoder.SetHeader(locationName).String(*v.ArchiveDescription)
}
if v.PartSize != nil && len(*v.PartSize) > 0 {
locationName := "X-Amz-Part-Size"
encoder.SetHeader(locationName).String(*v.PartSize)
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpInitiateVaultLock struct {
}
func (*awsRestjson1_serializeOpInitiateVaultLock) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpInitiateVaultLock) 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.(*InitiateVaultLockInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/lock-policy")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsInitiateVaultLockInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if !restEncoder.HasHeader("Content-Type") {
ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true)
restEncoder.SetHeader("Content-Type").String("application/json")
}
if input.Policy != nil {
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeDocumentVaultLockPolicy(input.Policy, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
payload := bytes.NewReader(jsonEncoder.Bytes())
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
} else {
jsonEncoder := smithyjson.NewEncoder()
jsonEncoder.Value.Object().Close()
payload := bytes.NewReader(jsonEncoder.Bytes())
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsInitiateVaultLockInput(v *InitiateVaultLockInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListJobs struct {
}
func (*awsRestjson1_serializeOpListJobs) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListJobs) 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.(*ListJobsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/jobs")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListJobsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListJobsInput(v *ListJobsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.Completed != nil {
encoder.SetQuery("completed").String(*v.Completed)
}
if v.Limit != nil {
encoder.SetQuery("limit").Integer(*v.Limit)
}
if v.Marker != nil {
encoder.SetQuery("marker").String(*v.Marker)
}
if v.Statuscode != nil {
encoder.SetQuery("statuscode").String(*v.Statuscode)
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListMultipartUploads struct {
}
func (*awsRestjson1_serializeOpListMultipartUploads) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListMultipartUploads) 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.(*ListMultipartUploadsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/multipart-uploads")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListMultipartUploadsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListMultipartUploadsInput(v *ListMultipartUploadsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.Limit != nil {
encoder.SetQuery("limit").Integer(*v.Limit)
}
if v.Marker != nil {
encoder.SetQuery("marker").String(*v.Marker)
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListParts struct {
}
func (*awsRestjson1_serializeOpListParts) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListParts) 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.(*ListPartsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListPartsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListPartsInput(v *ListPartsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.Limit != nil {
encoder.SetQuery("limit").Integer(*v.Limit)
}
if v.Marker != nil {
encoder.SetQuery("marker").String(*v.Marker)
}
if v.UploadId == nil || len(*v.UploadId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member uploadId must not be empty")}
}
if v.UploadId != nil {
if err := encoder.SetURI("uploadId").String(*v.UploadId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListProvisionedCapacity struct {
}
func (*awsRestjson1_serializeOpListProvisionedCapacity) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListProvisionedCapacity) 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.(*ListProvisionedCapacityInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/provisioned-capacity")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListProvisionedCapacityInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListProvisionedCapacityInput(v *ListProvisionedCapacityInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListTagsForVault struct {
}
func (*awsRestjson1_serializeOpListTagsForVault) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListTagsForVault) 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.(*ListTagsForVaultInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/tags")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListTagsForVaultInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListTagsForVaultInput(v *ListTagsForVaultInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListVaults struct {
}
func (*awsRestjson1_serializeOpListVaults) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListVaults) 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.(*ListVaultsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "GET"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsListVaultsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsListVaultsInput(v *ListVaultsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.Limit != nil {
encoder.SetQuery("limit").Integer(*v.Limit)
}
if v.Marker != nil {
encoder.SetQuery("marker").String(*v.Marker)
}
return nil
}
type awsRestjson1_serializeOpPurchaseProvisionedCapacity struct {
}
func (*awsRestjson1_serializeOpPurchaseProvisionedCapacity) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpPurchaseProvisionedCapacity) 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.(*PurchaseProvisionedCapacityInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/provisioned-capacity")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsPurchaseProvisionedCapacityInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsPurchaseProvisionedCapacityInput(v *PurchaseProvisionedCapacityInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpRemoveTagsFromVault struct {
}
func (*awsRestjson1_serializeOpRemoveTagsFromVault) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpRemoveTagsFromVault) 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.(*RemoveTagsFromVaultInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/tags?operation=remove")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsRemoveTagsFromVaultInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentRemoveTagsFromVaultInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsRemoveTagsFromVaultInput(v *RemoveTagsFromVaultInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentRemoveTagsFromVaultInput(v *RemoveTagsFromVaultInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.TagKeys != nil {
ok := object.Key("TagKeys")
if err := awsRestjson1_serializeDocumentTagKeyList(v.TagKeys, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpSetDataRetrievalPolicy struct {
}
func (*awsRestjson1_serializeOpSetDataRetrievalPolicy) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpSetDataRetrievalPolicy) 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.(*SetDataRetrievalPolicyInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/policies/data-retrieval")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PUT"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsSetDataRetrievalPolicyInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentSetDataRetrievalPolicyInput(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 = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsSetDataRetrievalPolicyInput(v *SetDataRetrievalPolicyInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentSetDataRetrievalPolicyInput(v *SetDataRetrievalPolicyInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Policy != nil {
ok := object.Key("Policy")
if err := awsRestjson1_serializeDocumentDataRetrievalPolicy(v.Policy, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpSetVaultAccessPolicy struct {
}
func (*awsRestjson1_serializeOpSetVaultAccessPolicy) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpSetVaultAccessPolicy) 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.(*SetVaultAccessPolicyInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/access-policy")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PUT"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsSetVaultAccessPolicyInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if !restEncoder.HasHeader("Content-Type") {
ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true)
restEncoder.SetHeader("Content-Type").String("application/json")
}
if input.Policy != nil {
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeDocumentVaultAccessPolicy(input.Policy, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
payload := bytes.NewReader(jsonEncoder.Bytes())
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
} else {
jsonEncoder := smithyjson.NewEncoder()
jsonEncoder.Value.Object().Close()
payload := bytes.NewReader(jsonEncoder.Bytes())
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsSetVaultAccessPolicyInput(v *SetVaultAccessPolicyInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpSetVaultNotifications struct {
}
func (*awsRestjson1_serializeOpSetVaultNotifications) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpSetVaultNotifications) 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.(*SetVaultNotificationsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/notification-configuration")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PUT"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsSetVaultNotificationsInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if !restEncoder.HasHeader("Content-Type") {
ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true)
restEncoder.SetHeader("Content-Type").String("application/json")
}
if input.VaultNotificationConfig != nil {
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeDocumentVaultNotificationConfig(input.VaultNotificationConfig, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
payload := bytes.NewReader(jsonEncoder.Bytes())
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
} else {
jsonEncoder := smithyjson.NewEncoder()
jsonEncoder.Value.Object().Close()
payload := bytes.NewReader(jsonEncoder.Bytes())
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsSetVaultNotificationsInput(v *SetVaultNotificationsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpUploadArchive struct {
}
func (*awsRestjson1_serializeOpUploadArchive) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpUploadArchive) 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.(*UploadArchiveInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/archives")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "POST"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsUploadArchiveInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if !restEncoder.HasHeader("Content-Type") {
ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true)
restEncoder.SetHeader("Content-Type").String("application/octet-stream")
}
if input.Body != nil {
payload := input.Body
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsUploadArchiveInput(v *UploadArchiveInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.ArchiveDescription != nil && len(*v.ArchiveDescription) > 0 {
locationName := "X-Amz-Archive-Description"
encoder.SetHeader(locationName).String(*v.ArchiveDescription)
}
if v.Checksum != nil && len(*v.Checksum) > 0 {
locationName := "X-Amz-Sha256-Tree-Hash"
encoder.SetHeader(locationName).String(*v.Checksum)
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpUploadMultipartPart struct {
}
func (*awsRestjson1_serializeOpUploadMultipartPart) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpUploadMultipartPart) 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.(*UploadMultipartPartInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}")
request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
request.Method = "PUT"
restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
if err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if err := awsRestjson1_serializeOpHttpBindingsUploadMultipartPartInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if !restEncoder.HasHeader("Content-Type") {
ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true)
restEncoder.SetHeader("Content-Type").String("application/octet-stream")
}
if input.Body != nil {
payload := input.Body
if request, err = request.SetStream(payload); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
}
if request.Request, err = restEncoder.Encode(request.Request); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
in.Request = request
return next.HandleSerialize(ctx, in)
}
func awsRestjson1_serializeOpHttpBindingsUploadMultipartPartInput(v *UploadMultipartPartInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.AccountId == nil || len(*v.AccountId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member accountId must not be empty")}
}
if v.AccountId != nil {
if err := encoder.SetURI("accountId").String(*v.AccountId); err != nil {
return err
}
}
if v.Checksum != nil && len(*v.Checksum) > 0 {
locationName := "X-Amz-Sha256-Tree-Hash"
encoder.SetHeader(locationName).String(*v.Checksum)
}
if v.Range != nil && len(*v.Range) > 0 {
locationName := "Content-Range"
encoder.SetHeader(locationName).String(*v.Range)
}
if v.UploadId == nil || len(*v.UploadId) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member uploadId must not be empty")}
}
if v.UploadId != nil {
if err := encoder.SetURI("uploadId").String(*v.UploadId); err != nil {
return err
}
}
if v.VaultName == nil || len(*v.VaultName) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member vaultName must not be empty")}
}
if v.VaultName != nil {
if err := encoder.SetURI("vaultName").String(*v.VaultName); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentAccessControlPolicyList(v []types.Grant, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsRestjson1_serializeDocumentGrant(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentCSVInput(v *types.CSVInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Comments != nil {
ok := object.Key("Comments")
ok.String(*v.Comments)
}
if v.FieldDelimiter != nil {
ok := object.Key("FieldDelimiter")
ok.String(*v.FieldDelimiter)
}
if len(v.FileHeaderInfo) > 0 {
ok := object.Key("FileHeaderInfo")
ok.String(string(v.FileHeaderInfo))
}
if v.QuoteCharacter != nil {
ok := object.Key("QuoteCharacter")
ok.String(*v.QuoteCharacter)
}
if v.QuoteEscapeCharacter != nil {
ok := object.Key("QuoteEscapeCharacter")
ok.String(*v.QuoteEscapeCharacter)
}
if v.RecordDelimiter != nil {
ok := object.Key("RecordDelimiter")
ok.String(*v.RecordDelimiter)
}
return nil
}
func awsRestjson1_serializeDocumentCSVOutput(v *types.CSVOutput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.FieldDelimiter != nil {
ok := object.Key("FieldDelimiter")
ok.String(*v.FieldDelimiter)
}
if v.QuoteCharacter != nil {
ok := object.Key("QuoteCharacter")
ok.String(*v.QuoteCharacter)
}
if v.QuoteEscapeCharacter != nil {
ok := object.Key("QuoteEscapeCharacter")
ok.String(*v.QuoteEscapeCharacter)
}
if len(v.QuoteFields) > 0 {
ok := object.Key("QuoteFields")
ok.String(string(v.QuoteFields))
}
if v.RecordDelimiter != nil {
ok := object.Key("RecordDelimiter")
ok.String(*v.RecordDelimiter)
}
return nil
}
func awsRestjson1_serializeDocumentDataRetrievalPolicy(v *types.DataRetrievalPolicy, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Rules != nil {
ok := object.Key("Rules")
if err := awsRestjson1_serializeDocumentDataRetrievalRulesList(v.Rules, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentDataRetrievalRule(v *types.DataRetrievalRule, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.BytesPerHour != nil {
ok := object.Key("BytesPerHour")
ok.Long(*v.BytesPerHour)
}
if v.Strategy != nil {
ok := object.Key("Strategy")
ok.String(*v.Strategy)
}
return nil
}
func awsRestjson1_serializeDocumentDataRetrievalRulesList(v []types.DataRetrievalRule, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsRestjson1_serializeDocumentDataRetrievalRule(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentEncryption(v *types.Encryption, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.EncryptionType) > 0 {
ok := object.Key("EncryptionType")
ok.String(string(v.EncryptionType))
}
if v.KMSContext != nil {
ok := object.Key("KMSContext")
ok.String(*v.KMSContext)
}
if v.KMSKeyId != nil {
ok := object.Key("KMSKeyId")
ok.String(*v.KMSKeyId)
}
return nil
}
func awsRestjson1_serializeDocumentGrant(v *types.Grant, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Grantee != nil {
ok := object.Key("Grantee")
if err := awsRestjson1_serializeDocumentGrantee(v.Grantee, ok); err != nil {
return err
}
}
if len(v.Permission) > 0 {
ok := object.Key("Permission")
ok.String(string(v.Permission))
}
return nil
}
func awsRestjson1_serializeDocumentGrantee(v *types.Grantee, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.DisplayName != nil {
ok := object.Key("DisplayName")
ok.String(*v.DisplayName)
}
if v.EmailAddress != nil {
ok := object.Key("EmailAddress")
ok.String(*v.EmailAddress)
}
if v.ID != nil {
ok := object.Key("ID")
ok.String(*v.ID)
}
if len(v.Type) > 0 {
ok := object.Key("Type")
ok.String(string(v.Type))
}
if v.URI != nil {
ok := object.Key("URI")
ok.String(*v.URI)
}
return nil
}
func awsRestjson1_serializeDocumentHashmap(v map[string]string, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
for key := range v {
om := object.Key(key)
om.String(v[key])
}
return nil
}
func awsRestjson1_serializeDocumentInputSerialization(v *types.InputSerialization, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Csv != nil {
ok := object.Key("csv")
if err := awsRestjson1_serializeDocumentCSVInput(v.Csv, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentInventoryRetrievalJobInput(v *types.InventoryRetrievalJobInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.EndDate != nil {
ok := object.Key("EndDate")
ok.String(*v.EndDate)
}
if v.Limit != nil {
ok := object.Key("Limit")
ok.String(*v.Limit)
}
if v.Marker != nil {
ok := object.Key("Marker")
ok.String(*v.Marker)
}
if v.StartDate != nil {
ok := object.Key("StartDate")
ok.String(*v.StartDate)
}
return nil
}
func awsRestjson1_serializeDocumentJobParameters(v *types.JobParameters, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ArchiveId != nil {
ok := object.Key("ArchiveId")
ok.String(*v.ArchiveId)
}
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
if v.Format != nil {
ok := object.Key("Format")
ok.String(*v.Format)
}
if v.InventoryRetrievalParameters != nil {
ok := object.Key("InventoryRetrievalParameters")
if err := awsRestjson1_serializeDocumentInventoryRetrievalJobInput(v.InventoryRetrievalParameters, ok); err != nil {
return err
}
}
if v.OutputLocation != nil {
ok := object.Key("OutputLocation")
if err := awsRestjson1_serializeDocumentOutputLocation(v.OutputLocation, ok); err != nil {
return err
}
}
if v.RetrievalByteRange != nil {
ok := object.Key("RetrievalByteRange")
ok.String(*v.RetrievalByteRange)
}
if v.SelectParameters != nil {
ok := object.Key("SelectParameters")
if err := awsRestjson1_serializeDocumentSelectParameters(v.SelectParameters, ok); err != nil {
return err
}
}
if v.SNSTopic != nil {
ok := object.Key("SNSTopic")
ok.String(*v.SNSTopic)
}
if v.Tier != nil {
ok := object.Key("Tier")
ok.String(*v.Tier)
}
if v.Type != nil {
ok := object.Key("Type")
ok.String(*v.Type)
}
return nil
}
func awsRestjson1_serializeDocumentNotificationEventList(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 awsRestjson1_serializeDocumentOutputLocation(v *types.OutputLocation, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.S3 != nil {
ok := object.Key("S3")
if err := awsRestjson1_serializeDocumentS3Location(v.S3, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentOutputSerialization(v *types.OutputSerialization, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Csv != nil {
ok := object.Key("csv")
if err := awsRestjson1_serializeDocumentCSVOutput(v.Csv, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentS3Location(v *types.S3Location, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.AccessControlList != nil {
ok := object.Key("AccessControlList")
if err := awsRestjson1_serializeDocumentAccessControlPolicyList(v.AccessControlList, ok); err != nil {
return err
}
}
if v.BucketName != nil {
ok := object.Key("BucketName")
ok.String(*v.BucketName)
}
if len(v.CannedACL) > 0 {
ok := object.Key("CannedACL")
ok.String(string(v.CannedACL))
}
if v.Encryption != nil {
ok := object.Key("Encryption")
if err := awsRestjson1_serializeDocumentEncryption(v.Encryption, ok); err != nil {
return err
}
}
if v.Prefix != nil {
ok := object.Key("Prefix")
ok.String(*v.Prefix)
}
if len(v.StorageClass) > 0 {
ok := object.Key("StorageClass")
ok.String(string(v.StorageClass))
}
if v.Tagging != nil {
ok := object.Key("Tagging")
if err := awsRestjson1_serializeDocumentHashmap(v.Tagging, ok); err != nil {
return err
}
}
if v.UserMetadata != nil {
ok := object.Key("UserMetadata")
if err := awsRestjson1_serializeDocumentHashmap(v.UserMetadata, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentSelectParameters(v *types.SelectParameters, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Expression != nil {
ok := object.Key("Expression")
ok.String(*v.Expression)
}
if len(v.ExpressionType) > 0 {
ok := object.Key("ExpressionType")
ok.String(string(v.ExpressionType))
}
if v.InputSerialization != nil {
ok := object.Key("InputSerialization")
if err := awsRestjson1_serializeDocumentInputSerialization(v.InputSerialization, ok); err != nil {
return err
}
}
if v.OutputSerialization != nil {
ok := object.Key("OutputSerialization")
if err := awsRestjson1_serializeDocumentOutputSerialization(v.OutputSerialization, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_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 awsRestjson1_serializeDocumentTagMap(v map[string]string, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
for key := range v {
om := object.Key(key)
om.String(v[key])
}
return nil
}
func awsRestjson1_serializeDocumentVaultAccessPolicy(v *types.VaultAccessPolicy, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Policy != nil {
ok := object.Key("Policy")
ok.String(*v.Policy)
}
return nil
}
func awsRestjson1_serializeDocumentVaultLockPolicy(v *types.VaultLockPolicy, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Policy != nil {
ok := object.Key("Policy")
ok.String(*v.Policy)
}
return nil
}
func awsRestjson1_serializeDocumentVaultNotificationConfig(v *types.VaultNotificationConfig, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Events != nil {
ok := object.Key("Events")
if err := awsRestjson1_serializeDocumentNotificationEventList(v.Events, ok); err != nil {
return err
}
}
if v.SNSTopic != nil {
ok := object.Key("SNSTopic")
ok.String(*v.SNSTopic)
}
return nil
}
| 3,038 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package glacier
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/glacier/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
)
type validateOpAbortMultipartUpload struct {
}
func (*validateOpAbortMultipartUpload) ID() string {
return "OperationInputValidation"
}
func (m *validateOpAbortMultipartUpload) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*AbortMultipartUploadInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpAbortMultipartUploadInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpAbortVaultLock struct {
}
func (*validateOpAbortVaultLock) ID() string {
return "OperationInputValidation"
}
func (m *validateOpAbortVaultLock) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*AbortVaultLockInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpAbortVaultLockInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpAddTagsToVault struct {
}
func (*validateOpAddTagsToVault) ID() string {
return "OperationInputValidation"
}
func (m *validateOpAddTagsToVault) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*AddTagsToVaultInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpAddTagsToVaultInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCompleteMultipartUpload struct {
}
func (*validateOpCompleteMultipartUpload) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCompleteMultipartUpload) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CompleteMultipartUploadInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCompleteMultipartUploadInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCompleteVaultLock struct {
}
func (*validateOpCompleteVaultLock) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCompleteVaultLock) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CompleteVaultLockInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCompleteVaultLockInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreateVault struct {
}
func (*validateOpCreateVault) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateVault) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateVaultInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateVaultInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteArchive struct {
}
func (*validateOpDeleteArchive) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteArchive) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteArchiveInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteArchiveInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteVaultAccessPolicy struct {
}
func (*validateOpDeleteVaultAccessPolicy) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteVaultAccessPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteVaultAccessPolicyInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteVaultAccessPolicyInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteVault struct {
}
func (*validateOpDeleteVault) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteVault) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteVaultInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteVaultInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteVaultNotifications struct {
}
func (*validateOpDeleteVaultNotifications) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteVaultNotifications) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteVaultNotificationsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteVaultNotificationsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDescribeJob struct {
}
func (*validateOpDescribeJob) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDescribeJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DescribeJobInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDescribeJobInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDescribeVault struct {
}
func (*validateOpDescribeVault) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDescribeVault) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DescribeVaultInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDescribeVaultInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetDataRetrievalPolicy struct {
}
func (*validateOpGetDataRetrievalPolicy) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetDataRetrievalPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetDataRetrievalPolicyInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetDataRetrievalPolicyInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetJobOutput struct {
}
func (*validateOpGetJobOutput) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetJobOutput) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetJobOutputInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetJobOutputInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetVaultAccessPolicy struct {
}
func (*validateOpGetVaultAccessPolicy) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetVaultAccessPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetVaultAccessPolicyInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetVaultAccessPolicyInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetVaultLock struct {
}
func (*validateOpGetVaultLock) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetVaultLock) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetVaultLockInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetVaultLockInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetVaultNotifications struct {
}
func (*validateOpGetVaultNotifications) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetVaultNotifications) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetVaultNotificationsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetVaultNotificationsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpInitiateJob struct {
}
func (*validateOpInitiateJob) ID() string {
return "OperationInputValidation"
}
func (m *validateOpInitiateJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*InitiateJobInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpInitiateJobInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpInitiateMultipartUpload struct {
}
func (*validateOpInitiateMultipartUpload) ID() string {
return "OperationInputValidation"
}
func (m *validateOpInitiateMultipartUpload) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*InitiateMultipartUploadInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpInitiateMultipartUploadInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpInitiateVaultLock struct {
}
func (*validateOpInitiateVaultLock) ID() string {
return "OperationInputValidation"
}
func (m *validateOpInitiateVaultLock) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*InitiateVaultLockInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpInitiateVaultLockInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListJobs struct {
}
func (*validateOpListJobs) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListJobs) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListJobsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListJobsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListMultipartUploads struct {
}
func (*validateOpListMultipartUploads) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListMultipartUploads) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListMultipartUploadsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListMultipartUploadsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListParts struct {
}
func (*validateOpListParts) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListParts) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListPartsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListPartsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListProvisionedCapacity struct {
}
func (*validateOpListProvisionedCapacity) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListProvisionedCapacity) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListProvisionedCapacityInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListProvisionedCapacityInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListTagsForVault struct {
}
func (*validateOpListTagsForVault) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListTagsForVault) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListTagsForVaultInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListTagsForVaultInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListVaults struct {
}
func (*validateOpListVaults) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListVaults) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListVaultsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListVaultsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpPurchaseProvisionedCapacity struct {
}
func (*validateOpPurchaseProvisionedCapacity) ID() string {
return "OperationInputValidation"
}
func (m *validateOpPurchaseProvisionedCapacity) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*PurchaseProvisionedCapacityInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpPurchaseProvisionedCapacityInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpRemoveTagsFromVault struct {
}
func (*validateOpRemoveTagsFromVault) ID() string {
return "OperationInputValidation"
}
func (m *validateOpRemoveTagsFromVault) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*RemoveTagsFromVaultInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpRemoveTagsFromVaultInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpSetDataRetrievalPolicy struct {
}
func (*validateOpSetDataRetrievalPolicy) ID() string {
return "OperationInputValidation"
}
func (m *validateOpSetDataRetrievalPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*SetDataRetrievalPolicyInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpSetDataRetrievalPolicyInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpSetVaultAccessPolicy struct {
}
func (*validateOpSetVaultAccessPolicy) ID() string {
return "OperationInputValidation"
}
func (m *validateOpSetVaultAccessPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*SetVaultAccessPolicyInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpSetVaultAccessPolicyInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpSetVaultNotifications struct {
}
func (*validateOpSetVaultNotifications) ID() string {
return "OperationInputValidation"
}
func (m *validateOpSetVaultNotifications) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*SetVaultNotificationsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpSetVaultNotificationsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUploadArchive struct {
}
func (*validateOpUploadArchive) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUploadArchive) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UploadArchiveInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUploadArchiveInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpUploadMultipartPart struct {
}
func (*validateOpUploadMultipartPart) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUploadMultipartPart) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UploadMultipartPartInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUploadMultipartPartInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
func addOpAbortMultipartUploadValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpAbortMultipartUpload{}, middleware.After)
}
func addOpAbortVaultLockValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpAbortVaultLock{}, middleware.After)
}
func addOpAddTagsToVaultValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpAddTagsToVault{}, middleware.After)
}
func addOpCompleteMultipartUploadValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCompleteMultipartUpload{}, middleware.After)
}
func addOpCompleteVaultLockValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCompleteVaultLock{}, middleware.After)
}
func addOpCreateVaultValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateVault{}, middleware.After)
}
func addOpDeleteArchiveValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteArchive{}, middleware.After)
}
func addOpDeleteVaultAccessPolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteVaultAccessPolicy{}, middleware.After)
}
func addOpDeleteVaultValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteVault{}, middleware.After)
}
func addOpDeleteVaultNotificationsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteVaultNotifications{}, middleware.After)
}
func addOpDescribeJobValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDescribeJob{}, middleware.After)
}
func addOpDescribeVaultValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDescribeVault{}, middleware.After)
}
func addOpGetDataRetrievalPolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetDataRetrievalPolicy{}, middleware.After)
}
func addOpGetJobOutputValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetJobOutput{}, middleware.After)
}
func addOpGetVaultAccessPolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetVaultAccessPolicy{}, middleware.After)
}
func addOpGetVaultLockValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetVaultLock{}, middleware.After)
}
func addOpGetVaultNotificationsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetVaultNotifications{}, middleware.After)
}
func addOpInitiateJobValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpInitiateJob{}, middleware.After)
}
func addOpInitiateMultipartUploadValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpInitiateMultipartUpload{}, middleware.After)
}
func addOpInitiateVaultLockValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpInitiateVaultLock{}, middleware.After)
}
func addOpListJobsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListJobs{}, middleware.After)
}
func addOpListMultipartUploadsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListMultipartUploads{}, middleware.After)
}
func addOpListPartsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListParts{}, middleware.After)
}
func addOpListProvisionedCapacityValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListProvisionedCapacity{}, middleware.After)
}
func addOpListTagsForVaultValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListTagsForVault{}, middleware.After)
}
func addOpListVaultsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListVaults{}, middleware.After)
}
func addOpPurchaseProvisionedCapacityValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpPurchaseProvisionedCapacity{}, middleware.After)
}
func addOpRemoveTagsFromVaultValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpRemoveTagsFromVault{}, middleware.After)
}
func addOpSetDataRetrievalPolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpSetDataRetrievalPolicy{}, middleware.After)
}
func addOpSetVaultAccessPolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpSetVaultAccessPolicy{}, middleware.After)
}
func addOpSetVaultNotificationsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpSetVaultNotifications{}, middleware.After)
}
func addOpUploadArchiveValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUploadArchive{}, middleware.After)
}
func addOpUploadMultipartPartValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUploadMultipartPart{}, middleware.After)
}
func validateAccessControlPolicyList(v []types.Grant) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "AccessControlPolicyList"}
for i := range v {
if err := validateGrant(&v[i]); err != nil {
invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateGrant(v *types.Grant) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "Grant"}
if v.Grantee != nil {
if err := validateGrantee(v.Grantee); err != nil {
invalidParams.AddNested("Grantee", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateGrantee(v *types.Grantee) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "Grantee"}
if len(v.Type) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("Type"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateJobParameters(v *types.JobParameters) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "JobParameters"}
if v.OutputLocation != nil {
if err := validateOutputLocation(v.OutputLocation); err != nil {
invalidParams.AddNested("OutputLocation", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOutputLocation(v *types.OutputLocation) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "OutputLocation"}
if v.S3 != nil {
if err := validateS3Location(v.S3); err != nil {
invalidParams.AddNested("S3", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateS3Location(v *types.S3Location) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "S3Location"}
if v.AccessControlList != nil {
if err := validateAccessControlPolicyList(v.AccessControlList); err != nil {
invalidParams.AddNested("AccessControlList", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpAbortMultipartUploadInput(v *AbortMultipartUploadInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "AbortMultipartUploadInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.UploadId == nil {
invalidParams.Add(smithy.NewErrParamRequired("UploadId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpAbortVaultLockInput(v *AbortVaultLockInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "AbortVaultLockInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpAddTagsToVaultInput(v *AddTagsToVaultInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "AddTagsToVaultInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCompleteMultipartUploadInput(v *CompleteMultipartUploadInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CompleteMultipartUploadInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.UploadId == nil {
invalidParams.Add(smithy.NewErrParamRequired("UploadId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCompleteVaultLockInput(v *CompleteVaultLockInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CompleteVaultLockInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.LockId == nil {
invalidParams.Add(smithy.NewErrParamRequired("LockId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateVaultInput(v *CreateVaultInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateVaultInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteArchiveInput(v *DeleteArchiveInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteArchiveInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.ArchiveId == nil {
invalidParams.Add(smithy.NewErrParamRequired("ArchiveId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteVaultAccessPolicyInput(v *DeleteVaultAccessPolicyInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteVaultAccessPolicyInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteVaultInput(v *DeleteVaultInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteVaultInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteVaultNotificationsInput(v *DeleteVaultNotificationsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteVaultNotificationsInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDescribeJobInput(v *DescribeJobInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DescribeJobInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.JobId == nil {
invalidParams.Add(smithy.NewErrParamRequired("JobId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDescribeVaultInput(v *DescribeVaultInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DescribeVaultInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetDataRetrievalPolicyInput(v *GetDataRetrievalPolicyInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetDataRetrievalPolicyInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetJobOutputInput(v *GetJobOutputInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetJobOutputInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.JobId == nil {
invalidParams.Add(smithy.NewErrParamRequired("JobId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetVaultAccessPolicyInput(v *GetVaultAccessPolicyInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetVaultAccessPolicyInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetVaultLockInput(v *GetVaultLockInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetVaultLockInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetVaultNotificationsInput(v *GetVaultNotificationsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetVaultNotificationsInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpInitiateJobInput(v *InitiateJobInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "InitiateJobInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.JobParameters != nil {
if err := validateJobParameters(v.JobParameters); err != nil {
invalidParams.AddNested("JobParameters", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpInitiateMultipartUploadInput(v *InitiateMultipartUploadInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "InitiateMultipartUploadInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpInitiateVaultLockInput(v *InitiateVaultLockInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "InitiateVaultLockInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListJobsInput(v *ListJobsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListJobsInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListMultipartUploadsInput(v *ListMultipartUploadsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListMultipartUploadsInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListPartsInput(v *ListPartsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListPartsInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.UploadId == nil {
invalidParams.Add(smithy.NewErrParamRequired("UploadId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListProvisionedCapacityInput(v *ListProvisionedCapacityInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListProvisionedCapacityInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListTagsForVaultInput(v *ListTagsForVaultInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListTagsForVaultInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListVaultsInput(v *ListVaultsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListVaultsInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpPurchaseProvisionedCapacityInput(v *PurchaseProvisionedCapacityInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "PurchaseProvisionedCapacityInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpRemoveTagsFromVaultInput(v *RemoveTagsFromVaultInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "RemoveTagsFromVaultInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpSetDataRetrievalPolicyInput(v *SetDataRetrievalPolicyInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "SetDataRetrievalPolicyInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpSetVaultAccessPolicyInput(v *SetVaultAccessPolicyInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "SetVaultAccessPolicyInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpSetVaultNotificationsInput(v *SetVaultNotificationsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "SetVaultNotificationsInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUploadArchiveInput(v *UploadArchiveInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UploadArchiveInput"}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUploadMultipartPartInput(v *UploadMultipartPartInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UploadMultipartPartInput"}
if v.AccountId == nil {
invalidParams.Add(smithy.NewErrParamRequired("AccountId"))
}
if v.VaultName == nil {
invalidParams.Add(smithy.NewErrParamRequired("VaultName"))
}
if v.UploadId == nil {
invalidParams.Add(smithy.NewErrParamRequired("UploadId"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
| 1,512 |
aws-sdk-go-v2 | aws | Go | package customizations
import (
"context"
"github.com/aws/smithy-go/middleware"
)
type setDefaultAccountID func(input interface{}, accountID string) interface{}
// AddDefaultAccountIDMiddleware adds the DefaultAccountID to the stack using
// the given options.
func AddDefaultAccountIDMiddleware(stack *middleware.Stack, setDefaultAccountID setDefaultAccountID) error {
return stack.Initialize.Add(&DefaultAccountID{
setDefaultAccountID: setDefaultAccountID,
}, middleware.Before)
}
// DefaultAccountID sets the account ID to "-" if it isn't already set
type DefaultAccountID struct {
setDefaultAccountID setDefaultAccountID
}
// ID returns the id of the middleware
func (*DefaultAccountID) ID() string {
return "Glacier:DefaultAccountID"
}
// HandleInitialize implements the InitializeMiddleware interface
func (m *DefaultAccountID) HandleInitialize(
ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
in.Parameters = m.setDefaultAccountID(in.Parameters, "-")
return next.HandleInitialize(ctx, in)
}
| 38 |
aws-sdk-go-v2 | aws | Go | package customizations
import (
"context"
"testing"
"github.com/aws/smithy-go/middleware"
)
type accountIDBearer struct {
AccountID *string
}
func TestDefaultAccountIDMiddleware(t *testing.T) {
m := &DefaultAccountID{
setDefaultAccountID: func(input interface{}, defaultAccountID string) interface{} {
if bearer, ok := input.(accountIDBearer); ok && bearer.AccountID == nil {
bearer.AccountID = &defaultAccountID
return bearer
}
return input
},
}
_, _, err := m.HandleInitialize(context.Background(),
middleware.InitializeInput{
Parameters: accountIDBearer{},
},
middleware.InitializeHandlerFunc(
func(ctx context.Context, input middleware.InitializeInput) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
params, ok := input.Parameters.(accountIDBearer)
if !ok {
t.Fatalf("expect struct input, got %T", input.Parameters)
}
if params.AccountID == nil || *params.AccountID != "-" {
t.Errorf("expect `-` AccountID, got %v", params.AccountID)
}
return out, metadata, err
}),
)
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
}
| 48 |
aws-sdk-go-v2 | aws | Go | package customizations
import (
"context"
"fmt"
"github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
const glacierAPIVersionHeaderKey = "X-Amz-Glacier-Version"
// AddGlacierAPIVersionMiddleware explicitly add handling for the Glacier api version
// middleware to the operation stack.
func AddGlacierAPIVersionMiddleware(stack *middleware.Stack, apiVersion string) error {
return stack.Serialize.Add(&GlacierAPIVersion{apiVersion: apiVersion}, middleware.Before)
}
// GlacierAPIVersion handles automatically setting Glacier's API version header.
type GlacierAPIVersion struct {
apiVersion string
}
// ID returns the id for the middleware.
func (*GlacierAPIVersion) ID() string {
return "Glacier:APIVersion"
}
// HandleSerialize implements the SerializeMiddleware interface
func (m *GlacierAPIVersion) HandleSerialize(
ctx context.Context, input middleware.SerializeInput, next middleware.SerializeHandler,
) (
output middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
req, ok := input.Request.(*smithyhttp.Request)
if !ok {
return output, metadata, &smithy.SerializationError{
Err: fmt.Errorf("unknown request type %T", input.Request),
}
}
req.Header.Set(glacierAPIVersionHeaderKey, m.apiVersion)
return next.HandleSerialize(ctx, input)
}
| 47 |
aws-sdk-go-v2 | aws | Go | package customizations
import (
"context"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"testing"
)
func TestGlacierAPIVersionMiddleware(t *testing.T) {
apiVersion := "2012-06-01"
m := &GlacierAPIVersion{apiVersion: apiVersion}
_, _, err := m.HandleSerialize(context.Background(),
middleware.SerializeInput{
Request: smithyhttp.NewStackRequest(),
},
middleware.SerializeHandlerFunc(
func(ctx context.Context, input middleware.SerializeInput) (
output middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
req, ok := input.Request.(*smithyhttp.Request)
if !ok || req == nil {
t.Fatalf("expect smithy request, got %T", input.Request)
}
actual := req.Header.Get(glacierAPIVersionHeaderKey)
if actual != apiVersion {
t.Errorf("expect %s glacier version, got %s", apiVersion, actual)
}
return output, metadata, err
}),
)
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
}
| 38 |
aws-sdk-go-v2 | aws | Go | // Package customizations provides customizations for the Glacier API client.
//
// # Computing tree hash and sha256 checksum
//
// Glacier requires not only a sha256 checksum header, but also a tree hash. These
// can be set as inputs to the relevant commands, but in most cases this would
// just be tedious boilerplate. So if the checksums have not been provided, the
// client will automatically calculate them.
package customizations
| 10 |
aws-sdk-go-v2 | aws | Go | package customizations
import (
"context"
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// AddTreeHashMiddleware adds middleware needed to automatically
// calculate Glacier's required checksum headers.
func AddTreeHashMiddleware(stack *middleware.Stack) error {
return stack.Finalize.Add(&TreeHash{}, middleware.Before)
}
// TreeHash provides the middleware that will automatically
// set the sha256 and tree hash headers if they have not already been
// set.
type TreeHash struct{}
// ID returns the middleware ID.
func (*TreeHash) ID() string {
return "Glacier:TreeHash"
}
// HandleFinalize implements the finalize middleware handler method
func (*TreeHash) HandleFinalize(
ctx context.Context, input middleware.FinalizeInput, next middleware.FinalizeHandler,
) (
output middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
req, ok := input.Request.(*smithyhttp.Request)
if !ok {
return output, metadata, &smithy.SerializationError{
Err: fmt.Errorf("unknown request type %T", input.Request),
}
}
if err := addChecksum(req); err != nil {
return output, metadata, &smithy.SerializationError{Err: err}
}
return next.HandleFinalize(ctx, input)
}
func addChecksum(req *smithyhttp.Request) error {
if req.GetStream() == nil || req.Header.Get("X-Amz-Sha256-Tree-Hash") != "" {
return nil
}
if !req.IsStreamSeekable() {
return fmt.Errorf("glacier content-sha26 and tree hash can only be automatically computed if the request body is seekable")
}
h := computeHashes(req.GetStream())
if err := req.RewindStream(); err != nil {
return err
}
hstr := hex.EncodeToString(h.TreeHash)
req.Header.Set("X-Amz-Sha256-Tree-Hash", hstr)
hLstr := hex.EncodeToString(h.LinearHash)
req.Header.Set("X-Amz-Content-Sha256", hLstr)
return nil
}
// Hash contains information about the tree-hash and linear hash of a
// Glacier payload. This structure is generated by computeHashes().
type Hash struct {
TreeHash []byte
LinearHash []byte
}
// computeHashes computes the tree-hash and linear hash of a reader r.
//
// Note that this does not perform seeks before or after, these must be done manually.
//
// See http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html for more information.
func computeHashes(r io.Reader) Hash {
const bufsize = 1024 * 1024
buf := make([]byte, bufsize)
var hashes [][]byte
hsh := sha256.New()
for {
// Build leaf nodes in 1MB chunks
n, err := io.ReadAtLeast(r, buf, bufsize)
if n == 0 {
break
}
tmpHash := sha256.Sum256(buf[:n])
hashes = append(hashes, tmpHash[:])
hsh.Write(buf[:n]) // Track linear hash while we're at it
if err != nil {
break // This is the last chunk
}
}
return Hash{
LinearHash: hsh.Sum(nil),
TreeHash: computeTreeHash(hashes),
}
}
// computeTreeHash builds a tree hash root node given a slice of
// hashes. Glacier tree hash to be derived from SHA256 hashes of 1MB
// chucks of the data.
//
// See http://docs.aws.amazon.com/amazonglacier/latest/dev/checksum-calculations.html for more information.
func computeTreeHash(hashes [][]byte) []byte {
if hashes == nil || len(hashes) == 0 {
return nil
}
for len(hashes) > 1 {
tmpHashes := [][]byte{}
for i := 0; i < len(hashes); i += 2 {
if i+1 <= len(hashes)-1 {
tmpHash := append(append([]byte{}, hashes[i]...), hashes[i+1]...)
tmpSum := sha256.Sum256(tmpHash)
tmpHashes = append(tmpHashes, tmpSum[:])
} else {
tmpHashes = append(tmpHashes, hashes[i])
}
}
hashes = tmpHashes
}
return hashes[0]
}
| 143 |
aws-sdk-go-v2 | aws | Go | package customizations
import (
"bytes"
"context"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"io"
"strings"
"testing"
)
func TestTreeHashMiddleware(t *testing.T) {
m := TreeHash{}
cases := map[string]struct {
Body io.Reader
SetRequest func(r *smithyhttp.Request) *smithyhttp.Request
Linear string
Tree string
ExpectErr string
}{
"all zeroes": {
Body: func() io.ReadSeeker {
buf := make([]byte, 5767168) // 5.5MB buffer
for i := range buf {
buf[i] = '0' // Fill with zero characters
}
return bytes.NewReader(buf)
}(),
Linear: "68aff0c5a91aa0491752bfb96e3fef33eb74953804f6a2f7b708d5bcefa8ff6b",
Tree: "154e26c78fd74d0c2c9b3cc4644191619dc4f2cd539ae2a74d5fd07957a3ee6a",
},
"non-seekable stream without precomputed hash": {
Body: func() io.Reader {
buf := make([]byte, 5767168)
for i := range buf {
buf[i] = '0'
}
return bytes.NewBuffer(buf)
}(),
ExpectErr: "tree hash",
},
"non-seekable stream with precomputed hash": {
Body: func() io.Reader {
buf := make([]byte, 5767168)
for i := range buf {
buf[i] = '0'
}
return bytes.NewBuffer(buf)
}(),
SetRequest: func(r *smithyhttp.Request) *smithyhttp.Request {
r.Header.Set("X-Amz-Content-Sha256", "precomputed")
r.Header.Set("X-Amz-Sha256-Tree-Hash", "precomputed")
return r
},
// These values aren't actually correct, but they are what we're explicitly setting.
// If the middleware were to try to compute the values anyway, the checks would fail.
Linear: "precomputed",
Tree: "precomputed",
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
_, _, err := m.HandleFinalize(context.Background(),
middleware.FinalizeInput{
Request: func() *smithyhttp.Request {
r := smithyhttp.NewStackRequest()
req, ok := r.(*smithyhttp.Request)
if !ok || req == nil {
t.Fatalf("expect smithy request, got %T", r)
}
if c.SetRequest != nil {
req = c.SetRequest(req)
}
req, err := req.SetStream(c.Body)
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
return req
}(),
},
middleware.FinalizeHandlerFunc(
func(ctx context.Context, input middleware.FinalizeInput) (
output middleware.FinalizeOutput, metadata middleware.Metadata, err error,
) {
req, ok := input.Request.(*smithyhttp.Request)
if !ok || req == nil {
t.Fatalf("expect smithy request, got %T", input.Request)
}
actualLinear := req.Header.Get("X-Amz-Content-Sha256")
if actualLinear != c.Linear {
t.Fatalf("expected linear hash to be \"%s\" but was \"%s\"", c.Linear, actualLinear)
}
actualTree := req.Header.Get("X-Amz-Sha256-Tree-Hash")
if actualTree != c.Tree {
t.Fatalf("expected tree hash to be \"%s\" but was \"%s\"", c.Tree, actualTree)
}
if body, ok := c.Body.(io.ReadSeeker); ok {
n, _ := body.Seek(0, io.SeekCurrent)
if n != 0 {
t.Fatalf("expected body to be rewound, but was at position %d", n)
}
}
return output, metadata, err
}),
)
if len(c.ExpectErr) != 0 {
if err == nil {
t.Fatalf("expect error, got none")
}
if e, a := c.ExpectErr, err.Error(); !strings.Contains(a, e) {
t.Fatalf("expect error to contain %v, got %v", e, a)
}
} else {
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
}
})
}
}
| 128 |
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 Glacier 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: "glacier.{region}.api.aws",
Protocols: []string{"http", "https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.{region}.amazonaws.com",
Protocols: []string{"http", "https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "glacier-fips.{region}.api.aws",
Protocols: []string{"http", "https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "glacier.{region}.amazonaws.com",
Protocols: []string{"http", "https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.Aws,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "af-south-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-east-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-northeast-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-northeast-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ap-northeast-3",
}: 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: "ap-southeast-3",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.ca-central-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "eu-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-north-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-south-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: "fips-ca-central-1",
}: endpoints.Endpoint{
Hostname: "glacier-fips.ca-central-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "ca-central-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "fips-us-east-1",
}: endpoints.Endpoint{
Hostname: "glacier-fips.us-east-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-east-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "fips-us-east-2",
}: endpoints.Endpoint{
Hostname: "glacier-fips.us-east-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-east-2",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "fips-us-west-1",
}: endpoints.Endpoint{
Hostname: "glacier-fips.us-west-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-west-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "fips-us-west-2",
}: endpoints.Endpoint{
Hostname: "glacier-fips.us-west-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-west-2",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "me-south-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "sa-east-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.us-east-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-east-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-2",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.us-east-2.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.us-west-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-west-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-2",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.us-west-2.amazonaws.com",
},
},
},
{
ID: "aws-cn",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "glacier.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"http", "https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.{region}.amazonaws.com.cn",
Protocols: []string{"http", "https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "glacier-fips.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"http", "https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "glacier.{region}.amazonaws.com.cn",
Protocols: []string{"http", "https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsCn,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "cn-north-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "cn-northwest-1",
}: endpoints.Endpoint{},
},
},
{
ID: "aws-iso",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "glacier.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIso,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "us-iso-east-1",
}: endpoints.Endpoint{
Protocols: []string{"http", "https"},
},
endpoints.EndpointKey{
Region: "us-iso-west-1",
}: endpoints.Endpoint{},
},
},
{
ID: "aws-iso-b",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "glacier.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoB,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "us-isob-east-1",
}: endpoints.Endpoint{},
},
},
{
ID: "aws-iso-e",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "glacier.{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: "glacier-fips.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "glacier.{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: "glacier.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "glacier-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "glacier.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsUsGov,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "fips-us-gov-east-1",
}: endpoints.Endpoint{
Hostname: "glacier.us-gov-east-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-gov-east-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "fips-us-gov-west-1",
}: endpoints.Endpoint{
Hostname: "glacier.us-gov-west-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-gov-west-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "us-gov-east-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-gov-east-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier.us-gov-east-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-gov-west-1",
}: endpoints.Endpoint{
Protocols: []string{"http", "https"},
},
endpoints.EndpointKey{
Region: "us-gov-west-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "glacier.us-gov-west-1.amazonaws.com",
Protocols: []string{"http", "https"},
},
},
},
}
| 504 |
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 ActionCode string
// Enum values for ActionCode
const (
ActionCodeArchiveRetrieval ActionCode = "ArchiveRetrieval"
ActionCodeInventoryRetrieval ActionCode = "InventoryRetrieval"
ActionCodeSelect ActionCode = "Select"
)
// Values returns all known values for ActionCode. 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 (ActionCode) Values() []ActionCode {
return []ActionCode{
"ArchiveRetrieval",
"InventoryRetrieval",
"Select",
}
}
type CannedACL string
// Enum values for CannedACL
const (
CannedACLPrivate CannedACL = "private"
CannedACLPublicRead CannedACL = "public-read"
CannedACLPublicReadWrite CannedACL = "public-read-write"
CannedACLAwsExecRead CannedACL = "aws-exec-read"
CannedACLAuthenticatedRead CannedACL = "authenticated-read"
CannedACLBucketOwnerRead CannedACL = "bucket-owner-read"
CannedACLBucketOwnerFullControl CannedACL = "bucket-owner-full-control"
)
// Values returns all known values for CannedACL. 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 (CannedACL) Values() []CannedACL {
return []CannedACL{
"private",
"public-read",
"public-read-write",
"aws-exec-read",
"authenticated-read",
"bucket-owner-read",
"bucket-owner-full-control",
}
}
type EncryptionType string
// Enum values for EncryptionType
const (
EncryptionTypeKms EncryptionType = "aws:kms"
EncryptionTypeS3 EncryptionType = "AES256"
)
// Values returns all known values for EncryptionType. 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 (EncryptionType) Values() []EncryptionType {
return []EncryptionType{
"aws:kms",
"AES256",
}
}
type ExpressionType string
// Enum values for ExpressionType
const (
ExpressionTypeSql ExpressionType = "SQL"
)
// Values returns all known values for ExpressionType. 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 (ExpressionType) Values() []ExpressionType {
return []ExpressionType{
"SQL",
}
}
type FileHeaderInfo string
// Enum values for FileHeaderInfo
const (
FileHeaderInfoUse FileHeaderInfo = "USE"
FileHeaderInfoIgnore FileHeaderInfo = "IGNORE"
FileHeaderInfoNone FileHeaderInfo = "NONE"
)
// Values returns all known values for FileHeaderInfo. 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 (FileHeaderInfo) Values() []FileHeaderInfo {
return []FileHeaderInfo{
"USE",
"IGNORE",
"NONE",
}
}
type Permission string
// Enum values for Permission
const (
PermissionFullControl Permission = "FULL_CONTROL"
PermissionWrite Permission = "WRITE"
PermissionWriteAcp Permission = "WRITE_ACP"
PermissionRead Permission = "READ"
PermissionReadAcp Permission = "READ_ACP"
)
// Values returns all known values for Permission. 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 (Permission) Values() []Permission {
return []Permission{
"FULL_CONTROL",
"WRITE",
"WRITE_ACP",
"READ",
"READ_ACP",
}
}
type QuoteFields string
// Enum values for QuoteFields
const (
QuoteFieldsAlways QuoteFields = "ALWAYS"
QuoteFieldsAsNeeded QuoteFields = "ASNEEDED"
)
// Values returns all known values for QuoteFields. 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 (QuoteFields) Values() []QuoteFields {
return []QuoteFields{
"ALWAYS",
"ASNEEDED",
}
}
type StatusCode string
// Enum values for StatusCode
const (
StatusCodeInProgress StatusCode = "InProgress"
StatusCodeSucceeded StatusCode = "Succeeded"
StatusCodeFailed StatusCode = "Failed"
)
// Values returns all known values for StatusCode. 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 (StatusCode) Values() []StatusCode {
return []StatusCode{
"InProgress",
"Succeeded",
"Failed",
}
}
type StorageClass string
// Enum values for StorageClass
const (
StorageClassStandard StorageClass = "STANDARD"
StorageClassReducedRedundancy StorageClass = "REDUCED_REDUNDANCY"
StorageClassStandardInfrequentAccess StorageClass = "STANDARD_IA"
)
// Values returns all known values for StorageClass. 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 (StorageClass) Values() []StorageClass {
return []StorageClass{
"STANDARD",
"REDUCED_REDUNDANCY",
"STANDARD_IA",
}
}
type Type string
// Enum values for Type
const (
TypeAmazonCustomerByEmail Type = "AmazonCustomerByEmail"
TypeCanonicalUser Type = "CanonicalUser"
TypeGroup Type = "Group"
)
// Values returns all known values for Type. 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 (Type) Values() []Type {
return []Type{
"AmazonCustomerByEmail",
"CanonicalUser",
"Group",
}
}
| 208 |
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"
)
// Returned if there is insufficient capacity to process this expedited request.
// This error only applies to expedited retrievals and not to standard or bulk
// retrievals.
type InsufficientCapacityException struct {
Message *string
ErrorCodeOverride *string
Type *string
Code *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 }
// Returned if a parameter of the request is incorrectly specified.
type InvalidParameterValueException struct {
Message *string
ErrorCodeOverride *string
Type *string
Code *string
noSmithyDocumentSerde
}
func (e *InvalidParameterValueException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidParameterValueException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidParameterValueException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidParameterValueException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidParameterValueException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// Returned if the request results in a vault or account limit being exceeded.
type LimitExceededException struct {
Message *string
ErrorCodeOverride *string
Type *string
Code *string
noSmithyDocumentSerde
}
func (e *LimitExceededException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *LimitExceededException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *LimitExceededException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "LimitExceededException"
}
return *e.ErrorCodeOverride
}
func (e *LimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// Returned if a required header or parameter is missing from the request.
type MissingParameterValueException struct {
Message *string
ErrorCodeOverride *string
Type *string
Code *string
noSmithyDocumentSerde
}
func (e *MissingParameterValueException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *MissingParameterValueException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *MissingParameterValueException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "MissingParameterValueException"
}
return *e.ErrorCodeOverride
}
func (e *MissingParameterValueException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// Returned if a retrieval job would exceed the current data policy's retrieval
// rate limit. For more information about data retrieval policies,
type PolicyEnforcedException struct {
Message *string
ErrorCodeOverride *string
Type *string
Code *string
noSmithyDocumentSerde
}
func (e *PolicyEnforcedException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *PolicyEnforcedException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *PolicyEnforcedException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "PolicyEnforcedException"
}
return *e.ErrorCodeOverride
}
func (e *PolicyEnforcedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// Returned if, when uploading an archive, Amazon S3 Glacier times out while
// receiving the upload.
type RequestTimeoutException struct {
Message *string
ErrorCodeOverride *string
Type *string
Code *string
noSmithyDocumentSerde
}
func (e *RequestTimeoutException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *RequestTimeoutException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *RequestTimeoutException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "RequestTimeoutException"
}
return *e.ErrorCodeOverride
}
func (e *RequestTimeoutException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// Returned if the specified resource (such as a vault, upload ID, or job ID)
// doesn't exist.
type ResourceNotFoundException struct {
Message *string
ErrorCodeOverride *string
Type *string
Code *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 }
// Returned if the service cannot complete the request.
type ServiceUnavailableException struct {
Message *string
ErrorCodeOverride *string
Type *string
Code *string
noSmithyDocumentSerde
}
func (e *ServiceUnavailableException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ServiceUnavailableException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ServiceUnavailableException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ServiceUnavailableException"
}
return *e.ErrorCodeOverride
}
func (e *ServiceUnavailableException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
| 246 |
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"
)
// Contains information about the comma-separated value (CSV) file to select from.
type CSVInput struct {
// A single character used to indicate that a row should be ignored when the
// character is present at the start of that row.
Comments *string
// A value used to separate individual fields from each other within a record.
FieldDelimiter *string
// Describes the first line of input. Valid values are None , Ignore , and Use .
FileHeaderInfo FileHeaderInfo
// A value used as an escape character where the field delimiter is part of the
// value.
QuoteCharacter *string
// A single character used for escaping the quotation-mark character inside an
// already escaped value.
QuoteEscapeCharacter *string
// A value used to separate individual records from each other.
RecordDelimiter *string
noSmithyDocumentSerde
}
// Contains information about the comma-separated value (CSV) file that the job
// results are stored in.
type CSVOutput struct {
// A value used to separate individual fields from each other within a record.
FieldDelimiter *string
// A value used as an escape character where the field delimiter is part of the
// value.
QuoteCharacter *string
// A single character used for escaping the quotation-mark character inside an
// already escaped value.
QuoteEscapeCharacter *string
// A value that indicates whether all output fields should be contained within
// quotation marks.
QuoteFields QuoteFields
// A value used to separate individual records from each other.
RecordDelimiter *string
noSmithyDocumentSerde
}
// Data retrieval policy.
type DataRetrievalPolicy struct {
// The policy rule. Although this is a list type, currently there must be only one
// rule, which contains a Strategy field and optionally a BytesPerHour field.
Rules []DataRetrievalRule
noSmithyDocumentSerde
}
// Data retrieval policy rule.
type DataRetrievalRule struct {
// The maximum number of bytes that can be retrieved in an hour. This field is
// required only if the value of the Strategy field is BytesPerHour . Your PUT
// operation will be rejected if the Strategy field is not set to BytesPerHour and
// you set this field.
BytesPerHour *int64
// The type of data retrieval policy to set. Valid values:
// BytesPerHour|FreeTier|None
Strategy *string
noSmithyDocumentSerde
}
// Contains the Amazon S3 Glacier response to your request.
type DescribeVaultOutput struct {
// The Universal Coordinated Time (UTC) date when the vault was created. This
// value should be a string in the ISO 8601 date format, for example
// 2012-03-20T17:03:43.221Z .
CreationDate *string
// The Universal Coordinated Time (UTC) date when Amazon S3 Glacier completed the
// last vault inventory. This value should be a string in the ISO 8601 date format,
// for example 2012-03-20T17:03:43.221Z .
LastInventoryDate *string
// The number of archives in the vault as of the last inventory date. This field
// will return null if an inventory has not yet run on the vault, for example if
// you just created the vault.
NumberOfArchives int64
// Total size, in bytes, of the archives in the vault as of the last inventory
// date. This field will return null if an inventory has not yet run on the vault,
// for example if you just created the vault.
SizeInBytes int64
// The Amazon Resource Name (ARN) of the vault.
VaultARN *string
// The name of the vault.
VaultName *string
noSmithyDocumentSerde
}
// Contains information about the encryption used to store the job results in
// Amazon S3.
type Encryption struct {
// The server-side encryption algorithm used when storing job results in Amazon
// S3, for example AES256 or aws:kms .
EncryptionType EncryptionType
// Optional. If the encryption type is aws:kms , you can use this value to specify
// the encryption context for the job results.
KMSContext *string
// The AWS KMS key ID to use for object encryption. All GET and PUT requests for
// an object protected by AWS KMS fail if not made by using Secure Sockets Layer
// (SSL) or Signature Version 4.
KMSKeyId *string
noSmithyDocumentSerde
}
// Contains the description of an Amazon S3 Glacier job.
type GlacierJobDescription struct {
// The job type. This value is either ArchiveRetrieval , InventoryRetrieval , or
// Select .
Action ActionCode
// The archive ID requested for a select job or archive retrieval. Otherwise, this
// field is null.
ArchiveId *string
// The SHA256 tree hash of the entire archive for an archive retrieval. For
// inventory retrieval or select jobs, this field is null.
ArchiveSHA256TreeHash *string
// For an archive retrieval job, this value is the size in bytes of the archive
// being requested for download. For an inventory retrieval or select job, this
// value is null.
ArchiveSizeInBytes *int64
// The job status. When a job is completed, you get the job's output using Get Job
// Output (GET output).
Completed bool
// The UTC time that the job request completed. While the job is in progress, the
// value is null.
CompletionDate *string
// The UTC date when the job was created. This value is a string representation of
// ISO 8601 date format, for example "2012-03-20T17:03:43.221Z" .
CreationDate *string
// Parameters used for range inventory retrieval.
InventoryRetrievalParameters *InventoryRetrievalJobDescription
// For an inventory retrieval job, this value is the size in bytes of the
// inventory requested for download. For an archive retrieval or select job, this
// value is null.
InventorySizeInBytes *int64
// The job description provided when initiating the job.
JobDescription *string
// An opaque string that identifies an Amazon S3 Glacier job.
JobId *string
// Contains the job output location.
JobOutputPath *string
// Contains the location where the data from the select job is stored.
OutputLocation *OutputLocation
// The retrieved byte range for archive retrieval jobs in the form
// StartByteValue-EndByteValue. If no range was specified in the archive retrieval,
// then the whole archive is retrieved. In this case, StartByteValue equals 0 and
// EndByteValue equals the size of the archive minus 1. For inventory retrieval or
// select jobs, this field is null.
RetrievalByteRange *string
// For an archive retrieval job, this value is the checksum of the archive.
// Otherwise, this value is null. The SHA256 tree hash value for the requested
// range of an archive. If the InitiateJob request for an archive specified a
// tree-hash aligned range, then this field returns a value. If the whole archive
// is retrieved, this value is the same as the ArchiveSHA256TreeHash value. This
// field is null for the following:
// - Archive retrieval jobs that specify a range that is not tree-hash aligned
//
// - Archival jobs that specify a range that is equal to the whole archive, when
// the job status is InProgress
//
// - Inventory jobs
// - Select jobs
SHA256TreeHash *string
// An Amazon SNS topic that receives notification.
SNSTopic *string
// Contains the parameters used for a select.
SelectParameters *SelectParameters
// The status code can be InProgress , Succeeded , or Failed , and indicates the
// status of the job.
StatusCode StatusCode
// A friendly message that describes the job status.
StatusMessage *string
// The tier to use for a select or an archive retrieval. Valid values are Expedited
// , Standard , or Bulk . Standard is the default.
Tier *string
// The Amazon Resource Name (ARN) of the vault from which an archive retrieval was
// requested.
VaultARN *string
noSmithyDocumentSerde
}
// Contains information about a grant.
type Grant struct {
// The grantee.
Grantee *Grantee
// Specifies the permission given to the grantee.
Permission Permission
noSmithyDocumentSerde
}
// Contains information about the grantee.
type Grantee struct {
// Type of grantee
//
// This member is required.
Type Type
// Screen name of the grantee.
DisplayName *string
// Email address of the grantee.
EmailAddress *string
// The canonical user ID of the grantee.
ID *string
// URI of the grantee group.
URI *string
noSmithyDocumentSerde
}
// Describes how the archive is serialized.
type InputSerialization struct {
// Describes the serialization of a CSV-encoded object.
Csv *CSVInput
noSmithyDocumentSerde
}
// Describes the options for a range inventory retrieval job.
type InventoryRetrievalJobDescription struct {
// The end of the date range in UTC for vault inventory retrieval that includes
// archives created before this date. This value should be a string in the ISO 8601
// date format, for example 2013-03-20T17:03:43Z .
EndDate *string
// The output format for the vault inventory list, which is set by the InitiateJob
// request when initiating a job to retrieve a vault inventory. Valid values are
// CSV and JSON .
Format *string
// The maximum number of inventory items returned per vault inventory retrieval
// request. This limit is set when initiating the job with the a InitiateJob
// request.
Limit *string
// An opaque string that represents where to continue pagination of the vault
// inventory retrieval results. You use the marker in a new InitiateJob request to
// obtain additional inventory items. If there are no more inventory items, this
// value is null . For more information, see Range Inventory Retrieval (https://docs.aws.amazon.com/amazonglacier/latest/dev/api-initiate-job-post.html#api-initiate-job-post-vault-inventory-list-filtering)
// .
Marker *string
// The start of the date range in Universal Coordinated Time (UTC) for vault
// inventory retrieval that includes archives created on or after this date. This
// value should be a string in the ISO 8601 date format, for example
// 2013-03-20T17:03:43Z .
StartDate *string
noSmithyDocumentSerde
}
// Provides options for specifying a range inventory retrieval job.
type InventoryRetrievalJobInput struct {
// The end of the date range in UTC for vault inventory retrieval that includes
// archives created before this date. This value should be a string in the ISO 8601
// date format, for example 2013-03-20T17:03:43Z .
EndDate *string
// Specifies the maximum number of inventory items returned per vault inventory
// retrieval request. Valid values are greater than or equal to 1.
Limit *string
// An opaque string that represents where to continue pagination of the vault
// inventory retrieval results. You use the marker in a new InitiateJob request to
// obtain additional inventory items. If there are no more inventory items, this
// value is null .
Marker *string
// The start of the date range in UTC for vault inventory retrieval that includes
// archives created on or after this date. This value should be a string in the ISO
// 8601 date format, for example 2013-03-20T17:03:43Z .
StartDate *string
noSmithyDocumentSerde
}
// Provides options for defining a job.
type JobParameters struct {
// The ID of the archive that you want to retrieve. This field is required only if
// Type is set to select or archive-retrieval code>. An error occurs if you specify
// this request parameter for an inventory retrieval job request.
ArchiveId *string
// The optional description for the job. The description must be less than or
// equal to 1,024 bytes. The allowable characters are 7-bit ASCII without control
// codes-specifically, ASCII values 32-126 decimal or 0x20-0x7E hexadecimal.
Description *string
// When initiating a job to retrieve a vault inventory, you can optionally add
// this parameter to your request to specify the output format. If you are
// initiating an inventory job and do not specify a Format field, JSON is the
// default format. Valid values are "CSV" and "JSON".
Format *string
// Input parameters used for range inventory retrieval.
InventoryRetrievalParameters *InventoryRetrievalJobInput
// Contains information about the location where the select job results are stored.
OutputLocation *OutputLocation
// The byte range to retrieve for an archive retrieval. in the form
// "StartByteValue-EndByteValue" If not specified, the whole archive is retrieved.
// If specified, the byte range must be megabyte (1024*1024) aligned which means
// that StartByteValue must be divisible by 1 MB and EndByteValue plus 1 must be
// divisible by 1 MB or be the end of the archive specified as the archive byte
// size value minus 1. If RetrievalByteRange is not megabyte aligned, this
// operation returns a 400 response. An error occurs if you specify this field for
// an inventory retrieval job request.
RetrievalByteRange *string
// The Amazon SNS topic ARN to which Amazon S3 Glacier sends a notification when
// the job is completed and the output is ready for you to download. The specified
// topic publishes the notification to its subscribers. The SNS topic must exist.
SNSTopic *string
// Contains the parameters that define a job.
SelectParameters *SelectParameters
// The tier to use for a select or an archive retrieval job. Valid values are
// Expedited , Standard , or Bulk . Standard is the default.
Tier *string
// The job type. You can initiate a job to perform a select query on an archive,
// retrieve an archive, or get an inventory of a vault. Valid values are "select",
// "archive-retrieval" and "inventory-retrieval".
Type *string
noSmithyDocumentSerde
}
// Contains information about the location where the select job results are stored.
type OutputLocation struct {
// Describes an S3 location that will receive the results of the job request.
S3 *S3Location
noSmithyDocumentSerde
}
// Describes how the select output is serialized.
type OutputSerialization struct {
// Describes the serialization of CSV-encoded query results.
Csv *CSVOutput
noSmithyDocumentSerde
}
// A list of the part sizes of the multipart upload.
type PartListElement struct {
// The byte range of a part, inclusive of the upper value of the range.
RangeInBytes *string
// The SHA256 tree hash value that Amazon S3 Glacier calculated for the part. This
// field is never null .
SHA256TreeHash *string
noSmithyDocumentSerde
}
// The definition for a provisioned capacity unit.
type ProvisionedCapacityDescription struct {
// The ID that identifies the provisioned capacity unit.
CapacityId *string
// The date that the provisioned capacity unit expires, in Universal Coordinated
// Time (UTC).
ExpirationDate *string
// The date that the provisioned capacity unit was purchased, in Universal
// Coordinated Time (UTC).
StartDate *string
noSmithyDocumentSerde
}
// Contains information about the location in Amazon S3 where the select job
// results are stored.
type S3Location struct {
// A list of grants that control access to the staged results.
AccessControlList []Grant
// The name of the Amazon S3 bucket where the job results are stored.
BucketName *string
// The canned access control list (ACL) to apply to the job results.
CannedACL CannedACL
// Contains information about the encryption used to store the job results in
// Amazon S3.
Encryption *Encryption
// The prefix that is prepended to the results for this request.
Prefix *string
// The storage class used to store the job results.
StorageClass StorageClass
// The tag-set that is applied to the job results.
Tagging map[string]string
// A map of metadata to store with the job results in Amazon S3.
UserMetadata map[string]string
noSmithyDocumentSerde
}
// Contains information about the parameters used for a select.
type SelectParameters struct {
// The expression that is used to select the object.
Expression *string
// The type of the provided expression, for example SQL .
ExpressionType ExpressionType
// Describes the serialization format of the object.
InputSerialization *InputSerialization
// Describes how the results of the select job are serialized.
OutputSerialization *OutputSerialization
noSmithyDocumentSerde
}
// A list of in-progress multipart uploads for a vault.
type UploadListElement struct {
// The description of the archive that was specified in the Initiate Multipart
// Upload request.
ArchiveDescription *string
// The UTC time at which the multipart upload was initiated.
CreationDate *string
// The ID of a multipart upload.
MultipartUploadId *string
// The part size, in bytes, specified in the Initiate Multipart Upload request.
// This is the size of all the parts in the upload except the last part, which may
// be smaller than this size.
PartSizeInBytes int64
// The Amazon Resource Name (ARN) of the vault that contains the archive.
VaultARN *string
noSmithyDocumentSerde
}
// Contains the vault access policy.
type VaultAccessPolicy struct {
// The vault access policy.
Policy *string
noSmithyDocumentSerde
}
// Contains the vault lock policy.
type VaultLockPolicy struct {
// The vault lock policy.
Policy *string
noSmithyDocumentSerde
}
// Represents a vault's notification configuration.
type VaultNotificationConfig struct {
// A list of one or more events for which Amazon S3 Glacier will send a
// notification to the specified Amazon SNS topic.
Events []string
// The Amazon Simple Notification Service (Amazon SNS) topic Amazon Resource Name
// (ARN).
SNSTopic *string
noSmithyDocumentSerde
}
type noSmithyDocumentSerde = smithydocument.NoSerde
| 551 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package globalaccelerator
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 = "Global Accelerator"
const ServiceAPIVersion = "2018-08-08"
// Client provides the API client to make operations call for AWS Global
// Accelerator.
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, "globalaccelerator", 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)
}
| 455 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package globalaccelerator
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 globalaccelerator
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/globalaccelerator/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Associate a virtual private cloud (VPC) subnet endpoint with your custom
// routing accelerator. The listener port range must be large enough to support the
// number of IP addresses that can be specified in your subnet. The number of ports
// required is: subnet size times the number of ports per destination EC2
// instances. For example, a subnet defined as /24 requires a listener port range
// of at least 255 ports. Note: You must have enough remaining listener ports
// available to map to the subnet ports, or the call will fail with a
// LimitExceededException. By default, all destinations in a subnet in a custom
// routing accelerator cannot receive traffic. To enable all destinations to
// receive traffic, or to specify individual port mappings that can receive
// traffic, see the AllowCustomRoutingTraffic (https://docs.aws.amazon.com/global-accelerator/latest/api/API_AllowCustomRoutingTraffic.html)
// operation.
func (c *Client) AddCustomRoutingEndpoints(ctx context.Context, params *AddCustomRoutingEndpointsInput, optFns ...func(*Options)) (*AddCustomRoutingEndpointsOutput, error) {
if params == nil {
params = &AddCustomRoutingEndpointsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AddCustomRoutingEndpoints", params, optFns, c.addOperationAddCustomRoutingEndpointsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AddCustomRoutingEndpointsOutput)
out.ResultMetadata = metadata
return out, nil
}
type AddCustomRoutingEndpointsInput struct {
// The list of endpoint objects to add to a custom routing accelerator.
//
// This member is required.
EndpointConfigurations []types.CustomRoutingEndpointConfiguration
// The Amazon Resource Name (ARN) of the endpoint group for the custom routing
// endpoint.
//
// This member is required.
EndpointGroupArn *string
noSmithyDocumentSerde
}
type AddCustomRoutingEndpointsOutput struct {
// The endpoint objects added to the custom routing accelerator.
EndpointDescriptions []types.CustomRoutingEndpointDescription
// The Amazon Resource Name (ARN) of the endpoint group for the custom routing
// endpoint.
EndpointGroupArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAddCustomRoutingEndpointsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpAddCustomRoutingEndpoints{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAddCustomRoutingEndpoints{}, 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 = addOpAddCustomRoutingEndpointsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddCustomRoutingEndpoints(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_opAddCustomRoutingEndpoints(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "globalaccelerator",
OperationName: "AddCustomRoutingEndpoints",
}
}
| 146 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package globalaccelerator
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/globalaccelerator/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Add endpoints to an endpoint group. The AddEndpoints API operation is the
// recommended option for adding endpoints. The alternative options are to add
// endpoints when you create an endpoint group (with the CreateEndpointGroup (https://docs.aws.amazon.com/global-accelerator/latest/api/API_CreateEndpointGroup.html)
// API) or when you update an endpoint group (with the UpdateEndpointGroup (https://docs.aws.amazon.com/global-accelerator/latest/api/API_UpdateEndpointGroup.html)
// API). There are two advantages to using AddEndpoints to add endpoints:
// - It's faster, because Global Accelerator only has to resolve the new
// endpoints that you're adding.
// - It's more convenient, because you don't need to specify all of the current
// endpoints that are already in the endpoint group in addition to the new
// endpoints that you want to add.
func (c *Client) AddEndpoints(ctx context.Context, params *AddEndpointsInput, optFns ...func(*Options)) (*AddEndpointsOutput, error) {
if params == nil {
params = &AddEndpointsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AddEndpoints", params, optFns, c.addOperationAddEndpointsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AddEndpointsOutput)
out.ResultMetadata = metadata
return out, nil
}
type AddEndpointsInput struct {
// The list of endpoint objects.
//
// This member is required.
EndpointConfigurations []types.EndpointConfiguration
// The Amazon Resource Name (ARN) of the endpoint group.
//
// This member is required.
EndpointGroupArn *string
noSmithyDocumentSerde
}
type AddEndpointsOutput struct {
// The list of endpoint objects.
EndpointDescriptions []types.EndpointDescription
// The Amazon Resource Name (ARN) of the endpoint group.
EndpointGroupArn *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAddEndpointsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsjson11_serializeOpAddEndpoints{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAddEndpoints{}, 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 = addOpAddEndpointsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddEndpoints(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_opAddEndpoints(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "globalaccelerator",
OperationName: "AddEndpoints",
}
}
| 142 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.