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 ram
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/ram/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Adds the specified tag keys and values to a resource share or managed
// permission. If you choose a resource share, the tags are attached to only the
// resource share, not to the resources that are in the resource share. The tags on
// a managed permission are the same for all versions of the managed permission.
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 {
// A list of one or more tag key and value pairs. The tag key must be present and
// not be an empty string. The tag value must be present but can be an empty
// string.
//
// This member is required.
Tags []types.Tag
// Specifies the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the managed permission that you want to add tags to. You must specify either
// resourceArn , or resourceShareArn , but not both.
ResourceArn *string
// Specifies the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource share that you want to add tags to. You must specify either
// resourceShareArn , or resourceArn , but not both.
ResourceShareArn *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: "ram",
OperationName: "TagResource",
}
}
| 136 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package ram
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 the specified tag key and value pairs from the specified resource share
// or managed permission.
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 {
// Specifies a list of one or more tag keys that you want to remove.
//
// This member is required.
TagKeys []string
// Specifies the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the managed permission that you want to remove tags from. You must specify
// either resourceArn , or resourceShareArn , but not both.
ResourceArn *string
// Specifies the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource share that you want to remove tags from. The tags are removed
// from the resource share, not the resources in the resource share. You must
// specify either resourceShareArn , or resourceArn , but not both.
ResourceShareArn *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: "ram",
OperationName: "UntagResource",
}
}
| 132 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package ram
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/ram/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Modifies some of the properties of the specified resource share.
func (c *Client) UpdateResourceShare(ctx context.Context, params *UpdateResourceShareInput, optFns ...func(*Options)) (*UpdateResourceShareOutput, error) {
if params == nil {
params = &UpdateResourceShareInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateResourceShare", params, optFns, c.addOperationUpdateResourceShareMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateResourceShareOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateResourceShareInput struct {
// Specifies the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource share that you want to modify.
//
// This member is required.
ResourceShareArn *string
// Specifies whether principals outside your organization in Organizations can be
// associated with a resource share.
AllowExternalPrincipals *bool
// Specifies a unique, case-sensitive identifier that you provide to ensure the
// idempotency of the request. This lets you safely retry the request without
// accidentally performing the same operation a second time. Passing the same value
// to a later call to an operation requires that you also pass the same value for
// all other parameters. We recommend that you use a UUID type of value. (https://wikipedia.org/wiki/Universally_unique_identifier)
// . If you don't provide this value, then Amazon Web Services generates a random
// one for you. If you retry the operation with the same ClientToken , but with
// different parameters, the retry fails with an IdempotentParameterMismatch error.
ClientToken *string
// If specified, the new name that you want to attach to the resource share.
Name *string
noSmithyDocumentSerde
}
type UpdateResourceShareOutput struct {
// The idempotency identifier associated with this request. If you want to repeat
// the same operation in an idempotent manner then you must include this value in
// the clientToken request parameter of that later call. All other parameters must
// also have the same values that you used in the first call.
ClientToken *string
// Information about the resource share.
ResourceShare *types.ResourceShare
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateResourceShareMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateResourceShare{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateResourceShare{}, 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 = addOpUpdateResourceShareValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateResourceShare(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_opUpdateResourceShare(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "ram",
OperationName: "UpdateResourceShare",
}
}
| 149 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package ram
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/ram/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_deserializeOpAcceptResourceShareInvitation struct {
}
func (*awsRestjson1_deserializeOpAcceptResourceShareInvitation) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAcceptResourceShareInvitation) 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_deserializeOpErrorAcceptResourceShareInvitation(response, &metadata)
}
output := &AcceptResourceShareInvitationOutput{}
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_deserializeOpDocumentAcceptResourceShareInvitationOutput(&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_deserializeOpErrorAcceptResourceShareInvitation(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationAlreadyAcceptedException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationAlreadyAcceptedException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationAlreadyRejectedException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationAlreadyRejectedException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationArnNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationArnNotFoundException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationExpiredException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationExpiredException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentAcceptResourceShareInvitationOutput(v **AcceptResourceShareInvitationOutput, 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 *AcceptResourceShareInvitationOutput
if *v == nil {
sv = &AcceptResourceShareInvitationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "resourceShareInvitation":
if err := awsRestjson1_deserializeDocumentResourceShareInvitation(&sv.ResourceShareInvitation, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpAssociateResourceShare struct {
}
func (*awsRestjson1_deserializeOpAssociateResourceShare) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAssociateResourceShare) 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_deserializeOpErrorAssociateResourceShare(response, &metadata)
}
output := &AssociateResourceShareOutput{}
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_deserializeOpDocumentAssociateResourceShareOutput(&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_deserializeOpErrorAssociateResourceShare(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidStateTransitionException", errorCode):
return awsRestjson1_deserializeErrorInvalidStateTransitionException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ResourceShareLimitExceededException", errorCode):
return awsRestjson1_deserializeErrorResourceShareLimitExceededException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("ThrottlingException", errorCode):
return awsRestjson1_deserializeErrorThrottlingException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentAssociateResourceShareOutput(v **AssociateResourceShareOutput, 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 *AssociateResourceShareOutput
if *v == nil {
sv = &AssociateResourceShareOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "resourceShareAssociations":
if err := awsRestjson1_deserializeDocumentResourceShareAssociationList(&sv.ResourceShareAssociations, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpAssociateResourceSharePermission struct {
}
func (*awsRestjson1_deserializeOpAssociateResourceSharePermission) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpAssociateResourceSharePermission) 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_deserializeOpErrorAssociateResourceSharePermission(response, &metadata)
}
output := &AssociateResourceSharePermissionOutput{}
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_deserializeOpDocumentAssociateResourceSharePermissionOutput(&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_deserializeOpErrorAssociateResourceSharePermission(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("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentAssociateResourceSharePermissionOutput(v **AssociateResourceSharePermissionOutput, 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 *AssociateResourceSharePermissionOutput
if *v == nil {
sv = &AssociateResourceSharePermissionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "returnValue":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.ReturnValue = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreatePermission struct {
}
func (*awsRestjson1_deserializeOpCreatePermission) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreatePermission) 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_deserializeOpErrorCreatePermission(response, &metadata)
}
output := &CreatePermissionOutput{}
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_deserializeOpDocumentCreatePermissionOutput(&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_deserializeOpErrorCreatePermission(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidPolicyException", errorCode):
return awsRestjson1_deserializeErrorInvalidPolicyException(response, errorBody)
case strings.EqualFold("MalformedPolicyTemplateException", errorCode):
return awsRestjson1_deserializeErrorMalformedPolicyTemplateException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("PermissionAlreadyExistsException", errorCode):
return awsRestjson1_deserializeErrorPermissionAlreadyExistsException(response, errorBody)
case strings.EqualFold("PermissionLimitExceededException", errorCode):
return awsRestjson1_deserializeErrorPermissionLimitExceededException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreatePermissionOutput(v **CreatePermissionOutput, 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 *CreatePermissionOutput
if *v == nil {
sv = &CreatePermissionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "permission":
if err := awsRestjson1_deserializeDocumentResourceSharePermissionSummary(&sv.Permission, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreatePermissionVersion struct {
}
func (*awsRestjson1_deserializeOpCreatePermissionVersion) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreatePermissionVersion) 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_deserializeOpErrorCreatePermissionVersion(response, &metadata)
}
output := &CreatePermissionVersionOutput{}
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_deserializeOpDocumentCreatePermissionVersionOutput(&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_deserializeOpErrorCreatePermissionVersion(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidPolicyException", errorCode):
return awsRestjson1_deserializeErrorInvalidPolicyException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("MalformedPolicyTemplateException", errorCode):
return awsRestjson1_deserializeErrorMalformedPolicyTemplateException(response, errorBody)
case strings.EqualFold("PermissionVersionsLimitExceededException", errorCode):
return awsRestjson1_deserializeErrorPermissionVersionsLimitExceededException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreatePermissionVersionOutput(v **CreatePermissionVersionOutput, 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 *CreatePermissionVersionOutput
if *v == nil {
sv = &CreatePermissionVersionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "permission":
if err := awsRestjson1_deserializeDocumentResourceSharePermissionDetail(&sv.Permission, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpCreateResourceShare struct {
}
func (*awsRestjson1_deserializeOpCreateResourceShare) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateResourceShare) 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_deserializeOpErrorCreateResourceShare(response, &metadata)
}
output := &CreateResourceShareOutput{}
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_deserializeOpDocumentCreateResourceShareOutput(&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_deserializeOpErrorCreateResourceShare(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidStateTransitionException", errorCode):
return awsRestjson1_deserializeErrorInvalidStateTransitionException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ResourceShareLimitExceededException", errorCode):
return awsRestjson1_deserializeErrorResourceShareLimitExceededException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("TagPolicyViolationException", errorCode):
return awsRestjson1_deserializeErrorTagPolicyViolationException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateResourceShareOutput(v **CreateResourceShareOutput, 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 *CreateResourceShareOutput
if *v == nil {
sv = &CreateResourceShareOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "resourceShare":
if err := awsRestjson1_deserializeDocumentResourceShare(&sv.ResourceShare, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDeletePermission struct {
}
func (*awsRestjson1_deserializeOpDeletePermission) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeletePermission) 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_deserializeOpErrorDeletePermission(response, &metadata)
}
output := &DeletePermissionOutput{}
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_deserializeOpDocumentDeletePermissionOutput(&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_deserializeOpErrorDeletePermission(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDeletePermissionOutput(v **DeletePermissionOutput, 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 *DeletePermissionOutput
if *v == nil {
sv = &DeletePermissionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "permissionStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PermissionStatus to be of type string, got %T instead", value)
}
sv.PermissionStatus = types.PermissionStatus(jtv)
}
case "returnValue":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.ReturnValue = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDeletePermissionVersion struct {
}
func (*awsRestjson1_deserializeOpDeletePermissionVersion) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeletePermissionVersion) 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_deserializeOpErrorDeletePermissionVersion(response, &metadata)
}
output := &DeletePermissionVersionOutput{}
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_deserializeOpDocumentDeletePermissionVersionOutput(&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_deserializeOpErrorDeletePermissionVersion(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDeletePermissionVersionOutput(v **DeletePermissionVersionOutput, 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 *DeletePermissionVersionOutput
if *v == nil {
sv = &DeletePermissionVersionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "permissionStatus":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PermissionStatus to be of type string, got %T instead", value)
}
sv.PermissionStatus = types.PermissionStatus(jtv)
}
case "returnValue":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.ReturnValue = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDeleteResourceShare struct {
}
func (*awsRestjson1_deserializeOpDeleteResourceShare) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteResourceShare) 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_deserializeOpErrorDeleteResourceShare(response, &metadata)
}
output := &DeleteResourceShareOutput{}
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_deserializeOpDocumentDeleteResourceShareOutput(&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_deserializeOpErrorDeleteResourceShare(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidStateTransitionException", errorCode):
return awsRestjson1_deserializeErrorInvalidStateTransitionException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDeleteResourceShareOutput(v **DeleteResourceShareOutput, 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 *DeleteResourceShareOutput
if *v == nil {
sv = &DeleteResourceShareOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "returnValue":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.ReturnValue = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDisassociateResourceShare struct {
}
func (*awsRestjson1_deserializeOpDisassociateResourceShare) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisassociateResourceShare) 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_deserializeOpErrorDisassociateResourceShare(response, &metadata)
}
output := &DisassociateResourceShareOutput{}
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_deserializeOpDocumentDisassociateResourceShareOutput(&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_deserializeOpErrorDisassociateResourceShare(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidStateTransitionException", errorCode):
return awsRestjson1_deserializeErrorInvalidStateTransitionException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ResourceShareLimitExceededException", errorCode):
return awsRestjson1_deserializeErrorResourceShareLimitExceededException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDisassociateResourceShareOutput(v **DisassociateResourceShareOutput, 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 *DisassociateResourceShareOutput
if *v == nil {
sv = &DisassociateResourceShareOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "resourceShareAssociations":
if err := awsRestjson1_deserializeDocumentResourceShareAssociationList(&sv.ResourceShareAssociations, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDisassociateResourceSharePermission struct {
}
func (*awsRestjson1_deserializeOpDisassociateResourceSharePermission) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDisassociateResourceSharePermission) 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_deserializeOpErrorDisassociateResourceSharePermission(response, &metadata)
}
output := &DisassociateResourceSharePermissionOutput{}
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_deserializeOpDocumentDisassociateResourceSharePermissionOutput(&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_deserializeOpErrorDisassociateResourceSharePermission(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("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidStateTransitionException", errorCode):
return awsRestjson1_deserializeErrorInvalidStateTransitionException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentDisassociateResourceSharePermissionOutput(v **DisassociateResourceSharePermissionOutput, 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 *DisassociateResourceSharePermissionOutput
if *v == nil {
sv = &DisassociateResourceSharePermissionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "returnValue":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.ReturnValue = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpEnableSharingWithAwsOrganization struct {
}
func (*awsRestjson1_deserializeOpEnableSharingWithAwsOrganization) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpEnableSharingWithAwsOrganization) 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_deserializeOpErrorEnableSharingWithAwsOrganization(response, &metadata)
}
output := &EnableSharingWithAwsOrganizationOutput{}
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_deserializeOpDocumentEnableSharingWithAwsOrganizationOutput(&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_deserializeOpErrorEnableSharingWithAwsOrganization(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("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentEnableSharingWithAwsOrganizationOutput(v **EnableSharingWithAwsOrganizationOutput, 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 *EnableSharingWithAwsOrganizationOutput
if *v == nil {
sv = &EnableSharingWithAwsOrganizationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "returnValue":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.ReturnValue = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetPermission struct {
}
func (*awsRestjson1_deserializeOpGetPermission) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetPermission) 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_deserializeOpErrorGetPermission(response, &metadata)
}
output := &GetPermissionOutput{}
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_deserializeOpDocumentGetPermissionOutput(&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_deserializeOpErrorGetPermission(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("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetPermissionOutput(v **GetPermissionOutput, 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 *GetPermissionOutput
if *v == nil {
sv = &GetPermissionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "permission":
if err := awsRestjson1_deserializeDocumentResourceSharePermissionDetail(&sv.Permission, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetResourcePolicies struct {
}
func (*awsRestjson1_deserializeOpGetResourcePolicies) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetResourcePolicies) 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_deserializeOpErrorGetResourcePolicies(response, &metadata)
}
output := &GetResourcePoliciesOutput{}
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_deserializeOpDocumentGetResourcePoliciesOutput(&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_deserializeOpErrorGetResourcePolicies(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ResourceArnNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceArnNotFoundException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetResourcePoliciesOutput(v **GetResourcePoliciesOutput, 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 *GetResourcePoliciesOutput
if *v == nil {
sv = &GetResourcePoliciesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "policies":
if err := awsRestjson1_deserializeDocumentPolicyList(&sv.Policies, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetResourceShareAssociations struct {
}
func (*awsRestjson1_deserializeOpGetResourceShareAssociations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetResourceShareAssociations) 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_deserializeOpErrorGetResourceShareAssociations(response, &metadata)
}
output := &GetResourceShareAssociationsOutput{}
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_deserializeOpDocumentGetResourceShareAssociationsOutput(&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_deserializeOpErrorGetResourceShareAssociations(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetResourceShareAssociationsOutput(v **GetResourceShareAssociationsOutput, 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 *GetResourceShareAssociationsOutput
if *v == nil {
sv = &GetResourceShareAssociationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "resourceShareAssociations":
if err := awsRestjson1_deserializeDocumentResourceShareAssociationList(&sv.ResourceShareAssociations, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetResourceShareInvitations struct {
}
func (*awsRestjson1_deserializeOpGetResourceShareInvitations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetResourceShareInvitations) 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_deserializeOpErrorGetResourceShareInvitations(response, &metadata)
}
output := &GetResourceShareInvitationsOutput{}
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_deserializeOpDocumentGetResourceShareInvitationsOutput(&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_deserializeOpErrorGetResourceShareInvitations(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("InvalidMaxResultsException", errorCode):
return awsRestjson1_deserializeErrorInvalidMaxResultsException(response, errorBody)
case strings.EqualFold("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationArnNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationArnNotFoundException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetResourceShareInvitationsOutput(v **GetResourceShareInvitationsOutput, 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 *GetResourceShareInvitationsOutput
if *v == nil {
sv = &GetResourceShareInvitationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "resourceShareInvitations":
if err := awsRestjson1_deserializeDocumentResourceShareInvitationList(&sv.ResourceShareInvitations, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpGetResourceShares struct {
}
func (*awsRestjson1_deserializeOpGetResourceShares) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetResourceShares) 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_deserializeOpErrorGetResourceShares(response, &metadata)
}
output := &GetResourceSharesOutput{}
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_deserializeOpDocumentGetResourceSharesOutput(&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_deserializeOpErrorGetResourceShares(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentGetResourceSharesOutput(v **GetResourceSharesOutput, 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 *GetResourceSharesOutput
if *v == nil {
sv = &GetResourceSharesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "resourceShares":
if err := awsRestjson1_deserializeDocumentResourceShareList(&sv.ResourceShares, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListPendingInvitationResources struct {
}
func (*awsRestjson1_deserializeOpListPendingInvitationResources) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListPendingInvitationResources) 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_deserializeOpErrorListPendingInvitationResources(response, &metadata)
}
output := &ListPendingInvitationResourcesOutput{}
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_deserializeOpDocumentListPendingInvitationResourcesOutput(&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_deserializeOpErrorListPendingInvitationResources(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("MissingRequiredParameterException", errorCode):
return awsRestjson1_deserializeErrorMissingRequiredParameterException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationAlreadyRejectedException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationAlreadyRejectedException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationArnNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationArnNotFoundException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationExpiredException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationExpiredException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListPendingInvitationResourcesOutput(v **ListPendingInvitationResourcesOutput, 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 *ListPendingInvitationResourcesOutput
if *v == nil {
sv = &ListPendingInvitationResourcesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "resources":
if err := awsRestjson1_deserializeDocumentResourceList(&sv.Resources, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListPermissionAssociations struct {
}
func (*awsRestjson1_deserializeOpListPermissionAssociations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListPermissionAssociations) 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_deserializeOpErrorListPermissionAssociations(response, &metadata)
}
output := &ListPermissionAssociationsOutput{}
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_deserializeOpDocumentListPermissionAssociationsOutput(&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_deserializeOpErrorListPermissionAssociations(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListPermissionAssociationsOutput(v **ListPermissionAssociationsOutput, 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 *ListPermissionAssociationsOutput
if *v == nil {
sv = &ListPermissionAssociationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "permissions":
if err := awsRestjson1_deserializeDocumentAssociatedPermissionList(&sv.Permissions, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListPermissions struct {
}
func (*awsRestjson1_deserializeOpListPermissions) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListPermissions) 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_deserializeOpErrorListPermissions(response, &metadata)
}
output := &ListPermissionsOutput{}
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_deserializeOpDocumentListPermissionsOutput(&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_deserializeOpErrorListPermissions(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListPermissionsOutput(v **ListPermissionsOutput, 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 *ListPermissionsOutput
if *v == nil {
sv = &ListPermissionsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "permissions":
if err := awsRestjson1_deserializeDocumentResourceSharePermissionList(&sv.Permissions, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListPermissionVersions struct {
}
func (*awsRestjson1_deserializeOpListPermissionVersions) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListPermissionVersions) 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_deserializeOpErrorListPermissionVersions(response, &metadata)
}
output := &ListPermissionVersionsOutput{}
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_deserializeOpDocumentListPermissionVersionsOutput(&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_deserializeOpErrorListPermissionVersions(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListPermissionVersionsOutput(v **ListPermissionVersionsOutput, 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 *ListPermissionVersionsOutput
if *v == nil {
sv = &ListPermissionVersionsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "permissions":
if err := awsRestjson1_deserializeDocumentResourceSharePermissionList(&sv.Permissions, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListPrincipals struct {
}
func (*awsRestjson1_deserializeOpListPrincipals) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListPrincipals) 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_deserializeOpErrorListPrincipals(response, &metadata)
}
output := &ListPrincipalsOutput{}
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_deserializeOpDocumentListPrincipalsOutput(&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_deserializeOpErrorListPrincipals(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListPrincipalsOutput(v **ListPrincipalsOutput, 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 *ListPrincipalsOutput
if *v == nil {
sv = &ListPrincipalsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "principals":
if err := awsRestjson1_deserializeDocumentPrincipalList(&sv.Principals, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListReplacePermissionAssociationsWork struct {
}
func (*awsRestjson1_deserializeOpListReplacePermissionAssociationsWork) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListReplacePermissionAssociationsWork) 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_deserializeOpErrorListReplacePermissionAssociationsWork(response, &metadata)
}
output := &ListReplacePermissionAssociationsWorkOutput{}
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_deserializeOpDocumentListReplacePermissionAssociationsWorkOutput(&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_deserializeOpErrorListReplacePermissionAssociationsWork(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListReplacePermissionAssociationsWorkOutput(v **ListReplacePermissionAssociationsWorkOutput, 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 *ListReplacePermissionAssociationsWorkOutput
if *v == nil {
sv = &ListReplacePermissionAssociationsWorkOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "replacePermissionAssociationsWorks":
if err := awsRestjson1_deserializeDocumentReplacePermissionAssociationsWorkList(&sv.ReplacePermissionAssociationsWorks, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListResources struct {
}
func (*awsRestjson1_deserializeOpListResources) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListResources) 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_deserializeOpErrorListResources(response, &metadata)
}
output := &ListResourcesOutput{}
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_deserializeOpDocumentListResourcesOutput(&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_deserializeOpErrorListResources(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidResourceTypeException", errorCode):
return awsRestjson1_deserializeErrorInvalidResourceTypeException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListResourcesOutput(v **ListResourcesOutput, 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 *ListResourcesOutput
if *v == nil {
sv = &ListResourcesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "resources":
if err := awsRestjson1_deserializeDocumentResourceList(&sv.Resources, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListResourceSharePermissions struct {
}
func (*awsRestjson1_deserializeOpListResourceSharePermissions) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListResourceSharePermissions) 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_deserializeOpErrorListResourceSharePermissions(response, &metadata)
}
output := &ListResourceSharePermissionsOutput{}
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_deserializeOpDocumentListResourceSharePermissionsOutput(&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_deserializeOpErrorListResourceSharePermissions(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListResourceSharePermissionsOutput(v **ListResourceSharePermissionsOutput, 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 *ListResourceSharePermissionsOutput
if *v == nil {
sv = &ListResourceSharePermissionsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "permissions":
if err := awsRestjson1_deserializeDocumentResourceSharePermissionList(&sv.Permissions, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListResourceTypes struct {
}
func (*awsRestjson1_deserializeOpListResourceTypes) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListResourceTypes) 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_deserializeOpErrorListResourceTypes(response, &metadata)
}
output := &ListResourceTypesOutput{}
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_deserializeOpDocumentListResourceTypesOutput(&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_deserializeOpErrorListResourceTypes(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("InvalidNextTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidNextTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListResourceTypesOutput(v **ListResourceTypesOutput, 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 *ListResourceTypesOutput
if *v == nil {
sv = &ListResourceTypesOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "nextToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.NextToken = ptr.String(jtv)
}
case "resourceTypes":
if err := awsRestjson1_deserializeDocumentServiceNameAndResourceTypeList(&sv.ResourceTypes, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpPromotePermissionCreatedFromPolicy struct {
}
func (*awsRestjson1_deserializeOpPromotePermissionCreatedFromPolicy) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpPromotePermissionCreatedFromPolicy) 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_deserializeOpErrorPromotePermissionCreatedFromPolicy(response, &metadata)
}
output := &PromotePermissionCreatedFromPolicyOutput{}
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_deserializeOpDocumentPromotePermissionCreatedFromPolicyOutput(&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_deserializeOpErrorPromotePermissionCreatedFromPolicy(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("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("MissingRequiredParameterException", errorCode):
return awsRestjson1_deserializeErrorMissingRequiredParameterException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentPromotePermissionCreatedFromPolicyOutput(v **PromotePermissionCreatedFromPolicyOutput, 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 *PromotePermissionCreatedFromPolicyOutput
if *v == nil {
sv = &PromotePermissionCreatedFromPolicyOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "permission":
if err := awsRestjson1_deserializeDocumentResourceSharePermissionSummary(&sv.Permission, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpPromoteResourceShareCreatedFromPolicy struct {
}
func (*awsRestjson1_deserializeOpPromoteResourceShareCreatedFromPolicy) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpPromoteResourceShareCreatedFromPolicy) 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_deserializeOpErrorPromoteResourceShareCreatedFromPolicy(response, &metadata)
}
output := &PromoteResourceShareCreatedFromPolicyOutput{}
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_deserializeOpDocumentPromoteResourceShareCreatedFromPolicyOutput(&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_deserializeOpErrorPromoteResourceShareCreatedFromPolicy(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("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("InvalidStateTransitionException", errorCode):
return awsRestjson1_deserializeErrorInvalidStateTransitionException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("MissingRequiredParameterException", errorCode):
return awsRestjson1_deserializeErrorMissingRequiredParameterException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ResourceShareLimitExceededException", errorCode):
return awsRestjson1_deserializeErrorResourceShareLimitExceededException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
case strings.EqualFold("UnmatchedPolicyPermissionException", errorCode):
return awsRestjson1_deserializeErrorUnmatchedPolicyPermissionException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentPromoteResourceShareCreatedFromPolicyOutput(v **PromoteResourceShareCreatedFromPolicyOutput, 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 *PromoteResourceShareCreatedFromPolicyOutput
if *v == nil {
sv = &PromoteResourceShareCreatedFromPolicyOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "returnValue":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.ReturnValue = ptr.Bool(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpRejectResourceShareInvitation struct {
}
func (*awsRestjson1_deserializeOpRejectResourceShareInvitation) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpRejectResourceShareInvitation) 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_deserializeOpErrorRejectResourceShareInvitation(response, &metadata)
}
output := &RejectResourceShareInvitationOutput{}
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_deserializeOpDocumentRejectResourceShareInvitationOutput(&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_deserializeOpErrorRejectResourceShareInvitation(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationAlreadyAcceptedException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationAlreadyAcceptedException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationAlreadyRejectedException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationAlreadyRejectedException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationArnNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationArnNotFoundException(response, errorBody)
case strings.EqualFold("ResourceShareInvitationExpiredException", errorCode):
return awsRestjson1_deserializeErrorResourceShareInvitationExpiredException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentRejectResourceShareInvitationOutput(v **RejectResourceShareInvitationOutput, 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 *RejectResourceShareInvitationOutput
if *v == nil {
sv = &RejectResourceShareInvitationOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "resourceShareInvitation":
if err := awsRestjson1_deserializeDocumentResourceShareInvitation(&sv.ResourceShareInvitation, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpReplacePermissionAssociations struct {
}
func (*awsRestjson1_deserializeOpReplacePermissionAssociations) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpReplacePermissionAssociations) 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_deserializeOpErrorReplacePermissionAssociations(response, &metadata)
}
output := &ReplacePermissionAssociationsOutput{}
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_deserializeOpDocumentReplacePermissionAssociationsOutput(&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_deserializeOpErrorReplacePermissionAssociations(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentReplacePermissionAssociationsOutput(v **ReplacePermissionAssociationsOutput, 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 *ReplacePermissionAssociationsOutput
if *v == nil {
sv = &ReplacePermissionAssociationsOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "replacePermissionAssociationsWork":
if err := awsRestjson1_deserializeDocumentReplacePermissionAssociationsWork(&sv.ReplacePermissionAssociationsWork, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpSetDefaultPermissionVersion struct {
}
func (*awsRestjson1_deserializeOpSetDefaultPermissionVersion) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpSetDefaultPermissionVersion) 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_deserializeOpErrorSetDefaultPermissionVersion(response, &metadata)
}
output := &SetDefaultPermissionVersionOutput{}
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_deserializeOpDocumentSetDefaultPermissionVersionOutput(&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_deserializeOpErrorSetDefaultPermissionVersion(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentSetDefaultPermissionVersionOutput(v **SetDefaultPermissionVersionOutput, 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 *SetDefaultPermissionVersionOutput
if *v == nil {
sv = &SetDefaultPermissionVersionOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "returnValue":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.ReturnValue = ptr.Bool(jtv)
}
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("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ResourceArnNotFoundException", errorCode):
return awsRestjson1_deserializeErrorResourceArnNotFoundException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("TagLimitExceededException", errorCode):
return awsRestjson1_deserializeErrorTagLimitExceededException(response, errorBody)
case strings.EqualFold("TagPolicyViolationException", errorCode):
return awsRestjson1_deserializeErrorTagPolicyViolationException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(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("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpUpdateResourceShare struct {
}
func (*awsRestjson1_deserializeOpUpdateResourceShare) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateResourceShare) 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_deserializeOpErrorUpdateResourceShare(response, &metadata)
}
output := &UpdateResourceShareOutput{}
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_deserializeOpDocumentUpdateResourceShareOutput(&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_deserializeOpErrorUpdateResourceShare(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("IdempotentParameterMismatchException", errorCode):
return awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response, errorBody)
case strings.EqualFold("InvalidClientTokenException", errorCode):
return awsRestjson1_deserializeErrorInvalidClientTokenException(response, errorBody)
case strings.EqualFold("InvalidParameterException", errorCode):
return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody)
case strings.EqualFold("MalformedArnException", errorCode):
return awsRestjson1_deserializeErrorMalformedArnException(response, errorBody)
case strings.EqualFold("MissingRequiredParameterException", errorCode):
return awsRestjson1_deserializeErrorMissingRequiredParameterException(response, errorBody)
case strings.EqualFold("OperationNotPermittedException", errorCode):
return awsRestjson1_deserializeErrorOperationNotPermittedException(response, errorBody)
case strings.EqualFold("ServerInternalException", errorCode):
return awsRestjson1_deserializeErrorServerInternalException(response, errorBody)
case strings.EqualFold("ServiceUnavailableException", errorCode):
return awsRestjson1_deserializeErrorServiceUnavailableException(response, errorBody)
case strings.EqualFold("UnknownResourceException", errorCode):
return awsRestjson1_deserializeErrorUnknownResourceException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateResourceShareOutput(v **UpdateResourceShareOutput, 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 *UpdateResourceShareOutput
if *v == nil {
sv = &UpdateResourceShareOutput{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "clientToken":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ClientToken = ptr.String(jtv)
}
case "resourceShare":
if err := awsRestjson1_deserializeDocumentResourceShare(&sv.ResourceShare, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeErrorIdempotentParameterMismatchException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.IdempotentParameterMismatchException{}
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_deserializeDocumentIdempotentParameterMismatchException(&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_deserializeErrorInvalidClientTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InvalidClientTokenException{}
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_deserializeDocumentInvalidClientTokenException(&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_deserializeErrorInvalidMaxResultsException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InvalidMaxResultsException{}
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_deserializeDocumentInvalidMaxResultsException(&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_deserializeErrorInvalidNextTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InvalidNextTokenException{}
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_deserializeDocumentInvalidNextTokenException(&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_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InvalidParameterException{}
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_deserializeDocumentInvalidParameterException(&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_deserializeErrorInvalidPolicyException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InvalidPolicyException{}
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_deserializeDocumentInvalidPolicyException(&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_deserializeErrorInvalidResourceTypeException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InvalidResourceTypeException{}
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_deserializeDocumentInvalidResourceTypeException(&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_deserializeErrorInvalidStateTransitionException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.InvalidStateTransitionException{}
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_deserializeDocumentInvalidStateTransitionException(&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_deserializeErrorMalformedArnException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.MalformedArnException{}
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_deserializeDocumentMalformedArnException(&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_deserializeErrorMalformedPolicyTemplateException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.MalformedPolicyTemplateException{}
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_deserializeDocumentMalformedPolicyTemplateException(&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_deserializeErrorMissingRequiredParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.MissingRequiredParameterException{}
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_deserializeDocumentMissingRequiredParameterException(&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_deserializeErrorOperationNotPermittedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.OperationNotPermittedException{}
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_deserializeDocumentOperationNotPermittedException(&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_deserializeErrorPermissionAlreadyExistsException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.PermissionAlreadyExistsException{}
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_deserializeDocumentPermissionAlreadyExistsException(&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_deserializeErrorPermissionLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.PermissionLimitExceededException{}
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_deserializeDocumentPermissionLimitExceededException(&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_deserializeErrorPermissionVersionsLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.PermissionVersionsLimitExceededException{}
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_deserializeDocumentPermissionVersionsLimitExceededException(&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_deserializeErrorResourceArnNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceArnNotFoundException{}
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_deserializeDocumentResourceArnNotFoundException(&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_deserializeErrorResourceShareInvitationAlreadyAcceptedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceShareInvitationAlreadyAcceptedException{}
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_deserializeDocumentResourceShareInvitationAlreadyAcceptedException(&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_deserializeErrorResourceShareInvitationAlreadyRejectedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceShareInvitationAlreadyRejectedException{}
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_deserializeDocumentResourceShareInvitationAlreadyRejectedException(&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_deserializeErrorResourceShareInvitationArnNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceShareInvitationArnNotFoundException{}
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_deserializeDocumentResourceShareInvitationArnNotFoundException(&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_deserializeErrorResourceShareInvitationExpiredException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceShareInvitationExpiredException{}
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_deserializeDocumentResourceShareInvitationExpiredException(&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_deserializeErrorResourceShareLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ResourceShareLimitExceededException{}
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_deserializeDocumentResourceShareLimitExceededException(&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_deserializeErrorServerInternalException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ServerInternalException{}
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_deserializeDocumentServerInternalException(&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_deserializeErrorTagLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.TagLimitExceededException{}
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_deserializeDocumentTagLimitExceededException(&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_deserializeErrorTagPolicyViolationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.TagPolicyViolationException{}
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_deserializeDocumentTagPolicyViolationException(&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_deserializeErrorUnknownResourceException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.UnknownResourceException{}
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_deserializeDocumentUnknownResourceException(&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_deserializeErrorUnmatchedPolicyPermissionException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.UnmatchedPolicyPermissionException{}
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_deserializeDocumentUnmatchedPolicyPermissionException(&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_deserializeDocumentAssociatedPermission(v **types.AssociatedPermission, 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.AssociatedPermission
if *v == nil {
sv = &types.AssociatedPermission{}
} 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 String to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "defaultVersion":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.DefaultVersion = ptr.Bool(jtv)
}
case "featureSet":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PermissionFeatureSet to be of type string, got %T instead", value)
}
sv.FeatureSet = types.PermissionFeatureSet(jtv)
}
case "lastUpdatedTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "permissionVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.PermissionVersion = ptr.String(jtv)
}
case "resourceShareArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareArn = ptr.String(jtv)
}
case "resourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceType = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentAssociatedPermissionList(v *[]types.AssociatedPermission, 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.AssociatedPermission
if *v == nil {
cv = []types.AssociatedPermission{}
} else {
cv = *v
}
for _, value := range shape {
var col types.AssociatedPermission
destAddr := &col
if err := awsRestjson1_deserializeDocumentAssociatedPermission(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentIdempotentParameterMismatchException(v **types.IdempotentParameterMismatchException, 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.IdempotentParameterMismatchException
if *v == nil {
sv = &types.IdempotentParameterMismatchException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInvalidClientTokenException(v **types.InvalidClientTokenException, 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.InvalidClientTokenException
if *v == nil {
sv = &types.InvalidClientTokenException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInvalidMaxResultsException(v **types.InvalidMaxResultsException, 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.InvalidMaxResultsException
if *v == nil {
sv = &types.InvalidMaxResultsException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInvalidNextTokenException(v **types.InvalidNextTokenException, 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.InvalidNextTokenException
if *v == nil {
sv = &types.InvalidNextTokenException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, 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.InvalidParameterException
if *v == nil {
sv = &types.InvalidParameterException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInvalidPolicyException(v **types.InvalidPolicyException, 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.InvalidPolicyException
if *v == nil {
sv = &types.InvalidPolicyException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInvalidResourceTypeException(v **types.InvalidResourceTypeException, 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.InvalidResourceTypeException
if *v == nil {
sv = &types.InvalidResourceTypeException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentInvalidStateTransitionException(v **types.InvalidStateTransitionException, 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.InvalidStateTransitionException
if *v == nil {
sv = &types.InvalidStateTransitionException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentMalformedArnException(v **types.MalformedArnException, 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.MalformedArnException
if *v == nil {
sv = &types.MalformedArnException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentMalformedPolicyTemplateException(v **types.MalformedPolicyTemplateException, 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.MalformedPolicyTemplateException
if *v == nil {
sv = &types.MalformedPolicyTemplateException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentMissingRequiredParameterException(v **types.MissingRequiredParameterException, 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.MissingRequiredParameterException
if *v == nil {
sv = &types.MissingRequiredParameterException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentOperationNotPermittedException(v **types.OperationNotPermittedException, 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.OperationNotPermittedException
if *v == nil {
sv = &types.OperationNotPermittedException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPermissionAlreadyExistsException(v **types.PermissionAlreadyExistsException, 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.PermissionAlreadyExistsException
if *v == nil {
sv = &types.PermissionAlreadyExistsException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPermissionLimitExceededException(v **types.PermissionLimitExceededException, 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.PermissionLimitExceededException
if *v == nil {
sv = &types.PermissionLimitExceededException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPermissionVersionsLimitExceededException(v **types.PermissionVersionsLimitExceededException, 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.PermissionVersionsLimitExceededException
if *v == nil {
sv = &types.PermissionVersionsLimitExceededException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPolicyList(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 Policy to be of type string, got %T instead", value)
}
col = jtv
}
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentPrincipal(v **types.Principal, 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.Principal
if *v == nil {
sv = &types.Principal{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "creationTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "external":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.External = ptr.Bool(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 "lastUpdatedTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "resourceShareArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareArn = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentPrincipalList(v *[]types.Principal, 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.Principal
if *v == nil {
cv = []types.Principal{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Principal
destAddr := &col
if err := awsRestjson1_deserializeDocumentPrincipal(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentReplacePermissionAssociationsWork(v **types.ReplacePermissionAssociationsWork, 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.ReplacePermissionAssociationsWork
if *v == nil {
sv = &types.ReplacePermissionAssociationsWork{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "creationTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "fromPermissionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.FromPermissionArn = ptr.String(jtv)
}
case "fromPermissionVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.FromPermissionVersion = 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 "lastUpdatedTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ReplacePermissionAssociationsWorkStatus to be of type string, got %T instead", value)
}
sv.Status = types.ReplacePermissionAssociationsWorkStatus(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 "toPermissionArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ToPermissionArn = ptr.String(jtv)
}
case "toPermissionVersion":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ToPermissionVersion = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentReplacePermissionAssociationsWorkList(v *[]types.ReplacePermissionAssociationsWork, 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.ReplacePermissionAssociationsWork
if *v == nil {
cv = []types.ReplacePermissionAssociationsWork{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ReplacePermissionAssociationsWork
destAddr := &col
if err := awsRestjson1_deserializeDocumentReplacePermissionAssociationsWork(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResource(v **types.Resource, 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.Resource
if *v == nil {
sv = &types.Resource{}
} 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 String to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "lastUpdatedTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "resourceGroupArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceGroupArn = ptr.String(jtv)
}
case "resourceRegionScope":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceRegionScope to be of type string, got %T instead", value)
}
sv.ResourceRegionScope = types.ResourceRegionScope(jtv)
}
case "resourceShareArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareArn = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceStatus to be of type string, got %T instead", value)
}
sv.Status = types.ResourceStatus(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 "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_deserializeDocumentResourceArnNotFoundException(v **types.ResourceArnNotFoundException, 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.ResourceArnNotFoundException
if *v == nil {
sv = &types.ResourceArnNotFoundException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceList(v *[]types.Resource, 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.Resource
if *v == nil {
cv = []types.Resource{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Resource
destAddr := &col
if err := awsRestjson1_deserializeDocumentResource(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResourceShare(v **types.ResourceShare, 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.ResourceShare
if *v == nil {
sv = &types.ResourceShare{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "allowExternalPrincipals":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.AllowExternalPrincipals = ptr.Bool(jtv)
}
case "creationTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "featureSet":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceShareFeatureSet to be of type string, got %T instead", value)
}
sv.FeatureSet = types.ResourceShareFeatureSet(jtv)
}
case "lastUpdatedTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "owningAccountId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.OwningAccountId = ptr.String(jtv)
}
case "resourceShareArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareArn = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceShareStatus to be of type string, got %T instead", value)
}
sv.Status = types.ResourceShareStatus(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 "tags":
if err := awsRestjson1_deserializeDocumentTagList(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareAssociation(v **types.ResourceShareAssociation, 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.ResourceShareAssociation
if *v == nil {
sv = &types.ResourceShareAssociation{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "associatedEntity":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.AssociatedEntity = ptr.String(jtv)
}
case "associationType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceShareAssociationType to be of type string, got %T instead", value)
}
sv.AssociationType = types.ResourceShareAssociationType(jtv)
}
case "creationTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "external":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.External = ptr.Bool(jtv)
}
case "lastUpdatedTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "resourceShareArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareArn = ptr.String(jtv)
}
case "resourceShareName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareName = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceShareAssociationStatus to be of type string, got %T instead", value)
}
sv.Status = types.ResourceShareAssociationStatus(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)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareAssociationList(v *[]types.ResourceShareAssociation, 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.ResourceShareAssociation
if *v == nil {
cv = []types.ResourceShareAssociation{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ResourceShareAssociation
destAddr := &col
if err := awsRestjson1_deserializeDocumentResourceShareAssociation(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareInvitation(v **types.ResourceShareInvitation, 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.ResourceShareInvitation
if *v == nil {
sv = &types.ResourceShareInvitation{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "invitationTimestamp":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.InvitationTimestamp = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "receiverAccountId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ReceiverAccountId = ptr.String(jtv)
}
case "receiverArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ReceiverArn = ptr.String(jtv)
}
case "resourceShareArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareArn = ptr.String(jtv)
}
case "resourceShareAssociations":
if err := awsRestjson1_deserializeDocumentResourceShareAssociationList(&sv.ResourceShareAssociations, value); err != nil {
return err
}
case "resourceShareInvitationArn":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareInvitationArn = ptr.String(jtv)
}
case "resourceShareName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceShareName = ptr.String(jtv)
}
case "senderAccountId":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.SenderAccountId = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceShareInvitationStatus to be of type string, got %T instead", value)
}
sv.Status = types.ResourceShareInvitationStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareInvitationAlreadyAcceptedException(v **types.ResourceShareInvitationAlreadyAcceptedException, 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.ResourceShareInvitationAlreadyAcceptedException
if *v == nil {
sv = &types.ResourceShareInvitationAlreadyAcceptedException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareInvitationAlreadyRejectedException(v **types.ResourceShareInvitationAlreadyRejectedException, 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.ResourceShareInvitationAlreadyRejectedException
if *v == nil {
sv = &types.ResourceShareInvitationAlreadyRejectedException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareInvitationArnNotFoundException(v **types.ResourceShareInvitationArnNotFoundException, 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.ResourceShareInvitationArnNotFoundException
if *v == nil {
sv = &types.ResourceShareInvitationArnNotFoundException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareInvitationExpiredException(v **types.ResourceShareInvitationExpiredException, 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.ResourceShareInvitationExpiredException
if *v == nil {
sv = &types.ResourceShareInvitationExpiredException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareInvitationList(v *[]types.ResourceShareInvitation, 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.ResourceShareInvitation
if *v == nil {
cv = []types.ResourceShareInvitation{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ResourceShareInvitation
destAddr := &col
if err := awsRestjson1_deserializeDocumentResourceShareInvitation(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareLimitExceededException(v **types.ResourceShareLimitExceededException, 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.ResourceShareLimitExceededException
if *v == nil {
sv = &types.ResourceShareLimitExceededException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceShareList(v *[]types.ResourceShare, 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.ResourceShare
if *v == nil {
cv = []types.ResourceShare{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ResourceShare
destAddr := &col
if err := awsRestjson1_deserializeDocumentResourceShare(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResourceSharePermissionDetail(v **types.ResourceSharePermissionDetail, 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.ResourceSharePermissionDetail
if *v == nil {
sv = &types.ResourceSharePermissionDetail{}
} 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 String to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "defaultVersion":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.DefaultVersion = ptr.Bool(jtv)
}
case "featureSet":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PermissionFeatureSet to be of type string, got %T instead", value)
}
sv.FeatureSet = types.PermissionFeatureSet(jtv)
}
case "isResourceTypeDefault":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsResourceTypeDefault = ptr.Bool(jtv)
}
case "lastUpdatedTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "permission":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Permission = ptr.String(jtv)
}
case "permissionType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PermissionType to be of type string, got %T instead", value)
}
sv.PermissionType = types.PermissionType(jtv)
}
case "resourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceType = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PermissionStatus to be of type string, got %T instead", value)
}
sv.Status = types.PermissionStatus(jtv)
}
case "tags":
if err := awsRestjson1_deserializeDocumentTagList(&sv.Tags, value); err != nil {
return err
}
case "version":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Version = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceSharePermissionList(v *[]types.ResourceSharePermissionSummary, 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.ResourceSharePermissionSummary
if *v == nil {
cv = []types.ResourceSharePermissionSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ResourceSharePermissionSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentResourceSharePermissionSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentResourceSharePermissionSummary(v **types.ResourceSharePermissionSummary, 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.ResourceSharePermissionSummary
if *v == nil {
sv = &types.ResourceSharePermissionSummary{}
} 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 String to be of type string, got %T instead", value)
}
sv.Arn = ptr.String(jtv)
}
case "creationTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "defaultVersion":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.DefaultVersion = ptr.Bool(jtv)
}
case "featureSet":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PermissionFeatureSet to be of type string, got %T instead", value)
}
sv.FeatureSet = types.PermissionFeatureSet(jtv)
}
case "isResourceTypeDefault":
if value != nil {
jtv, ok := value.(bool)
if !ok {
return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value)
}
sv.IsResourceTypeDefault = ptr.Bool(jtv)
}
case "lastUpdatedTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LastUpdatedTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value)
}
}
case "name":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Name = ptr.String(jtv)
}
case "permissionType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected PermissionType to be of type string, got %T instead", value)
}
sv.PermissionType = types.PermissionType(jtv)
}
case "resourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceType = ptr.String(jtv)
}
case "status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Status = ptr.String(jtv)
}
case "tags":
if err := awsRestjson1_deserializeDocumentTagList(&sv.Tags, value); err != nil {
return err
}
case "version":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Version = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentServerInternalException(v **types.ServerInternalException, 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.ServerInternalException
if *v == nil {
sv = &types.ServerInternalException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentServiceNameAndResourceType(v **types.ServiceNameAndResourceType, 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.ServiceNameAndResourceType
if *v == nil {
sv = &types.ServiceNameAndResourceType{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "resourceRegionScope":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceRegionScope to be of type string, got %T instead", value)
}
sv.ResourceRegionScope = types.ResourceRegionScope(jtv)
}
case "resourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ResourceType = ptr.String(jtv)
}
case "serviceName":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.ServiceName = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentServiceNameAndResourceTypeList(v *[]types.ServiceNameAndResourceType, 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.ServiceNameAndResourceType
if *v == nil {
cv = []types.ServiceNameAndResourceType{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ServiceNameAndResourceType
destAddr := &col
if err := awsRestjson1_deserializeDocumentServiceNameAndResourceType(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
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 "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentTag(v **types.Tag, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.Tag
if *v == nil {
sv = &types.Tag{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "key":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagKey to be of type string, got %T instead", value)
}
sv.Key = ptr.String(jtv)
}
case "value":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagValue to be of type string, got %T instead", value)
}
sv.Value = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentTagLimitExceededException(v **types.TagLimitExceededException, 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.TagLimitExceededException
if *v == nil {
sv = &types.TagLimitExceededException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentTagList(v *[]types.Tag, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Tag
if *v == nil {
cv = []types.Tag{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Tag
destAddr := &col
if err := awsRestjson1_deserializeDocumentTag(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentTagPolicyViolationException(v **types.TagPolicyViolationException, 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.TagPolicyViolationException
if *v == nil {
sv = &types.TagPolicyViolationException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func 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 String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentUnknownResourceException(v **types.UnknownResourceException, 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.UnknownResourceException
if *v == nil {
sv = &types.UnknownResourceException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentUnmatchedPolicyPermissionException(v **types.UnmatchedPolicyPermissionException, 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.UnmatchedPolicyPermissionException
if *v == nil {
sv = &types.UnmatchedPolicyPermissionException{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "message":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected String to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
| 9,607 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
// Package ram provides the API client, operations, and parameter types for AWS
// Resource Access Manager.
//
// This is the Resource Access Manager API Reference. This documentation provides
// descriptions and syntax for each of the actions and data types in RAM. RAM is a
// service that helps you securely share your Amazon Web Services resources to
// other Amazon Web Services accounts. If you use Organizations to manage your
// accounts, then you can share your resources with your entire organization or to
// organizational units (OUs). For supported resource types, you can also share
// resources with individual Identity and Access Management (IAM) roles and users.
// To learn more about RAM, see the following resources:
// - Resource Access Manager product page (http://aws.amazon.com/ram)
// - Resource Access Manager User Guide (https://docs.aws.amazon.com/ram/latest/userguide/)
package ram
| 17 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package ram
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/ram/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 = "ram"
}
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 ram
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.18.4"
| 7 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package ram
| 4 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package ram
import (
"bytes"
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/ram/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_serializeOpAcceptResourceShareInvitation struct {
}
func (*awsRestjson1_serializeOpAcceptResourceShareInvitation) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpAcceptResourceShareInvitation) 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.(*AcceptResourceShareInvitationInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/acceptresourceshareinvitation")
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_serializeOpDocumentAcceptResourceShareInvitationInput(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_serializeOpHttpBindingsAcceptResourceShareInvitationInput(v *AcceptResourceShareInvitationInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentAcceptResourceShareInvitationInput(v *AcceptResourceShareInvitationInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.ResourceShareInvitationArn != nil {
ok := object.Key("resourceShareInvitationArn")
ok.String(*v.ResourceShareInvitationArn)
}
return nil
}
type awsRestjson1_serializeOpAssociateResourceShare struct {
}
func (*awsRestjson1_serializeOpAssociateResourceShare) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpAssociateResourceShare) 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.(*AssociateResourceShareInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/associateresourceshare")
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_serializeOpDocumentAssociateResourceShareInput(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_serializeOpHttpBindingsAssociateResourceShareInput(v *AssociateResourceShareInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentAssociateResourceShareInput(v *AssociateResourceShareInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.Principals != nil {
ok := object.Key("principals")
if err := awsRestjson1_serializeDocumentPrincipalArnOrIdList(v.Principals, ok); err != nil {
return err
}
}
if v.ResourceArns != nil {
ok := object.Key("resourceArns")
if err := awsRestjson1_serializeDocumentResourceArnList(v.ResourceArns, ok); err != nil {
return err
}
}
if v.ResourceShareArn != nil {
ok := object.Key("resourceShareArn")
ok.String(*v.ResourceShareArn)
}
return nil
}
type awsRestjson1_serializeOpAssociateResourceSharePermission struct {
}
func (*awsRestjson1_serializeOpAssociateResourceSharePermission) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpAssociateResourceSharePermission) 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.(*AssociateResourceSharePermissionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/associateresourcesharepermission")
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_serializeOpDocumentAssociateResourceSharePermissionInput(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_serializeOpHttpBindingsAssociateResourceSharePermissionInput(v *AssociateResourceSharePermissionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentAssociateResourceSharePermissionInput(v *AssociateResourceSharePermissionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
if v.PermissionVersion != nil {
ok := object.Key("permissionVersion")
ok.Integer(*v.PermissionVersion)
}
if v.Replace != nil {
ok := object.Key("replace")
ok.Boolean(*v.Replace)
}
if v.ResourceShareArn != nil {
ok := object.Key("resourceShareArn")
ok.String(*v.ResourceShareArn)
}
return nil
}
type awsRestjson1_serializeOpCreatePermission struct {
}
func (*awsRestjson1_serializeOpCreatePermission) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCreatePermission) 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.(*CreatePermissionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/createpermission")
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_serializeOpDocumentCreatePermissionInput(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_serializeOpHttpBindingsCreatePermissionInput(v *CreatePermissionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentCreatePermissionInput(v *CreatePermissionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.Name != nil {
ok := object.Key("name")
ok.String(*v.Name)
}
if v.PolicyTemplate != nil {
ok := object.Key("policyTemplate")
ok.String(*v.PolicyTemplate)
}
if v.ResourceType != nil {
ok := object.Key("resourceType")
ok.String(*v.ResourceType)
}
if v.Tags != nil {
ok := object.Key("tags")
if err := awsRestjson1_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpCreatePermissionVersion struct {
}
func (*awsRestjson1_serializeOpCreatePermissionVersion) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCreatePermissionVersion) 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.(*CreatePermissionVersionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/createpermissionversion")
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_serializeOpDocumentCreatePermissionVersionInput(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_serializeOpHttpBindingsCreatePermissionVersionInput(v *CreatePermissionVersionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentCreatePermissionVersionInput(v *CreatePermissionVersionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
if v.PolicyTemplate != nil {
ok := object.Key("policyTemplate")
ok.String(*v.PolicyTemplate)
}
return nil
}
type awsRestjson1_serializeOpCreateResourceShare struct {
}
func (*awsRestjson1_serializeOpCreateResourceShare) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCreateResourceShare) 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.(*CreateResourceShareInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/createresourceshare")
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_serializeOpDocumentCreateResourceShareInput(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_serializeOpHttpBindingsCreateResourceShareInput(v *CreateResourceShareInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentCreateResourceShareInput(v *CreateResourceShareInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.AllowExternalPrincipals != nil {
ok := object.Key("allowExternalPrincipals")
ok.Boolean(*v.AllowExternalPrincipals)
}
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.Name != nil {
ok := object.Key("name")
ok.String(*v.Name)
}
if v.PermissionArns != nil {
ok := object.Key("permissionArns")
if err := awsRestjson1_serializeDocumentPermissionArnList(v.PermissionArns, ok); err != nil {
return err
}
}
if v.Principals != nil {
ok := object.Key("principals")
if err := awsRestjson1_serializeDocumentPrincipalArnOrIdList(v.Principals, ok); err != nil {
return err
}
}
if v.ResourceArns != nil {
ok := object.Key("resourceArns")
if err := awsRestjson1_serializeDocumentResourceArnList(v.ResourceArns, ok); err != nil {
return err
}
}
if v.Tags != nil {
ok := object.Key("tags")
if err := awsRestjson1_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDeletePermission struct {
}
func (*awsRestjson1_serializeOpDeletePermission) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeletePermission) 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.(*DeletePermissionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/deletepermission")
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_serializeOpHttpBindingsDeletePermissionInput(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_serializeOpHttpBindingsDeletePermissionInput(v *DeletePermissionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.ClientToken != nil {
encoder.SetQuery("clientToken").String(*v.ClientToken)
}
if v.PermissionArn != nil {
encoder.SetQuery("permissionArn").String(*v.PermissionArn)
}
return nil
}
type awsRestjson1_serializeOpDeletePermissionVersion struct {
}
func (*awsRestjson1_serializeOpDeletePermissionVersion) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeletePermissionVersion) 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.(*DeletePermissionVersionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/deletepermissionversion")
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_serializeOpHttpBindingsDeletePermissionVersionInput(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_serializeOpHttpBindingsDeletePermissionVersionInput(v *DeletePermissionVersionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.ClientToken != nil {
encoder.SetQuery("clientToken").String(*v.ClientToken)
}
if v.PermissionArn != nil {
encoder.SetQuery("permissionArn").String(*v.PermissionArn)
}
if v.PermissionVersion != nil {
encoder.SetQuery("permissionVersion").Integer(*v.PermissionVersion)
}
return nil
}
type awsRestjson1_serializeOpDeleteResourceShare struct {
}
func (*awsRestjson1_serializeOpDeleteResourceShare) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeleteResourceShare) 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.(*DeleteResourceShareInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/deleteresourceshare")
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_serializeOpHttpBindingsDeleteResourceShareInput(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_serializeOpHttpBindingsDeleteResourceShareInput(v *DeleteResourceShareInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.ClientToken != nil {
encoder.SetQuery("clientToken").String(*v.ClientToken)
}
if v.ResourceShareArn != nil {
encoder.SetQuery("resourceShareArn").String(*v.ResourceShareArn)
}
return nil
}
type awsRestjson1_serializeOpDisassociateResourceShare struct {
}
func (*awsRestjson1_serializeOpDisassociateResourceShare) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDisassociateResourceShare) 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.(*DisassociateResourceShareInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/disassociateresourceshare")
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_serializeOpDocumentDisassociateResourceShareInput(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_serializeOpHttpBindingsDisassociateResourceShareInput(v *DisassociateResourceShareInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentDisassociateResourceShareInput(v *DisassociateResourceShareInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.Principals != nil {
ok := object.Key("principals")
if err := awsRestjson1_serializeDocumentPrincipalArnOrIdList(v.Principals, ok); err != nil {
return err
}
}
if v.ResourceArns != nil {
ok := object.Key("resourceArns")
if err := awsRestjson1_serializeDocumentResourceArnList(v.ResourceArns, ok); err != nil {
return err
}
}
if v.ResourceShareArn != nil {
ok := object.Key("resourceShareArn")
ok.String(*v.ResourceShareArn)
}
return nil
}
type awsRestjson1_serializeOpDisassociateResourceSharePermission struct {
}
func (*awsRestjson1_serializeOpDisassociateResourceSharePermission) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDisassociateResourceSharePermission) 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.(*DisassociateResourceSharePermissionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/disassociateresourcesharepermission")
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_serializeOpDocumentDisassociateResourceSharePermissionInput(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_serializeOpHttpBindingsDisassociateResourceSharePermissionInput(v *DisassociateResourceSharePermissionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentDisassociateResourceSharePermissionInput(v *DisassociateResourceSharePermissionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
if v.ResourceShareArn != nil {
ok := object.Key("resourceShareArn")
ok.String(*v.ResourceShareArn)
}
return nil
}
type awsRestjson1_serializeOpEnableSharingWithAwsOrganization struct {
}
func (*awsRestjson1_serializeOpEnableSharingWithAwsOrganization) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpEnableSharingWithAwsOrganization) 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.(*EnableSharingWithAwsOrganizationInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/enablesharingwithawsorganization")
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 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_serializeOpHttpBindingsEnableSharingWithAwsOrganizationInput(v *EnableSharingWithAwsOrganizationInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
type awsRestjson1_serializeOpGetPermission struct {
}
func (*awsRestjson1_serializeOpGetPermission) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetPermission) 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.(*GetPermissionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/getpermission")
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_serializeOpDocumentGetPermissionInput(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_serializeOpHttpBindingsGetPermissionInput(v *GetPermissionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentGetPermissionInput(v *GetPermissionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
if v.PermissionVersion != nil {
ok := object.Key("permissionVersion")
ok.Integer(*v.PermissionVersion)
}
return nil
}
type awsRestjson1_serializeOpGetResourcePolicies struct {
}
func (*awsRestjson1_serializeOpGetResourcePolicies) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetResourcePolicies) 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.(*GetResourcePoliciesInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/getresourcepolicies")
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_serializeOpDocumentGetResourcePoliciesInput(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_serializeOpHttpBindingsGetResourcePoliciesInput(v *GetResourcePoliciesInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentGetResourcePoliciesInput(v *GetResourcePoliciesInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.Principal != nil {
ok := object.Key("principal")
ok.String(*v.Principal)
}
if v.ResourceArns != nil {
ok := object.Key("resourceArns")
if err := awsRestjson1_serializeDocumentResourceArnList(v.ResourceArns, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetResourceShareAssociations struct {
}
func (*awsRestjson1_serializeOpGetResourceShareAssociations) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetResourceShareAssociations) 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.(*GetResourceShareAssociationsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/getresourceshareassociations")
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_serializeOpDocumentGetResourceShareAssociationsInput(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_serializeOpHttpBindingsGetResourceShareAssociationsInput(v *GetResourceShareAssociationsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentGetResourceShareAssociationsInput(v *GetResourceShareAssociationsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.AssociationStatus) > 0 {
ok := object.Key("associationStatus")
ok.String(string(v.AssociationStatus))
}
if len(v.AssociationType) > 0 {
ok := object.Key("associationType")
ok.String(string(v.AssociationType))
}
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.Principal != nil {
ok := object.Key("principal")
ok.String(*v.Principal)
}
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.ResourceShareArns != nil {
ok := object.Key("resourceShareArns")
if err := awsRestjson1_serializeDocumentResourceShareArnList(v.ResourceShareArns, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetResourceShareInvitations struct {
}
func (*awsRestjson1_serializeOpGetResourceShareInvitations) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetResourceShareInvitations) 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.(*GetResourceShareInvitationsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/getresourceshareinvitations")
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_serializeOpDocumentGetResourceShareInvitationsInput(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_serializeOpHttpBindingsGetResourceShareInvitationsInput(v *GetResourceShareInvitationsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentGetResourceShareInvitationsInput(v *GetResourceShareInvitationsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.ResourceShareArns != nil {
ok := object.Key("resourceShareArns")
if err := awsRestjson1_serializeDocumentResourceShareArnList(v.ResourceShareArns, ok); err != nil {
return err
}
}
if v.ResourceShareInvitationArns != nil {
ok := object.Key("resourceShareInvitationArns")
if err := awsRestjson1_serializeDocumentResourceShareInvitationArnList(v.ResourceShareInvitationArns, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetResourceShares struct {
}
func (*awsRestjson1_serializeOpGetResourceShares) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetResourceShares) 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.(*GetResourceSharesInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/getresourceshares")
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_serializeOpDocumentGetResourceSharesInput(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_serializeOpHttpBindingsGetResourceSharesInput(v *GetResourceSharesInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentGetResourceSharesInput(v *GetResourceSharesInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.Name != nil {
ok := object.Key("name")
ok.String(*v.Name)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
if v.PermissionVersion != nil {
ok := object.Key("permissionVersion")
ok.Integer(*v.PermissionVersion)
}
if len(v.ResourceOwner) > 0 {
ok := object.Key("resourceOwner")
ok.String(string(v.ResourceOwner))
}
if v.ResourceShareArns != nil {
ok := object.Key("resourceShareArns")
if err := awsRestjson1_serializeDocumentResourceShareArnList(v.ResourceShareArns, ok); err != nil {
return err
}
}
if len(v.ResourceShareStatus) > 0 {
ok := object.Key("resourceShareStatus")
ok.String(string(v.ResourceShareStatus))
}
if v.TagFilters != nil {
ok := object.Key("tagFilters")
if err := awsRestjson1_serializeDocumentTagFilters(v.TagFilters, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListPendingInvitationResources struct {
}
func (*awsRestjson1_serializeOpListPendingInvitationResources) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListPendingInvitationResources) 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.(*ListPendingInvitationResourcesInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listpendinginvitationresources")
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_serializeOpDocumentListPendingInvitationResourcesInput(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_serializeOpHttpBindingsListPendingInvitationResourcesInput(v *ListPendingInvitationResourcesInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListPendingInvitationResourcesInput(v *ListPendingInvitationResourcesInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if len(v.ResourceRegionScope) > 0 {
ok := object.Key("resourceRegionScope")
ok.String(string(v.ResourceRegionScope))
}
if v.ResourceShareInvitationArn != nil {
ok := object.Key("resourceShareInvitationArn")
ok.String(*v.ResourceShareInvitationArn)
}
return nil
}
type awsRestjson1_serializeOpListPermissionAssociations struct {
}
func (*awsRestjson1_serializeOpListPermissionAssociations) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListPermissionAssociations) 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.(*ListPermissionAssociationsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listpermissionassociations")
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_serializeOpDocumentListPermissionAssociationsInput(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_serializeOpHttpBindingsListPermissionAssociationsInput(v *ListPermissionAssociationsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListPermissionAssociationsInput(v *ListPermissionAssociationsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.AssociationStatus) > 0 {
ok := object.Key("associationStatus")
ok.String(string(v.AssociationStatus))
}
if v.DefaultVersion != nil {
ok := object.Key("defaultVersion")
ok.Boolean(*v.DefaultVersion)
}
if len(v.FeatureSet) > 0 {
ok := object.Key("featureSet")
ok.String(string(v.FeatureSet))
}
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
if v.PermissionVersion != nil {
ok := object.Key("permissionVersion")
ok.Integer(*v.PermissionVersion)
}
if v.ResourceType != nil {
ok := object.Key("resourceType")
ok.String(*v.ResourceType)
}
return nil
}
type awsRestjson1_serializeOpListPermissions struct {
}
func (*awsRestjson1_serializeOpListPermissions) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListPermissions) 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.(*ListPermissionsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listpermissions")
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_serializeOpDocumentListPermissionsInput(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_serializeOpHttpBindingsListPermissionsInput(v *ListPermissionsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListPermissionsInput(v *ListPermissionsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if len(v.PermissionType) > 0 {
ok := object.Key("permissionType")
ok.String(string(v.PermissionType))
}
if v.ResourceType != nil {
ok := object.Key("resourceType")
ok.String(*v.ResourceType)
}
return nil
}
type awsRestjson1_serializeOpListPermissionVersions struct {
}
func (*awsRestjson1_serializeOpListPermissionVersions) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListPermissionVersions) 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.(*ListPermissionVersionsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listpermissionversions")
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_serializeOpDocumentListPermissionVersionsInput(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_serializeOpHttpBindingsListPermissionVersionsInput(v *ListPermissionVersionsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListPermissionVersionsInput(v *ListPermissionVersionsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
return nil
}
type awsRestjson1_serializeOpListPrincipals struct {
}
func (*awsRestjson1_serializeOpListPrincipals) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListPrincipals) 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.(*ListPrincipalsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listprincipals")
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_serializeOpDocumentListPrincipalsInput(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_serializeOpHttpBindingsListPrincipalsInput(v *ListPrincipalsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListPrincipalsInput(v *ListPrincipalsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.Principals != nil {
ok := object.Key("principals")
if err := awsRestjson1_serializeDocumentPrincipalArnOrIdList(v.Principals, ok); err != nil {
return err
}
}
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if len(v.ResourceOwner) > 0 {
ok := object.Key("resourceOwner")
ok.String(string(v.ResourceOwner))
}
if v.ResourceShareArns != nil {
ok := object.Key("resourceShareArns")
if err := awsRestjson1_serializeDocumentResourceShareArnList(v.ResourceShareArns, ok); err != nil {
return err
}
}
if v.ResourceType != nil {
ok := object.Key("resourceType")
ok.String(*v.ResourceType)
}
return nil
}
type awsRestjson1_serializeOpListReplacePermissionAssociationsWork struct {
}
func (*awsRestjson1_serializeOpListReplacePermissionAssociationsWork) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListReplacePermissionAssociationsWork) 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.(*ListReplacePermissionAssociationsWorkInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listreplacepermissionassociationswork")
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_serializeOpDocumentListReplacePermissionAssociationsWorkInput(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_serializeOpHttpBindingsListReplacePermissionAssociationsWorkInput(v *ListReplacePermissionAssociationsWorkInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListReplacePermissionAssociationsWorkInput(v *ListReplacePermissionAssociationsWorkInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if len(v.Status) > 0 {
ok := object.Key("status")
ok.String(string(v.Status))
}
if v.WorkIds != nil {
ok := object.Key("workIds")
if err := awsRestjson1_serializeDocumentReplacePermissionAssociationsWorkIdList(v.WorkIds, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListResources struct {
}
func (*awsRestjson1_serializeOpListResources) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListResources) 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.(*ListResourcesInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listresources")
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_serializeOpDocumentListResourcesInput(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_serializeOpHttpBindingsListResourcesInput(v *ListResourcesInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListResourcesInput(v *ListResourcesInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.Principal != nil {
ok := object.Key("principal")
ok.String(*v.Principal)
}
if v.ResourceArns != nil {
ok := object.Key("resourceArns")
if err := awsRestjson1_serializeDocumentResourceArnList(v.ResourceArns, ok); err != nil {
return err
}
}
if len(v.ResourceOwner) > 0 {
ok := object.Key("resourceOwner")
ok.String(string(v.ResourceOwner))
}
if len(v.ResourceRegionScope) > 0 {
ok := object.Key("resourceRegionScope")
ok.String(string(v.ResourceRegionScope))
}
if v.ResourceShareArns != nil {
ok := object.Key("resourceShareArns")
if err := awsRestjson1_serializeDocumentResourceShareArnList(v.ResourceShareArns, ok); err != nil {
return err
}
}
if v.ResourceType != nil {
ok := object.Key("resourceType")
ok.String(*v.ResourceType)
}
return nil
}
type awsRestjson1_serializeOpListResourceSharePermissions struct {
}
func (*awsRestjson1_serializeOpListResourceSharePermissions) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListResourceSharePermissions) 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.(*ListResourceSharePermissionsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listresourcesharepermissions")
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_serializeOpDocumentListResourceSharePermissionsInput(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_serializeOpHttpBindingsListResourceSharePermissionsInput(v *ListResourceSharePermissionsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListResourceSharePermissionsInput(v *ListResourceSharePermissionsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if v.ResourceShareArn != nil {
ok := object.Key("resourceShareArn")
ok.String(*v.ResourceShareArn)
}
return nil
}
type awsRestjson1_serializeOpListResourceTypes struct {
}
func (*awsRestjson1_serializeOpListResourceTypes) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListResourceTypes) 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.(*ListResourceTypesInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/listresourcetypes")
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_serializeOpDocumentListResourceTypesInput(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_serializeOpHttpBindingsListResourceTypesInput(v *ListResourceTypesInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListResourceTypesInput(v *ListResourceTypesInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.MaxResults != nil {
ok := object.Key("maxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("nextToken")
ok.String(*v.NextToken)
}
if len(v.ResourceRegionScope) > 0 {
ok := object.Key("resourceRegionScope")
ok.String(string(v.ResourceRegionScope))
}
return nil
}
type awsRestjson1_serializeOpPromotePermissionCreatedFromPolicy struct {
}
func (*awsRestjson1_serializeOpPromotePermissionCreatedFromPolicy) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpPromotePermissionCreatedFromPolicy) 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.(*PromotePermissionCreatedFromPolicyInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/promotepermissioncreatedfrompolicy")
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_serializeOpDocumentPromotePermissionCreatedFromPolicyInput(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_serializeOpHttpBindingsPromotePermissionCreatedFromPolicyInput(v *PromotePermissionCreatedFromPolicyInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentPromotePermissionCreatedFromPolicyInput(v *PromotePermissionCreatedFromPolicyInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.Name != nil {
ok := object.Key("name")
ok.String(*v.Name)
}
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
return nil
}
type awsRestjson1_serializeOpPromoteResourceShareCreatedFromPolicy struct {
}
func (*awsRestjson1_serializeOpPromoteResourceShareCreatedFromPolicy) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpPromoteResourceShareCreatedFromPolicy) 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.(*PromoteResourceShareCreatedFromPolicyInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/promoteresourcesharecreatedfrompolicy")
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_serializeOpHttpBindingsPromoteResourceShareCreatedFromPolicyInput(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_serializeOpHttpBindingsPromoteResourceShareCreatedFromPolicyInput(v *PromoteResourceShareCreatedFromPolicyInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.ResourceShareArn != nil {
encoder.SetQuery("resourceShareArn").String(*v.ResourceShareArn)
}
return nil
}
type awsRestjson1_serializeOpRejectResourceShareInvitation struct {
}
func (*awsRestjson1_serializeOpRejectResourceShareInvitation) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpRejectResourceShareInvitation) 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.(*RejectResourceShareInvitationInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/rejectresourceshareinvitation")
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_serializeOpDocumentRejectResourceShareInvitationInput(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_serializeOpHttpBindingsRejectResourceShareInvitationInput(v *RejectResourceShareInvitationInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentRejectResourceShareInvitationInput(v *RejectResourceShareInvitationInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.ResourceShareInvitationArn != nil {
ok := object.Key("resourceShareInvitationArn")
ok.String(*v.ResourceShareInvitationArn)
}
return nil
}
type awsRestjson1_serializeOpReplacePermissionAssociations struct {
}
func (*awsRestjson1_serializeOpReplacePermissionAssociations) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpReplacePermissionAssociations) 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.(*ReplacePermissionAssociationsInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/replacepermissionassociations")
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_serializeOpDocumentReplacePermissionAssociationsInput(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_serializeOpHttpBindingsReplacePermissionAssociationsInput(v *ReplacePermissionAssociationsInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentReplacePermissionAssociationsInput(v *ReplacePermissionAssociationsInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.FromPermissionArn != nil {
ok := object.Key("fromPermissionArn")
ok.String(*v.FromPermissionArn)
}
if v.FromPermissionVersion != nil {
ok := object.Key("fromPermissionVersion")
ok.Integer(*v.FromPermissionVersion)
}
if v.ToPermissionArn != nil {
ok := object.Key("toPermissionArn")
ok.String(*v.ToPermissionArn)
}
return nil
}
type awsRestjson1_serializeOpSetDefaultPermissionVersion struct {
}
func (*awsRestjson1_serializeOpSetDefaultPermissionVersion) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpSetDefaultPermissionVersion) 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.(*SetDefaultPermissionVersionInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/setdefaultpermissionversion")
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_serializeOpDocumentSetDefaultPermissionVersionInput(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_serializeOpHttpBindingsSetDefaultPermissionVersionInput(v *SetDefaultPermissionVersionInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentSetDefaultPermissionVersionInput(v *SetDefaultPermissionVersionInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.PermissionArn != nil {
ok := object.Key("permissionArn")
ok.String(*v.PermissionArn)
}
if v.PermissionVersion != nil {
ok := object.Key("permissionVersion")
ok.Integer(*v.PermissionVersion)
}
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("/tagresource")
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_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)
}
return nil
}
func awsRestjson1_serializeOpDocumentTagResourceInput(v *TagResourceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.ResourceShareArn != nil {
ok := object.Key("resourceShareArn")
ok.String(*v.ResourceShareArn)
}
if v.Tags != nil {
ok := object.Key("tags")
if err := awsRestjson1_serializeDocumentTagList(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("/untagresource")
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_serializeOpDocumentUntagResourceInput(input, jsonEncoder.Value); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
if request.Request, err = 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)
}
return nil
}
func awsRestjson1_serializeOpDocumentUntagResourceInput(v *UntagResourceInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ResourceArn != nil {
ok := object.Key("resourceArn")
ok.String(*v.ResourceArn)
}
if v.ResourceShareArn != nil {
ok := object.Key("resourceShareArn")
ok.String(*v.ResourceShareArn)
}
if v.TagKeys != nil {
ok := object.Key("tagKeys")
if err := awsRestjson1_serializeDocumentTagKeyList(v.TagKeys, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpUpdateResourceShare struct {
}
func (*awsRestjson1_serializeOpUpdateResourceShare) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpUpdateResourceShare) 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.(*UpdateResourceShareInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/updateresourceshare")
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_serializeOpDocumentUpdateResourceShareInput(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_serializeOpHttpBindingsUpdateResourceShareInput(v *UpdateResourceShareInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentUpdateResourceShareInput(v *UpdateResourceShareInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.AllowExternalPrincipals != nil {
ok := object.Key("allowExternalPrincipals")
ok.Boolean(*v.AllowExternalPrincipals)
}
if v.ClientToken != nil {
ok := object.Key("clientToken")
ok.String(*v.ClientToken)
}
if v.Name != nil {
ok := object.Key("name")
ok.String(*v.Name)
}
if v.ResourceShareArn != nil {
ok := object.Key("resourceShareArn")
ok.String(*v.ResourceShareArn)
}
return nil
}
func awsRestjson1_serializeDocumentPermissionArnList(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_serializeDocumentPrincipalArnOrIdList(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_serializeDocumentReplacePermissionAssociationsWorkIdList(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_serializeDocumentResourceArnList(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_serializeDocumentResourceShareArnList(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_serializeDocumentResourceShareInvitationArnList(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_serializeDocumentTag(v *types.Tag, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Key != nil {
ok := object.Key("key")
ok.String(*v.Key)
}
if v.Value != nil {
ok := object.Key("value")
ok.String(*v.Value)
}
return nil
}
func awsRestjson1_serializeDocumentTagFilter(v *types.TagFilter, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.TagKey != nil {
ok := object.Key("tagKey")
ok.String(*v.TagKey)
}
if v.TagValues != nil {
ok := object.Key("tagValues")
if err := awsRestjson1_serializeDocumentTagValueList(v.TagValues, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentTagFilters(v []types.TagFilter, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsRestjson1_serializeDocumentTagFilter(&v[i], av); 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_serializeDocumentTagList(v []types.Tag, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsRestjson1_serializeDocumentTag(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentTagValueList(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
}
| 2,935 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package ram
import (
"context"
"fmt"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
)
type validateOpAcceptResourceShareInvitation struct {
}
func (*validateOpAcceptResourceShareInvitation) ID() string {
return "OperationInputValidation"
}
func (m *validateOpAcceptResourceShareInvitation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*AcceptResourceShareInvitationInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpAcceptResourceShareInvitationInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpAssociateResourceShare struct {
}
func (*validateOpAssociateResourceShare) ID() string {
return "OperationInputValidation"
}
func (m *validateOpAssociateResourceShare) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*AssociateResourceShareInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpAssociateResourceShareInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpAssociateResourceSharePermission struct {
}
func (*validateOpAssociateResourceSharePermission) ID() string {
return "OperationInputValidation"
}
func (m *validateOpAssociateResourceSharePermission) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*AssociateResourceSharePermissionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpAssociateResourceSharePermissionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreatePermission struct {
}
func (*validateOpCreatePermission) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreatePermission) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreatePermissionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreatePermissionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreatePermissionVersion struct {
}
func (*validateOpCreatePermissionVersion) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreatePermissionVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreatePermissionVersionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreatePermissionVersionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpCreateResourceShare struct {
}
func (*validateOpCreateResourceShare) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateResourceShare) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateResourceShareInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateResourceShareInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeletePermission struct {
}
func (*validateOpDeletePermission) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeletePermission) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeletePermissionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeletePermissionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeletePermissionVersion struct {
}
func (*validateOpDeletePermissionVersion) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeletePermissionVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeletePermissionVersionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeletePermissionVersionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteResourceShare struct {
}
func (*validateOpDeleteResourceShare) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteResourceShare) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteResourceShareInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteResourceShareInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDisassociateResourceShare struct {
}
func (*validateOpDisassociateResourceShare) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDisassociateResourceShare) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DisassociateResourceShareInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDisassociateResourceShareInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDisassociateResourceSharePermission struct {
}
func (*validateOpDisassociateResourceSharePermission) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDisassociateResourceSharePermission) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DisassociateResourceSharePermissionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDisassociateResourceSharePermissionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetPermission struct {
}
func (*validateOpGetPermission) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetPermission) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetPermissionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetPermissionInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetResourcePolicies struct {
}
func (*validateOpGetResourcePolicies) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetResourcePolicies) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetResourcePoliciesInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetResourcePoliciesInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetResourceShareAssociations struct {
}
func (*validateOpGetResourceShareAssociations) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetResourceShareAssociations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetResourceShareAssociationsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetResourceShareAssociationsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetResourceShares struct {
}
func (*validateOpGetResourceShares) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetResourceShares) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetResourceSharesInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetResourceSharesInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListPendingInvitationResources struct {
}
func (*validateOpListPendingInvitationResources) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListPendingInvitationResources) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListPendingInvitationResourcesInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListPendingInvitationResourcesInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListPermissionVersions struct {
}
func (*validateOpListPermissionVersions) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListPermissionVersions) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListPermissionVersionsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListPermissionVersionsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListPrincipals struct {
}
func (*validateOpListPrincipals) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListPrincipals) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListPrincipalsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListPrincipalsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListResourceSharePermissions struct {
}
func (*validateOpListResourceSharePermissions) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListResourceSharePermissions) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListResourceSharePermissionsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListResourceSharePermissionsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListResources struct {
}
func (*validateOpListResources) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListResources) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListResourcesInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListResourcesInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpPromotePermissionCreatedFromPolicy struct {
}
func (*validateOpPromotePermissionCreatedFromPolicy) ID() string {
return "OperationInputValidation"
}
func (m *validateOpPromotePermissionCreatedFromPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*PromotePermissionCreatedFromPolicyInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpPromotePermissionCreatedFromPolicyInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpPromoteResourceShareCreatedFromPolicy struct {
}
func (*validateOpPromoteResourceShareCreatedFromPolicy) ID() string {
return "OperationInputValidation"
}
func (m *validateOpPromoteResourceShareCreatedFromPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*PromoteResourceShareCreatedFromPolicyInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpPromoteResourceShareCreatedFromPolicyInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpRejectResourceShareInvitation struct {
}
func (*validateOpRejectResourceShareInvitation) ID() string {
return "OperationInputValidation"
}
func (m *validateOpRejectResourceShareInvitation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*RejectResourceShareInvitationInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpRejectResourceShareInvitationInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpReplacePermissionAssociations struct {
}
func (*validateOpReplacePermissionAssociations) ID() string {
return "OperationInputValidation"
}
func (m *validateOpReplacePermissionAssociations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ReplacePermissionAssociationsInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpReplacePermissionAssociationsInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpSetDefaultPermissionVersion struct {
}
func (*validateOpSetDefaultPermissionVersion) ID() string {
return "OperationInputValidation"
}
func (m *validateOpSetDefaultPermissionVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*SetDefaultPermissionVersionInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpSetDefaultPermissionVersionInput(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 validateOpUpdateResourceShare struct {
}
func (*validateOpUpdateResourceShare) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateResourceShare) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateResourceShareInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateResourceShareInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
func addOpAcceptResourceShareInvitationValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpAcceptResourceShareInvitation{}, middleware.After)
}
func addOpAssociateResourceShareValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpAssociateResourceShare{}, middleware.After)
}
func addOpAssociateResourceSharePermissionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpAssociateResourceSharePermission{}, middleware.After)
}
func addOpCreatePermissionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreatePermission{}, middleware.After)
}
func addOpCreatePermissionVersionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreatePermissionVersion{}, middleware.After)
}
func addOpCreateResourceShareValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateResourceShare{}, middleware.After)
}
func addOpDeletePermissionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeletePermission{}, middleware.After)
}
func addOpDeletePermissionVersionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeletePermissionVersion{}, middleware.After)
}
func addOpDeleteResourceShareValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteResourceShare{}, middleware.After)
}
func addOpDisassociateResourceShareValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDisassociateResourceShare{}, middleware.After)
}
func addOpDisassociateResourceSharePermissionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDisassociateResourceSharePermission{}, middleware.After)
}
func addOpGetPermissionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetPermission{}, middleware.After)
}
func addOpGetResourcePoliciesValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetResourcePolicies{}, middleware.After)
}
func addOpGetResourceShareAssociationsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetResourceShareAssociations{}, middleware.After)
}
func addOpGetResourceSharesValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetResourceShares{}, middleware.After)
}
func addOpListPendingInvitationResourcesValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListPendingInvitationResources{}, middleware.After)
}
func addOpListPermissionVersionsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListPermissionVersions{}, middleware.After)
}
func addOpListPrincipalsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListPrincipals{}, middleware.After)
}
func addOpListResourceSharePermissionsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListResourceSharePermissions{}, middleware.After)
}
func addOpListResourcesValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListResources{}, middleware.After)
}
func addOpPromotePermissionCreatedFromPolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpPromotePermissionCreatedFromPolicy{}, middleware.After)
}
func addOpPromoteResourceShareCreatedFromPolicyValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpPromoteResourceShareCreatedFromPolicy{}, middleware.After)
}
func addOpRejectResourceShareInvitationValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpRejectResourceShareInvitation{}, middleware.After)
}
func addOpReplacePermissionAssociationsValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpReplacePermissionAssociations{}, middleware.After)
}
func addOpSetDefaultPermissionVersionValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpSetDefaultPermissionVersion{}, 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 addOpUpdateResourceShareValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateResourceShare{}, middleware.After)
}
func validateOpAcceptResourceShareInvitationInput(v *AcceptResourceShareInvitationInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "AcceptResourceShareInvitationInput"}
if v.ResourceShareInvitationArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareInvitationArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpAssociateResourceShareInput(v *AssociateResourceShareInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "AssociateResourceShareInput"}
if v.ResourceShareArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpAssociateResourceSharePermissionInput(v *AssociateResourceSharePermissionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "AssociateResourceSharePermissionInput"}
if v.ResourceShareArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareArn"))
}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreatePermissionInput(v *CreatePermissionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreatePermissionInput"}
if v.Name == nil {
invalidParams.Add(smithy.NewErrParamRequired("Name"))
}
if v.ResourceType == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceType"))
}
if v.PolicyTemplate == nil {
invalidParams.Add(smithy.NewErrParamRequired("PolicyTemplate"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreatePermissionVersionInput(v *CreatePermissionVersionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreatePermissionVersionInput"}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if v.PolicyTemplate == nil {
invalidParams.Add(smithy.NewErrParamRequired("PolicyTemplate"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateResourceShareInput(v *CreateResourceShareInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateResourceShareInput"}
if v.Name == nil {
invalidParams.Add(smithy.NewErrParamRequired("Name"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeletePermissionInput(v *DeletePermissionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeletePermissionInput"}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeletePermissionVersionInput(v *DeletePermissionVersionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeletePermissionVersionInput"}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if v.PermissionVersion == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionVersion"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteResourceShareInput(v *DeleteResourceShareInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteResourceShareInput"}
if v.ResourceShareArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDisassociateResourceShareInput(v *DisassociateResourceShareInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DisassociateResourceShareInput"}
if v.ResourceShareArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDisassociateResourceSharePermissionInput(v *DisassociateResourceSharePermissionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DisassociateResourceSharePermissionInput"}
if v.ResourceShareArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareArn"))
}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetPermissionInput(v *GetPermissionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetPermissionInput"}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetResourcePoliciesInput(v *GetResourcePoliciesInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetResourcePoliciesInput"}
if v.ResourceArns == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArns"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetResourceShareAssociationsInput(v *GetResourceShareAssociationsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetResourceShareAssociationsInput"}
if len(v.AssociationType) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("AssociationType"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetResourceSharesInput(v *GetResourceSharesInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetResourceSharesInput"}
if len(v.ResourceOwner) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("ResourceOwner"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListPendingInvitationResourcesInput(v *ListPendingInvitationResourcesInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListPendingInvitationResourcesInput"}
if v.ResourceShareInvitationArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareInvitationArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListPermissionVersionsInput(v *ListPermissionVersionsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListPermissionVersionsInput"}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListPrincipalsInput(v *ListPrincipalsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListPrincipalsInput"}
if len(v.ResourceOwner) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("ResourceOwner"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListResourceSharePermissionsInput(v *ListResourceSharePermissionsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListResourceSharePermissionsInput"}
if v.ResourceShareArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListResourcesInput(v *ListResourcesInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListResourcesInput"}
if len(v.ResourceOwner) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("ResourceOwner"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpPromotePermissionCreatedFromPolicyInput(v *PromotePermissionCreatedFromPolicyInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "PromotePermissionCreatedFromPolicyInput"}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if v.Name == nil {
invalidParams.Add(smithy.NewErrParamRequired("Name"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpPromoteResourceShareCreatedFromPolicyInput(v *PromoteResourceShareCreatedFromPolicyInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "PromoteResourceShareCreatedFromPolicyInput"}
if v.ResourceShareArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpRejectResourceShareInvitationInput(v *RejectResourceShareInvitationInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "RejectResourceShareInvitationInput"}
if v.ResourceShareInvitationArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareInvitationArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpReplacePermissionAssociationsInput(v *ReplacePermissionAssociationsInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ReplacePermissionAssociationsInput"}
if v.FromPermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("FromPermissionArn"))
}
if v.ToPermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ToPermissionArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpSetDefaultPermissionVersionInput(v *SetDefaultPermissionVersionInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "SetDefaultPermissionVersionInput"}
if v.PermissionArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionArn"))
}
if v.PermissionVersion == nil {
invalidParams.Add(smithy.NewErrParamRequired("PermissionVersion"))
}
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.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.TagKeys == nil {
invalidParams.Add(smithy.NewErrParamRequired("TagKeys"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUpdateResourceShareInput(v *UpdateResourceShareInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateResourceShareInput"}
if v.ResourceShareArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceShareArn"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
| 1,130 |
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 RAM 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: "ram.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "ram-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "ram.{region}.amazonaws.com",
Protocols: []string{"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-south-2",
}: 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: "ap-southeast-4",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram-fips.ca-central-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "eu-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-central-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-north-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-south-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-south-2",
}: 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: "ram-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: "ram-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: "ram-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: "ram-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: "ram-fips.us-west-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-west-2",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "me-central-1",
}: endpoints.Endpoint{},
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: "ram-fips.us-east-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-east-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-2",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram-fips.us-east-2.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram-fips.us-west-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-west-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-2",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram-fips.us-west-2.amazonaws.com",
},
},
},
{
ID: "aws-cn",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "ram.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram-fips.{region}.amazonaws.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "ram-fips.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "ram.{region}.amazonaws.com.cn",
Protocols: []string{"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: "ram-fips.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "ram.{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{},
endpoints.EndpointKey{
Region: "us-iso-west-1",
}: endpoints.Endpoint{},
},
},
{
ID: "aws-iso-b",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram-fips.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "ram.{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: "ram-fips.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "ram.{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: "ram-fips.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "ram.{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: "ram.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "ram-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "ram.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsUsGov,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "us-gov-east-1",
}: endpoints.Endpoint{
Hostname: "ram.us-gov-east-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-gov-east-1",
},
},
endpoints.EndpointKey{
Region: "us-gov-east-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram.us-gov-east-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-gov-east-1",
},
},
endpoints.EndpointKey{
Region: "us-gov-east-1-fips",
}: endpoints.Endpoint{
Hostname: "ram.us-gov-east-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-gov-east-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "us-gov-west-1",
}: endpoints.Endpoint{
Hostname: "ram.us-gov-west-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-gov-west-1",
},
},
endpoints.EndpointKey{
Region: "us-gov-west-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "ram.us-gov-west-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-gov-west-1",
},
},
endpoints.EndpointKey{
Region: "us-gov-west-1-fips",
}: endpoints.Endpoint{
Hostname: "ram.us-gov-west-1.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-gov-west-1",
},
Deprecated: aws.TrueTernary,
},
},
},
}
| 530 |
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 PermissionFeatureSet string
// Enum values for PermissionFeatureSet
const (
PermissionFeatureSetCreatedFromPolicy PermissionFeatureSet = "CREATED_FROM_POLICY"
PermissionFeatureSetPromotingToStandard PermissionFeatureSet = "PROMOTING_TO_STANDARD"
PermissionFeatureSetStandard PermissionFeatureSet = "STANDARD"
)
// Values returns all known values for PermissionFeatureSet. 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 (PermissionFeatureSet) Values() []PermissionFeatureSet {
return []PermissionFeatureSet{
"CREATED_FROM_POLICY",
"PROMOTING_TO_STANDARD",
"STANDARD",
}
}
type PermissionStatus string
// Enum values for PermissionStatus
const (
PermissionStatusAttachable PermissionStatus = "ATTACHABLE"
PermissionStatusUnattachable PermissionStatus = "UNATTACHABLE"
PermissionStatusDeleting PermissionStatus = "DELETING"
PermissionStatusDeleted PermissionStatus = "DELETED"
)
// Values returns all known values for PermissionStatus. 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 (PermissionStatus) Values() []PermissionStatus {
return []PermissionStatus{
"ATTACHABLE",
"UNATTACHABLE",
"DELETING",
"DELETED",
}
}
type PermissionType string
// Enum values for PermissionType
const (
PermissionTypeCustomerManaged PermissionType = "CUSTOMER_MANAGED"
PermissionTypeAwsManaged PermissionType = "AWS_MANAGED"
)
// Values returns all known values for PermissionType. 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 (PermissionType) Values() []PermissionType {
return []PermissionType{
"CUSTOMER_MANAGED",
"AWS_MANAGED",
}
}
type PermissionTypeFilter string
// Enum values for PermissionTypeFilter
const (
PermissionTypeFilterAll PermissionTypeFilter = "ALL"
PermissionTypeFilterAwsManaged PermissionTypeFilter = "AWS_MANAGED"
PermissionTypeFilterCustomerManaged PermissionTypeFilter = "CUSTOMER_MANAGED"
)
// Values returns all known values for PermissionTypeFilter. 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 (PermissionTypeFilter) Values() []PermissionTypeFilter {
return []PermissionTypeFilter{
"ALL",
"AWS_MANAGED",
"CUSTOMER_MANAGED",
}
}
type ReplacePermissionAssociationsWorkStatus string
// Enum values for ReplacePermissionAssociationsWorkStatus
const (
ReplacePermissionAssociationsWorkStatusInProgress ReplacePermissionAssociationsWorkStatus = "IN_PROGRESS"
ReplacePermissionAssociationsWorkStatusCompleted ReplacePermissionAssociationsWorkStatus = "COMPLETED"
ReplacePermissionAssociationsWorkStatusFailed ReplacePermissionAssociationsWorkStatus = "FAILED"
)
// Values returns all known values for ReplacePermissionAssociationsWorkStatus.
// 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 (ReplacePermissionAssociationsWorkStatus) Values() []ReplacePermissionAssociationsWorkStatus {
return []ReplacePermissionAssociationsWorkStatus{
"IN_PROGRESS",
"COMPLETED",
"FAILED",
}
}
type ResourceOwner string
// Enum values for ResourceOwner
const (
ResourceOwnerSelf ResourceOwner = "SELF"
ResourceOwnerOtherAccounts ResourceOwner = "OTHER-ACCOUNTS"
)
// Values returns all known values for ResourceOwner. 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 (ResourceOwner) Values() []ResourceOwner {
return []ResourceOwner{
"SELF",
"OTHER-ACCOUNTS",
}
}
type ResourceRegionScope string
// Enum values for ResourceRegionScope
const (
ResourceRegionScopeRegional ResourceRegionScope = "REGIONAL"
ResourceRegionScopeGlobal ResourceRegionScope = "GLOBAL"
)
// Values returns all known values for ResourceRegionScope. 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 (ResourceRegionScope) Values() []ResourceRegionScope {
return []ResourceRegionScope{
"REGIONAL",
"GLOBAL",
}
}
type ResourceRegionScopeFilter string
// Enum values for ResourceRegionScopeFilter
const (
ResourceRegionScopeFilterAll ResourceRegionScopeFilter = "ALL"
ResourceRegionScopeFilterRegional ResourceRegionScopeFilter = "REGIONAL"
ResourceRegionScopeFilterGlobal ResourceRegionScopeFilter = "GLOBAL"
)
// Values returns all known values for ResourceRegionScopeFilter. 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 (ResourceRegionScopeFilter) Values() []ResourceRegionScopeFilter {
return []ResourceRegionScopeFilter{
"ALL",
"REGIONAL",
"GLOBAL",
}
}
type ResourceShareAssociationStatus string
// Enum values for ResourceShareAssociationStatus
const (
ResourceShareAssociationStatusAssociating ResourceShareAssociationStatus = "ASSOCIATING"
ResourceShareAssociationStatusAssociated ResourceShareAssociationStatus = "ASSOCIATED"
ResourceShareAssociationStatusFailed ResourceShareAssociationStatus = "FAILED"
ResourceShareAssociationStatusDisassociating ResourceShareAssociationStatus = "DISASSOCIATING"
ResourceShareAssociationStatusDisassociated ResourceShareAssociationStatus = "DISASSOCIATED"
)
// Values returns all known values for ResourceShareAssociationStatus. 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 (ResourceShareAssociationStatus) Values() []ResourceShareAssociationStatus {
return []ResourceShareAssociationStatus{
"ASSOCIATING",
"ASSOCIATED",
"FAILED",
"DISASSOCIATING",
"DISASSOCIATED",
}
}
type ResourceShareAssociationType string
// Enum values for ResourceShareAssociationType
const (
ResourceShareAssociationTypePrincipal ResourceShareAssociationType = "PRINCIPAL"
ResourceShareAssociationTypeResource ResourceShareAssociationType = "RESOURCE"
)
// Values returns all known values for ResourceShareAssociationType. 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 (ResourceShareAssociationType) Values() []ResourceShareAssociationType {
return []ResourceShareAssociationType{
"PRINCIPAL",
"RESOURCE",
}
}
type ResourceShareFeatureSet string
// Enum values for ResourceShareFeatureSet
const (
ResourceShareFeatureSetCreatedFromPolicy ResourceShareFeatureSet = "CREATED_FROM_POLICY"
ResourceShareFeatureSetPromotingToStandard ResourceShareFeatureSet = "PROMOTING_TO_STANDARD"
ResourceShareFeatureSetStandard ResourceShareFeatureSet = "STANDARD"
)
// Values returns all known values for ResourceShareFeatureSet. 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 (ResourceShareFeatureSet) Values() []ResourceShareFeatureSet {
return []ResourceShareFeatureSet{
"CREATED_FROM_POLICY",
"PROMOTING_TO_STANDARD",
"STANDARD",
}
}
type ResourceShareInvitationStatus string
// Enum values for ResourceShareInvitationStatus
const (
ResourceShareInvitationStatusPending ResourceShareInvitationStatus = "PENDING"
ResourceShareInvitationStatusAccepted ResourceShareInvitationStatus = "ACCEPTED"
ResourceShareInvitationStatusRejected ResourceShareInvitationStatus = "REJECTED"
ResourceShareInvitationStatusExpired ResourceShareInvitationStatus = "EXPIRED"
)
// Values returns all known values for ResourceShareInvitationStatus. 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 (ResourceShareInvitationStatus) Values() []ResourceShareInvitationStatus {
return []ResourceShareInvitationStatus{
"PENDING",
"ACCEPTED",
"REJECTED",
"EXPIRED",
}
}
type ResourceShareStatus string
// Enum values for ResourceShareStatus
const (
ResourceShareStatusPending ResourceShareStatus = "PENDING"
ResourceShareStatusActive ResourceShareStatus = "ACTIVE"
ResourceShareStatusFailed ResourceShareStatus = "FAILED"
ResourceShareStatusDeleting ResourceShareStatus = "DELETING"
ResourceShareStatusDeleted ResourceShareStatus = "DELETED"
)
// Values returns all known values for ResourceShareStatus. 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 (ResourceShareStatus) Values() []ResourceShareStatus {
return []ResourceShareStatus{
"PENDING",
"ACTIVE",
"FAILED",
"DELETING",
"DELETED",
}
}
type ResourceStatus string
// Enum values for ResourceStatus
const (
ResourceStatusAvailable ResourceStatus = "AVAILABLE"
ResourceStatusZonalResourceInaccessible ResourceStatus = "ZONAL_RESOURCE_INACCESSIBLE"
ResourceStatusLimitExceeded ResourceStatus = "LIMIT_EXCEEDED"
ResourceStatusUnavailable ResourceStatus = "UNAVAILABLE"
ResourceStatusPending ResourceStatus = "PENDING"
)
// Values returns all known values for ResourceStatus. 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 (ResourceStatus) Values() []ResourceStatus {
return []ResourceStatus{
"AVAILABLE",
"ZONAL_RESOURCE_INACCESSIBLE",
"LIMIT_EXCEEDED",
"UNAVAILABLE",
"PENDING",
}
}
| 296 |
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"
)
// The operation failed because the client token input parameter matched one that
// was used with a previous call to the operation, but at least one of the other
// input parameters is different from the previous call.
type IdempotentParameterMismatchException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *IdempotentParameterMismatchException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *IdempotentParameterMismatchException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *IdempotentParameterMismatchException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "IdempotentParameterMismatchException"
}
return *e.ErrorCodeOverride
}
func (e *IdempotentParameterMismatchException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
// The operation failed because the specified client token isn't valid.
type InvalidClientTokenException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InvalidClientTokenException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidClientTokenException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidClientTokenException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidClientTokenException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidClientTokenException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the specified value for MaxResults isn't valid.
type InvalidMaxResultsException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InvalidMaxResultsException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidMaxResultsException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidMaxResultsException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidMaxResultsException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidMaxResultsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the specified value for NextToken isn't valid. You
// must specify a value you received in the NextToken response of a previous call
// to this operation.
type InvalidNextTokenException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InvalidNextTokenException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidNextTokenException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidNextTokenException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidNextTokenException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidNextTokenException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because a parameter you specified isn't valid.
type InvalidParameterException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InvalidParameterException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidParameterException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidParameterException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidParameterException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because a policy you specified isn't valid.
type InvalidPolicyException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InvalidPolicyException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidPolicyException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidPolicyException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidPolicyException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidPolicyException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the specified resource type isn't valid.
type InvalidResourceTypeException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InvalidResourceTypeException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidResourceTypeException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidResourceTypeException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidResourceTypeException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidResourceTypeException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the requested operation isn't valid for the
// resource share in its current state.
type InvalidStateTransitionException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *InvalidStateTransitionException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *InvalidStateTransitionException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *InvalidStateTransitionException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "InvalidStateTransitionException"
}
return *e.ErrorCodeOverride
}
func (e *InvalidStateTransitionException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the specified Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// has a format that isn't valid.
type MalformedArnException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *MalformedArnException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *MalformedArnException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *MalformedArnException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "MalformedArnException"
}
return *e.ErrorCodeOverride
}
func (e *MalformedArnException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the policy template that you provided isn't valid.
type MalformedPolicyTemplateException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *MalformedPolicyTemplateException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *MalformedPolicyTemplateException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *MalformedPolicyTemplateException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "MalformedPolicyTemplateException"
}
return *e.ErrorCodeOverride
}
func (e *MalformedPolicyTemplateException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because a required input parameter is missing.
type MissingRequiredParameterException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *MissingRequiredParameterException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *MissingRequiredParameterException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *MissingRequiredParameterException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "MissingRequiredParameterException"
}
return *e.ErrorCodeOverride
}
func (e *MissingRequiredParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the requested operation isn't permitted.
type OperationNotPermittedException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *OperationNotPermittedException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *OperationNotPermittedException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *OperationNotPermittedException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "OperationNotPermittedException"
}
return *e.ErrorCodeOverride
}
func (e *OperationNotPermittedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because a permission with the specified name already
// exists in the requested Amazon Web Services Region. Choose a different name.
type PermissionAlreadyExistsException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *PermissionAlreadyExistsException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *PermissionAlreadyExistsException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *PermissionAlreadyExistsException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "PermissionAlreadyExistsException"
}
return *e.ErrorCodeOverride
}
func (e *PermissionAlreadyExistsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because it would exceed the maximum number of permissions
// you can create in each Amazon Web Services Region. To view the limits for your
// Amazon Web Services account, see the RAM page in the Service Quotas console (https://console.aws.amazon.com/servicequotas/home/services/ram/quotas)
// .
type PermissionLimitExceededException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *PermissionLimitExceededException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *PermissionLimitExceededException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *PermissionLimitExceededException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "PermissionLimitExceededException"
}
return *e.ErrorCodeOverride
}
func (e *PermissionLimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because it would exceed the limit for the number of
// versions you can have for a permission. To view the limits for your Amazon Web
// Services account, see the RAM page in the Service Quotas console (https://console.aws.amazon.com/servicequotas/home/services/ram/quotas)
// .
type PermissionVersionsLimitExceededException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *PermissionVersionsLimitExceededException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *PermissionVersionsLimitExceededException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *PermissionVersionsLimitExceededException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "PermissionVersionsLimitExceededException"
}
return *e.ErrorCodeOverride
}
func (e *PermissionVersionsLimitExceededException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
// The operation failed because the specified Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// was not found.
type ResourceArnNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ResourceArnNotFoundException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ResourceArnNotFoundException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ResourceArnNotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ResourceArnNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *ResourceArnNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the specified invitation was already accepted.
type ResourceShareInvitationAlreadyAcceptedException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ResourceShareInvitationAlreadyAcceptedException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ResourceShareInvitationAlreadyAcceptedException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ResourceShareInvitationAlreadyAcceptedException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ResourceShareInvitationAlreadyAcceptedException"
}
return *e.ErrorCodeOverride
}
func (e *ResourceShareInvitationAlreadyAcceptedException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
// The operation failed because the specified invitation was already rejected.
type ResourceShareInvitationAlreadyRejectedException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ResourceShareInvitationAlreadyRejectedException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ResourceShareInvitationAlreadyRejectedException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ResourceShareInvitationAlreadyRejectedException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ResourceShareInvitationAlreadyRejectedException"
}
return *e.ErrorCodeOverride
}
func (e *ResourceShareInvitationAlreadyRejectedException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
// The operation failed because the specified Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// for an invitation was not found.
type ResourceShareInvitationArnNotFoundException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ResourceShareInvitationArnNotFoundException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ResourceShareInvitationArnNotFoundException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ResourceShareInvitationArnNotFoundException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ResourceShareInvitationArnNotFoundException"
}
return *e.ErrorCodeOverride
}
func (e *ResourceShareInvitationArnNotFoundException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
// The operation failed because the specified invitation is past its expiration
// date and time.
type ResourceShareInvitationExpiredException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ResourceShareInvitationExpiredException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ResourceShareInvitationExpiredException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ResourceShareInvitationExpiredException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ResourceShareInvitationExpiredException"
}
return *e.ErrorCodeOverride
}
func (e *ResourceShareInvitationExpiredException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
// The operation failed because it would exceed the limit for resource shares for
// your account. To view the limits for your Amazon Web Services account, see the
// RAM page in the Service Quotas console (https://console.aws.amazon.com/servicequotas/home/services/ram/quotas)
// .
type ResourceShareLimitExceededException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ResourceShareLimitExceededException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ResourceShareLimitExceededException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ResourceShareLimitExceededException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ResourceShareLimitExceededException"
}
return *e.ErrorCodeOverride
}
func (e *ResourceShareLimitExceededException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
// The operation failed because the service could not respond to the request due
// to an internal problem. Try again later.
type ServerInternalException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *ServerInternalException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *ServerInternalException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *ServerInternalException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "ServerInternalException"
}
return *e.ErrorCodeOverride
}
func (e *ServerInternalException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
// The operation failed because the service isn't available. Try again later.
type ServiceUnavailableException struct {
Message *string
ErrorCodeOverride *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 }
// The operation failed because it would exceed the limit for tags for your Amazon
// Web Services account.
type TagLimitExceededException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *TagLimitExceededException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *TagLimitExceededException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *TagLimitExceededException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "TagLimitExceededException"
}
return *e.ErrorCodeOverride
}
func (e *TagLimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because the specified tag key is a reserved word and can't
// be used.
type TagPolicyViolationException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *TagPolicyViolationException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *TagPolicyViolationException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *TagPolicyViolationException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "TagPolicyViolationException"
}
return *e.ErrorCodeOverride
}
func (e *TagPolicyViolationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// The operation failed because it exceeded the rate at which you are allowed to
// perform this operation. Please try again later.
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 }
// The operation failed because a specified resource couldn't be found.
type UnknownResourceException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *UnknownResourceException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *UnknownResourceException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *UnknownResourceException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "UnknownResourceException"
}
return *e.ErrorCodeOverride
}
func (e *UnknownResourceException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
// There isn't an existing managed permission defined in RAM that has the same IAM
// permissions as the resource-based policy attached to the resource. You should
// first run PromotePermissionCreatedFromPolicy to create that managed permission.
type UnmatchedPolicyPermissionException struct {
Message *string
ErrorCodeOverride *string
noSmithyDocumentSerde
}
func (e *UnmatchedPolicyPermissionException) Error() string {
return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
}
func (e *UnmatchedPolicyPermissionException) ErrorMessage() string {
if e.Message == nil {
return ""
}
return *e.Message
}
func (e *UnmatchedPolicyPermissionException) ErrorCode() string {
if e == nil || e.ErrorCodeOverride == nil {
return "UnmatchedPolicyPermissionException"
}
return *e.ErrorCodeOverride
}
func (e *UnmatchedPolicyPermissionException) ErrorFault() smithy.ErrorFault {
return smithy.FaultClient
}
| 778 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package types
import (
smithydocument "github.com/aws/smithy-go/document"
"time"
)
// An object that describes a managed permission associated with a resource share.
type AssociatedPermission struct {
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the associated managed permission.
Arn *string
// Indicates whether the associated resource share is using the default version of
// the permission.
DefaultVersion *bool
// Indicates what features are available for this resource share. This parameter
// can have one of the following values:
// - STANDARD – A resource share that supports all functionality. These resource
// shares are visible to all principals you share the resource share with. You can
// modify these resource shares in RAM using the console or APIs. This resource
// share might have been created by RAM, or it might have been CREATED_FROM_POLICY
// and then promoted.
// - CREATED_FROM_POLICY – The customer manually shared a resource by attaching
// a resource-based policy. That policy did not match any existing managed
// permissions, so RAM created this customer managed permission automatically on
// the customer's behalf based on the attached policy document. This type of
// resource share is visible only to the Amazon Web Services account that created
// it. You can't modify it in RAM unless you promote it. For more information, see
// PromoteResourceShareCreatedFromPolicy .
// - PROMOTING_TO_STANDARD – This resource share was originally
// CREATED_FROM_POLICY , but the customer ran the
// PromoteResourceShareCreatedFromPolicy and that operation is still in progress.
// This value changes to STANDARD when complete.
FeatureSet PermissionFeatureSet
// The date and time when the association between the permission and the resource
// share was last updated.
LastUpdatedTime *time.Time
// The version of the permission currently associated with the resource share.
PermissionVersion *string
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of a resource share associated with this permission.
ResourceShareArn *string
// The resource type to which this permission applies.
ResourceType *string
// The current status of the association between the permission and the resource
// share. The following are the possible values:
// - ATTACHABLE – This permission or version can be associated with resource
// shares.
// - UNATTACHABLE – This permission or version can't currently be associated with
// resource shares.
// - DELETING – This permission or version is in the process of being deleted.
// - DELETED – This permission or version is deleted.
Status *string
noSmithyDocumentSerde
}
// Describes a principal for use with Resource Access Manager.
type Principal struct {
// The date and time when the principal was associated with the resource share.
CreationTime *time.Time
// Indicates the relationship between the Amazon Web Services account the
// principal belongs to and the account that owns the resource share:
// - True – The two accounts belong to same organization.
// - False – The two accounts do not belong to the same organization.
External *bool
// The ID of the principal that can be associated with a resource share.
Id *string
// The date and time when the association between the resource share and the
// principal was last updated.
LastUpdatedTime *time.Time
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of a resource share the principal is associated with.
ResourceShareArn *string
noSmithyDocumentSerde
}
// A structure that represents the background work that RAM performs when you
// invoke the ReplacePermissionAssociations operation.
type ReplacePermissionAssociationsWork struct {
// The date and time when this asynchronous background task was created.
CreationTime *time.Time
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the managed permission that this background task is replacing.
FromPermissionArn *string
// The version of the managed permission that this background task is replacing.
FromPermissionVersion *string
// The unique identifier for the background task associated with one
// ReplacePermissionAssociations request.
Id *string
// The date and time when the status of this background task was last updated.
LastUpdatedTime *time.Time
// Specifies the current status of the background tasks for the specified ID. The
// output is one of the following strings:
// - IN_PROGRESS
// - COMPLETED
// - FAILED
Status ReplacePermissionAssociationsWorkStatus
// Specifies the reason for a FAILED status. This field is present only when there
// status is FAILED .
StatusMessage *string
// The ARN of the managed permission that this background task is associating with
// the resource shares in place of the managed permission and version specified in
// fromPermissionArn and fromPermissionVersion .
ToPermissionArn *string
// The version of the managed permission that this background task is associating
// with the resource shares. This is always the version that is currently the
// default for this managed permission.
ToPermissionVersion *string
noSmithyDocumentSerde
}
// Describes a resource associated with a resource share in RAM.
type Resource struct {
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource.
Arn *string
// The date and time when the resource was associated with the resource share.
CreationTime *time.Time
// The date an time when the association between the resource and the resource
// share was last updated.
LastUpdatedTime *time.Time
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource group. This value is available only if the resource is part of a
// resource group.
ResourceGroupArn *string
// Specifies the scope of visibility of this resource:
// - REGIONAL – The resource can be accessed only by using requests that target
// the Amazon Web Services Region in which the resource exists.
// - GLOBAL – The resource can be accessed from any Amazon Web Services Region.
ResourceRegionScope ResourceRegionScope
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource share this resource is associated with.
ResourceShareArn *string
// The current status of the resource.
Status ResourceStatus
// A message about the status of the resource.
StatusMessage *string
// The resource type. This takes the form of: service-code : resource-code , and is
// case-insensitive. For example, an Amazon EC2 Subnet would be represented by the
// string ec2:subnet .
Type *string
noSmithyDocumentSerde
}
// Describes a resource share in RAM.
type ResourceShare struct {
// Indicates whether principals outside your organization in Organizations can be
// associated with a resource share.
// - True – the resource share can be shared with any Amazon Web Services
// account.
// - False – the resource share can be shared with only accounts in the same
// organization as the account that owns the resource share.
AllowExternalPrincipals *bool
// The date and time when the resource share was created.
CreationTime *time.Time
// Indicates what features are available for this resource share. This parameter
// can have one of the following values:
// - STANDARD – A resource share that supports all functionality. These resource
// shares are visible to all principals you share the resource share with. You can
// modify these resource shares in RAM using the console or APIs. This resource
// share might have been created by RAM, or it might have been CREATED_FROM_POLICY
// and then promoted.
// - CREATED_FROM_POLICY – The customer manually shared a resource by attaching
// a resource-based policy. That policy did not match any existing managed
// permissions, so RAM created this customer managed permission automatically on
// the customer's behalf based on the attached policy document. This type of
// resource share is visible only to the Amazon Web Services account that created
// it. You can't modify it in RAM unless you promote it. For more information, see
// PromoteResourceShareCreatedFromPolicy .
// - PROMOTING_TO_STANDARD – This resource share was originally
// CREATED_FROM_POLICY , but the customer ran the
// PromoteResourceShareCreatedFromPolicy and that operation is still in progress.
// This value changes to STANDARD when complete.
FeatureSet ResourceShareFeatureSet
// The date and time when the resource share was last updated.
LastUpdatedTime *time.Time
// The name of the resource share.
Name *string
// The ID of the Amazon Web Services account that owns the resource share.
OwningAccountId *string
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource share
ResourceShareArn *string
// The current status of the resource share.
Status ResourceShareStatus
// A message about the status of the resource share.
StatusMessage *string
// The tag key and value pairs attached to the resource share.
Tags []Tag
noSmithyDocumentSerde
}
// Describes an association between a resource share and either a principal or a
// resource.
type ResourceShareAssociation struct {
// The associated entity. This can be either of the following:
// - For a resource association, this is the Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource.
// - For principal associations, this is one of the following:
// - The ID of an Amazon Web Services account
// - The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of an organization in Organizations
// - The ARN of an organizational unit (OU) in Organizations
// - The ARN of an IAM role
// - The ARN of an IAM user
AssociatedEntity *string
// The type of entity included in this association.
AssociationType ResourceShareAssociationType
// The date and time when the association was created.
CreationTime *time.Time
// Indicates whether the principal belongs to the same organization in
// Organizations as the Amazon Web Services account that owns the resource share.
External *bool
// The date and time when the association was last updated.
LastUpdatedTime *time.Time
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource share.
ResourceShareArn *string
// The name of the resource share.
ResourceShareName *string
// The current status of the association.
Status ResourceShareAssociationStatus
// A message about the status of the association.
StatusMessage *string
noSmithyDocumentSerde
}
// Describes an invitation for an Amazon Web Services account to join a resource
// share.
type ResourceShareInvitation struct {
// The date and time when the invitation was sent.
InvitationTimestamp *time.Time
// The ID of the Amazon Web Services account that received the invitation.
ReceiverAccountId *string
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the IAM user or role that received the invitation.
ReceiverArn *string
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the resource share
ResourceShareArn *string
// To view the resources associated with a pending resource share invitation, use
// ListPendingInvitationResources .
//
// Deprecated: This member has been deprecated. Use ListPendingInvitationResources.
ResourceShareAssociations []ResourceShareAssociation
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the invitation.
ResourceShareInvitationArn *string
// The name of the resource share.
ResourceShareName *string
// The ID of the Amazon Web Services account that sent the invitation.
SenderAccountId *string
// The current status of the invitation.
Status ResourceShareInvitationStatus
noSmithyDocumentSerde
}
// Information about a RAM managed permission.
type ResourceSharePermissionDetail struct {
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of this RAM managed permission.
Arn *string
// The date and time when the permission was created.
CreationTime *time.Time
// Specifies whether the version of the permission represented in this response is
// the default version for this permission.
DefaultVersion *bool
// Indicates what features are available for this resource share. This parameter
// can have one of the following values:
// - STANDARD – A resource share that supports all functionality. These resource
// shares are visible to all principals you share the resource share with. You can
// modify these resource shares in RAM using the console or APIs. This resource
// share might have been created by RAM, or it might have been CREATED_FROM_POLICY
// and then promoted.
// - CREATED_FROM_POLICY – The customer manually shared a resource by attaching
// a resource-based policy. That policy did not match any existing managed
// permissions, so RAM created this customer managed permission automatically on
// the customer's behalf based on the attached policy document. This type of
// resource share is visible only to the Amazon Web Services account that created
// it. You can't modify it in RAM unless you promote it. For more information, see
// PromoteResourceShareCreatedFromPolicy .
// - PROMOTING_TO_STANDARD – This resource share was originally
// CREATED_FROM_POLICY , but the customer ran the
// PromoteResourceShareCreatedFromPolicy and that operation is still in progress.
// This value changes to STANDARD when complete.
FeatureSet PermissionFeatureSet
// Specifies whether the version of the permission represented in this response is
// the default version for all resources of this resource type.
IsResourceTypeDefault *bool
// The date and time when the permission was last updated.
LastUpdatedTime *time.Time
// The name of this permission.
Name *string
// The permission's effect and actions in JSON format. The effect indicates
// whether the specified actions are allowed or denied. The actions list the
// operations to which the principal is granted or denied access.
Permission *string
// The type of managed permission. This can be one of the following values:
// - AWS_MANAGED – Amazon Web Services created and manages this managed
// permission. You can associate it with your resource shares, but you can't modify
// it.
// - CUSTOMER_MANAGED – You, or another principal in your account created this
// managed permission. You can associate it with your resource shares and create
// new versions that have different permissions.
PermissionType PermissionType
// The resource type to which this permission applies.
ResourceType *string
// The current status of the association between the permission and the resource
// share. The following are the possible values:
// - ATTACHABLE – This permission or version can be associated with resource
// shares.
// - UNATTACHABLE – This permission or version can't currently be associated with
// resource shares.
// - DELETING – This permission or version is in the process of being deleted.
// - DELETED – This permission or version is deleted.
Status PermissionStatus
// The tag key and value pairs attached to the resource share.
Tags []Tag
// The version of the permission described in this response.
Version *string
noSmithyDocumentSerde
}
// Information about an RAM permission.
type ResourceSharePermissionSummary struct {
// The Amazon Resource Name (ARN) (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
// of the permission you want information about.
Arn *string
// The date and time when the permission was created.
CreationTime *time.Time
// Specifies whether the version of the managed permission used by this resource
// share is the default version for this managed permission.
DefaultVersion *bool
// Indicates what features are available for this resource share. This parameter
// can have one of the following values:
// - STANDARD – A resource share that supports all functionality. These resource
// shares are visible to all principals you share the resource share with. You can
// modify these resource shares in RAM using the console or APIs. This resource
// share might have been created by RAM, or it might have been CREATED_FROM_POLICY
// and then promoted.
// - CREATED_FROM_POLICY – The customer manually shared a resource by attaching
// a resource-based policy. That policy did not match any existing managed
// permissions, so RAM created this customer managed permission automatically on
// the customer's behalf based on the attached policy document. This type of
// resource share is visible only to the Amazon Web Services account that created
// it. You can't modify it in RAM unless you promote it. For more information, see
// PromoteResourceShareCreatedFromPolicy .
// - PROMOTING_TO_STANDARD – This resource share was originally
// CREATED_FROM_POLICY , but the customer ran the
// PromoteResourceShareCreatedFromPolicy and that operation is still in progress.
// This value changes to STANDARD when complete.
FeatureSet PermissionFeatureSet
// Specifies whether the managed permission associated with this resource share is
// the default managed permission for all resources of this resource type.
IsResourceTypeDefault *bool
// The date and time when the permission was last updated.
LastUpdatedTime *time.Time
// The name of this managed permission.
Name *string
// The type of managed permission. This can be one of the following values:
// - AWS_MANAGED – Amazon Web Services created and manages this managed
// permission. You can associate it with your resource shares, but you can't modify
// it.
// - CUSTOMER_MANAGED – You, or another principal in your account created this
// managed permission. You can associate it with your resource shares and create
// new versions that have different permissions.
PermissionType PermissionType
// The type of resource to which this permission applies. This takes the form of:
// service-code : resource-code , and is case-insensitive. For example, an Amazon
// EC2 Subnet would be represented by the string ec2:subnet .
ResourceType *string
// The current status of the permission.
Status *string
// A list of the tag key value pairs currently attached to the permission.
Tags []Tag
// The version of the permission associated with this resource share.
Version *string
noSmithyDocumentSerde
}
// Information about a shareable resource type and the Amazon Web Services service
// to which resources of that type belong.
type ServiceNameAndResourceType struct {
// Specifies the scope of visibility of resources of this type:
// - REGIONAL – The resource can be accessed only by using requests that target
// the Amazon Web Services Region in which the resource exists.
// - GLOBAL – The resource can be accessed from any Amazon Web Services Region.
ResourceRegionScope ResourceRegionScope
// The type of the resource. This takes the form of: service-code : resource-code ,
// and is case-insensitive. For example, an Amazon EC2 Subnet would be represented
// by the string ec2:subnet .
ResourceType *string
// The name of the Amazon Web Services service to which resources of this type
// belong.
ServiceName *string
noSmithyDocumentSerde
}
// A structure containing a tag. A tag is metadata that you can attach to your
// resources to help organize and categorize them. You can also use them to help
// you secure your resources. For more information, see Controlling access to
// Amazon Web Services resources using tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_tags.html)
// . For more information about tags, see Tagging Amazon Web Services resources (https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)
// in the Amazon Web Services General Reference Guide.
type Tag struct {
// The key, or name, attached to the tag. Every tag must have a key. Key names are
// case sensitive.
Key *string
// The string value attached to the tag. The value can be an empty string. Key
// values are case sensitive.
Value *string
noSmithyDocumentSerde
}
// A tag key and optional list of possible values that you can use to filter
// results for tagged resources.
type TagFilter struct {
// The tag key. This must have a valid string value and can't be empty.
TagKey *string
// A list of zero or more tag values. If no values are provided, then the filter
// matches any tag with the specified key, regardless of its value.
TagValues []string
noSmithyDocumentSerde
}
type noSmithyDocumentSerde = smithydocument.NoSerde
| 532 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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 = "rbin"
const ServiceAPIVersion = "2021-06-15"
// Client provides the API client to make operations call for Amazon Recycle Bin.
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, "rbin", 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)
}
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)
}
| 434 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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 rbin
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/rbin/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a Recycle Bin retention rule. For more information, see Create Recycle
// Bin retention rules (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-create-rule)
// in the Amazon Elastic Compute Cloud User Guide.
func (c *Client) CreateRule(ctx context.Context, params *CreateRuleInput, optFns ...func(*Options)) (*CreateRuleOutput, error) {
if params == nil {
params = &CreateRuleInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateRule", params, optFns, c.addOperationCreateRuleMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateRuleOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateRuleInput struct {
// The resource type to be retained by the retention rule. Currently, only Amazon
// EBS snapshots and EBS-backed AMIs are supported. To retain snapshots, specify
// EBS_SNAPSHOT . To retain EBS-backed AMIs, specify EC2_IMAGE .
//
// This member is required.
ResourceType types.ResourceType
// Information about the retention period for which the retention rule is to
// retain resources.
//
// This member is required.
RetentionPeriod *types.RetentionPeriod
// The retention rule description.
Description *string
// Information about the retention rule lock configuration.
LockConfiguration *types.LockConfiguration
// Specifies the resource tags to use to identify resources that are to be
// retained by a tag-level retention rule. For tag-level retention rules, only
// deleted resources, of the specified resource type, that have one or more of the
// specified tag key and value pairs are retained. If a resource is deleted, but it
// does not have any of the specified tag key and value pairs, it is immediately
// deleted without being retained by the retention rule. You can add the same tag
// key and value pair to a maximum or five retention rules. To create a
// Region-level retention rule, omit this parameter. A Region-level retention rule
// does not have any resource tags specified. It retains all deleted resources of
// the specified resource type in the Region in which the rule is created, even if
// the resources are not tagged.
ResourceTags []types.ResourceTag
// Information about the tags to assign to the retention rule.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateRuleOutput struct {
// The retention rule description.
Description *string
// The unique ID of the retention rule.
Identifier *string
// Information about the retention rule lock configuration.
LockConfiguration *types.LockConfiguration
// The lock state for the retention rule.
// - locked - The retention rule is locked and can't be modified or deleted.
// - pending_unlock - The retention rule has been unlocked but it is still within
// the unlock delay period. The retention rule can be modified or deleted only
// after the unlock delay period has expired.
// - unlocked - The retention rule is unlocked and it can be modified or deleted
// by any user with the required permissions.
// - null - The retention rule has never been locked. Once a retention rule has
// been locked, it can transition between the locked and unlocked states only; it
// can never transition back to null .
LockState types.LockState
// Information about the resource tags used to identify resources that are
// retained by the retention rule.
ResourceTags []types.ResourceTag
// The resource type retained by the retention rule.
ResourceType types.ResourceType
// Information about the retention period for which the retention rule is to
// retain resources.
RetentionPeriod *types.RetentionPeriod
// The state of the retention rule. Only retention rules that are in the available
// state retain resources.
Status types.RuleStatus
// Information about the tags assigned to the retention rule.
Tags []types.Tag
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateRuleMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateRule{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateRule{}, 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 = addOpCreateRuleValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateRule(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_opCreateRule(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rbin",
OperationName: "CreateRule",
}
}
| 193 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a Recycle Bin retention rule. For more information, see Delete Recycle
// Bin retention rules (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-delete-rule)
// in the Amazon Elastic Compute Cloud User Guide.
func (c *Client) DeleteRule(ctx context.Context, params *DeleteRuleInput, optFns ...func(*Options)) (*DeleteRuleOutput, error) {
if params == nil {
params = &DeleteRuleInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteRule", params, optFns, c.addOperationDeleteRuleMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteRuleOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteRuleInput struct {
// The unique ID of the retention rule.
//
// This member is required.
Identifier *string
noSmithyDocumentSerde
}
type DeleteRuleOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteRuleMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteRule{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteRule{}, 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 = addOpDeleteRuleValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteRule(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_opDeleteRule(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rbin",
OperationName: "DeleteRule",
}
}
| 122 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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/rbin/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Gets information about a Recycle Bin retention rule.
func (c *Client) GetRule(ctx context.Context, params *GetRuleInput, optFns ...func(*Options)) (*GetRuleOutput, error) {
if params == nil {
params = &GetRuleInput{}
}
result, metadata, err := c.invokeOperation(ctx, "GetRule", params, optFns, c.addOperationGetRuleMiddlewares)
if err != nil {
return nil, err
}
out := result.(*GetRuleOutput)
out.ResultMetadata = metadata
return out, nil
}
type GetRuleInput struct {
// The unique ID of the retention rule.
//
// This member is required.
Identifier *string
noSmithyDocumentSerde
}
type GetRuleOutput struct {
// The retention rule description.
Description *string
// The unique ID of the retention rule.
Identifier *string
// Information about the retention rule lock configuration.
LockConfiguration *types.LockConfiguration
// The date and time at which the unlock delay is set to expire. Only returned for
// retention rules that have been unlocked and that are still within the unlock
// delay period.
LockEndTime *time.Time
// The lock state for the retention rule.
// - locked - The retention rule is locked and can't be modified or deleted.
// - pending_unlock - The retention rule has been unlocked but it is still within
// the unlock delay period. The retention rule can be modified or deleted only
// after the unlock delay period has expired.
// - unlocked - The retention rule is unlocked and it can be modified or deleted
// by any user with the required permissions.
// - null - The retention rule has never been locked. Once a retention rule has
// been locked, it can transition between the locked and unlocked states only; it
// can never transition back to null .
LockState types.LockState
// Information about the resource tags used to identify resources that are
// retained by the retention rule.
ResourceTags []types.ResourceTag
// The resource type retained by the retention rule.
ResourceType types.ResourceType
// Information about the retention period for which the retention rule is to
// retain resources.
RetentionPeriod *types.RetentionPeriod
// The state of the retention rule. Only retention rules that are in the available
// state retain resources.
Status types.RuleStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationGetRuleMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRule{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRule{}, 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 = addOpGetRuleValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRule(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_opGetRule(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rbin",
OperationName: "GetRule",
}
}
| 164 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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/rbin/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the Recycle Bin retention rules in the Region.
func (c *Client) ListRules(ctx context.Context, params *ListRulesInput, optFns ...func(*Options)) (*ListRulesOutput, error) {
if params == nil {
params = &ListRulesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ListRules", params, optFns, c.addOperationListRulesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ListRulesOutput)
out.ResultMetadata = metadata
return out, nil
}
type ListRulesInput struct {
// The resource type retained by the retention rule. Only retention rules that
// retain the specified resource type are listed. Currently, only Amazon EBS
// snapshots and EBS-backed AMIs are supported. To list retention rules that retain
// snapshots, specify EBS_SNAPSHOT . To list retention rules that retain EBS-backed
// AMIs, specify EC2_IMAGE .
//
// This member is required.
ResourceType types.ResourceType
// The lock state of the retention rules to list. Only retention rules with the
// specified lock state are returned.
LockState types.LockState
// The maximum number of results to return with a single call. To retrieve the
// remaining results, make another call with the returned NextToken value.
MaxResults *int32
// The token for the next page of results.
NextToken *string
// Information about the resource tags used to identify resources that are
// retained by the retention rule.
ResourceTags []types.ResourceTag
noSmithyDocumentSerde
}
type ListRulesOutput struct {
// The token to use to retrieve the next page of results. This value is null when
// there are no more results to return.
NextToken *string
// Information about the retention rules.
Rules []types.RuleSummary
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListRulesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpListRules{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListRules{}, 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 = addOpListRulesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRules(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
}
// ListRulesAPIClient is a client that implements the ListRules operation.
type ListRulesAPIClient interface {
ListRules(context.Context, *ListRulesInput, ...func(*Options)) (*ListRulesOutput, error)
}
var _ ListRulesAPIClient = (*Client)(nil)
// ListRulesPaginatorOptions is the paginator options for ListRules
type ListRulesPaginatorOptions struct {
// The maximum number of results to return with a single call. To retrieve the
// remaining results, make another call with the returned NextToken value.
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
}
// ListRulesPaginator is a paginator for ListRules
type ListRulesPaginator struct {
options ListRulesPaginatorOptions
client ListRulesAPIClient
params *ListRulesInput
nextToken *string
firstPage bool
}
// NewListRulesPaginator returns a new ListRulesPaginator
func NewListRulesPaginator(client ListRulesAPIClient, params *ListRulesInput, optFns ...func(*ListRulesPaginatorOptions)) *ListRulesPaginator {
if params == nil {
params = &ListRulesInput{}
}
options := ListRulesPaginatorOptions{}
if params.MaxResults != nil {
options.Limit = *params.MaxResults
}
for _, fn := range optFns {
fn(&options)
}
return &ListRulesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.NextToken,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListRulesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next ListRules page.
func (p *ListRulesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRulesOutput, 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.ListRules(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_opListRules(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rbin",
OperationName: "ListRules",
}
}
| 239 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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/rbin/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the tags assigned to a retention rule.
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 retention rule.
//
// This member is required.
ResourceArn *string
noSmithyDocumentSerde
}
type ListTagsForResourceOutput struct {
// Information about the tags assigned to the retention rule.
Tags []types.Tag
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&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: "rbin",
OperationName: "ListTagsForResource",
}
}
| 125 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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/rbin/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Locks a retention rule. A locked retention rule can't be modified or deleted.
func (c *Client) LockRule(ctx context.Context, params *LockRuleInput, optFns ...func(*Options)) (*LockRuleOutput, error) {
if params == nil {
params = &LockRuleInput{}
}
result, metadata, err := c.invokeOperation(ctx, "LockRule", params, optFns, c.addOperationLockRuleMiddlewares)
if err != nil {
return nil, err
}
out := result.(*LockRuleOutput)
out.ResultMetadata = metadata
return out, nil
}
type LockRuleInput struct {
// The unique ID of the retention rule.
//
// This member is required.
Identifier *string
// Information about the retention rule lock configuration.
//
// This member is required.
LockConfiguration *types.LockConfiguration
noSmithyDocumentSerde
}
type LockRuleOutput struct {
// The retention rule description.
Description *string
// The unique ID of the retention rule.
Identifier *string
// Information about the retention rule lock configuration.
LockConfiguration *types.LockConfiguration
// The lock state for the retention rule.
// - locked - The retention rule is locked and can't be modified or deleted.
// - pending_unlock - The retention rule has been unlocked but it is still within
// the unlock delay period. The retention rule can be modified or deleted only
// after the unlock delay period has expired.
// - unlocked - The retention rule is unlocked and it can be modified or deleted
// by any user with the required permissions.
// - null - The retention rule has never been locked. Once a retention rule has
// been locked, it can transition between the locked and unlocked states only; it
// can never transition back to null .
LockState types.LockState
// Information about the resource tags used to identify resources that are
// retained by the retention rule.
ResourceTags []types.ResourceTag
// The resource type retained by the retention rule.
ResourceType types.ResourceType
// Information about the retention period for which the retention rule is to
// retain resources.
RetentionPeriod *types.RetentionPeriod
// The state of the retention rule. Only retention rules that are in the available
// state retain resources.
Status types.RuleStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationLockRuleMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpLockRule{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpLockRule{}, 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 = addOpLockRuleValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opLockRule(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_opLockRule(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rbin",
OperationName: "LockRule",
}
}
| 163 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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/rbin/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Assigns tags to the specified retention rule.
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 retention rule.
//
// This member is required.
ResourceArn *string
// Information about the tags to assign to the retention rule.
//
// This member is required.
Tags []types.Tag
noSmithyDocumentSerde
}
type TagResourceOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&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: "rbin",
OperationName: "TagResource",
}
}
| 126 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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/rbin/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Unlocks a retention rule. After a retention rule is unlocked, it can be
// modified or deleted only after the unlock delay period expires.
func (c *Client) UnlockRule(ctx context.Context, params *UnlockRuleInput, optFns ...func(*Options)) (*UnlockRuleOutput, error) {
if params == nil {
params = &UnlockRuleInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UnlockRule", params, optFns, c.addOperationUnlockRuleMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UnlockRuleOutput)
out.ResultMetadata = metadata
return out, nil
}
type UnlockRuleInput struct {
// The unique ID of the retention rule.
//
// This member is required.
Identifier *string
noSmithyDocumentSerde
}
type UnlockRuleOutput struct {
// The retention rule description.
Description *string
// The unique ID of the retention rule.
Identifier *string
// Information about the retention rule lock configuration.
LockConfiguration *types.LockConfiguration
// The date and time at which the unlock delay is set to expire. Only returned for
// retention rules that have been unlocked and that are still within the unlock
// delay period.
LockEndTime *time.Time
// The lock state for the retention rule.
// - locked - The retention rule is locked and can't be modified or deleted.
// - pending_unlock - The retention rule has been unlocked but it is still within
// the unlock delay period. The retention rule can be modified or deleted only
// after the unlock delay period has expired.
// - unlocked - The retention rule is unlocked and it can be modified or deleted
// by any user with the required permissions.
// - null - The retention rule has never been locked. Once a retention rule has
// been locked, it can transition between the locked and unlocked states only; it
// can never transition back to null .
LockState types.LockState
// Information about the resource tags used to identify resources that are
// retained by the retention rule.
ResourceTags []types.ResourceTag
// The resource type retained by the retention rule.
ResourceType types.ResourceType
// Information about the retention period for which the retention rule is to
// retain resources.
RetentionPeriod *types.RetentionPeriod
// The state of the retention rule. Only retention rules that are in the available
// state retain resources.
Status types.RuleStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUnlockRuleMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpUnlockRule{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUnlockRule{}, 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 = addOpUnlockRuleValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUnlockRule(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_opUnlockRule(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rbin",
OperationName: "UnlockRule",
}
}
| 165 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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"
)
// Unassigns a tag from a retention rule.
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 retention rule.
//
// This member is required.
ResourceArn *string
// The tag keys of the tags to unassign. All tags that have the specified tag key
// are unassigned.
//
// 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: "rbin",
OperationName: "UntagResource",
}
}
| 126 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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/rbin/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Updates an existing Recycle Bin retention rule. You can update a retention
// rule's description, resource tags, and retention period at any time after
// creation. You can't update a retention rule's resource type after creation. For
// more information, see Update Recycle Bin retention rules (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recycle-bin-working-with-rules.html#recycle-bin-update-rule)
// in the Amazon Elastic Compute Cloud User Guide.
func (c *Client) UpdateRule(ctx context.Context, params *UpdateRuleInput, optFns ...func(*Options)) (*UpdateRuleOutput, error) {
if params == nil {
params = &UpdateRuleInput{}
}
result, metadata, err := c.invokeOperation(ctx, "UpdateRule", params, optFns, c.addOperationUpdateRuleMiddlewares)
if err != nil {
return nil, err
}
out := result.(*UpdateRuleOutput)
out.ResultMetadata = metadata
return out, nil
}
type UpdateRuleInput struct {
// The unique ID of the retention rule.
//
// This member is required.
Identifier *string
// The retention rule description.
Description *string
// Specifies the resource tags to use to identify resources that are to be
// retained by a tag-level retention rule. For tag-level retention rules, only
// deleted resources, of the specified resource type, that have one or more of the
// specified tag key and value pairs are retained. If a resource is deleted, but it
// does not have any of the specified tag key and value pairs, it is immediately
// deleted without being retained by the retention rule. You can add the same tag
// key and value pair to a maximum or five retention rules. To create a
// Region-level retention rule, omit this parameter. A Region-level retention rule
// does not have any resource tags specified. It retains all deleted resources of
// the specified resource type in the Region in which the rule is created, even if
// the resources are not tagged.
ResourceTags []types.ResourceTag
// This parameter is currently not supported. You can't update a retention rule's
// resource type after creation.
ResourceType types.ResourceType
// Information about the retention period for which the retention rule is to
// retain resources.
RetentionPeriod *types.RetentionPeriod
noSmithyDocumentSerde
}
type UpdateRuleOutput struct {
// The retention rule description.
Description *string
// The unique ID of the retention rule.
Identifier *string
// The date and time at which the unlock delay is set to expire. Only returned for
// retention rules that have been unlocked and that are still within the unlock
// delay period.
LockEndTime *time.Time
// The lock state for the retention rule.
// - locked - The retention rule is locked and can't be modified or deleted.
// - pending_unlock - The retention rule has been unlocked but it is still within
// the unlock delay period. The retention rule can be modified or deleted only
// after the unlock delay period has expired.
// - unlocked - The retention rule is unlocked and it can be modified or deleted
// by any user with the required permissions.
// - null - The retention rule has never been locked. Once a retention rule has
// been locked, it can transition between the locked and unlocked states only; it
// can never transition back to null .
LockState types.LockState
// Information about the resource tags used to identify resources that are
// retained by the retention rule.
ResourceTags []types.ResourceTag
// The resource type retained by the retention rule.
ResourceType types.ResourceType
// Information about the retention period for which the retention rule is to
// retain resources.
RetentionPeriod *types.RetentionPeriod
// The state of the retention rule. Only retention rules that are in the available
// state retain resources.
Status types.RuleStatus
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationUpdateRuleMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateRule{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateRule{}, 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 = addOpUpdateRuleValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateRule(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_opUpdateRule(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rbin",
OperationName: "UpdateRule",
}
}
| 189 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
import (
"bytes"
"context"
"encoding/json"
"fmt"
"github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
"github.com/aws/aws-sdk-go-v2/service/rbin/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_deserializeOpCreateRule struct {
}
func (*awsRestjson1_deserializeOpCreateRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpCreateRule) 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_deserializeOpErrorCreateRule(response, &metadata)
}
output := &CreateRuleOutput{}
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_deserializeOpDocumentCreateRuleOutput(&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_deserializeOpErrorCreateRule(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("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentCreateRuleOutput(v **CreateRuleOutput, 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 *CreateRuleOutput
if *v == nil {
sv = &CreateRuleOutput{}
} 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 Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Identifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleIdentifier to be of type string, got %T instead", value)
}
sv.Identifier = ptr.String(jtv)
}
case "LockConfiguration":
if err := awsRestjson1_deserializeDocumentLockConfiguration(&sv.LockConfiguration, value); err != nil {
return err
}
case "LockState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LockState to be of type string, got %T instead", value)
}
sv.LockState = types.LockState(jtv)
}
case "ResourceTags":
if err := awsRestjson1_deserializeDocumentResourceTags(&sv.ResourceTags, value); err != nil {
return err
}
case "ResourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value)
}
sv.ResourceType = types.ResourceType(jtv)
}
case "RetentionPeriod":
if err := awsRestjson1_deserializeDocumentRetentionPeriod(&sv.RetentionPeriod, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleStatus to be of type string, got %T instead", value)
}
sv.Status = types.RuleStatus(jtv)
}
case "Tags":
if err := awsRestjson1_deserializeDocumentTagList(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpDeleteRule struct {
}
func (*awsRestjson1_deserializeOpDeleteRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpDeleteRule) 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_deserializeOpErrorDeleteRule(response, &metadata)
}
output := &DeleteRuleOutput{}
out.Result = output
return out, metadata, err
}
func awsRestjson1_deserializeOpErrorDeleteRule(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("ConflictException", errorCode):
return 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("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpGetRule struct {
}
func (*awsRestjson1_deserializeOpGetRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpGetRule) 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_deserializeOpErrorGetRule(response, &metadata)
}
output := &GetRuleOutput{}
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_deserializeOpDocumentGetRuleOutput(&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_deserializeOpErrorGetRule(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_deserializeOpDocumentGetRuleOutput(v **GetRuleOutput, 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 *GetRuleOutput
if *v == nil {
sv = &GetRuleOutput{}
} 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 Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Identifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleIdentifier to be of type string, got %T instead", value)
}
sv.Identifier = ptr.String(jtv)
}
case "LockConfiguration":
if err := awsRestjson1_deserializeDocumentLockConfiguration(&sv.LockConfiguration, value); err != nil {
return err
}
case "LockEndTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LockEndTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected TimeStamp to be a JSON Number, got %T instead", value)
}
}
case "LockState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LockState to be of type string, got %T instead", value)
}
sv.LockState = types.LockState(jtv)
}
case "ResourceTags":
if err := awsRestjson1_deserializeDocumentResourceTags(&sv.ResourceTags, value); err != nil {
return err
}
case "ResourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value)
}
sv.ResourceType = types.ResourceType(jtv)
}
case "RetentionPeriod":
if err := awsRestjson1_deserializeDocumentRetentionPeriod(&sv.RetentionPeriod, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleStatus to be of type string, got %T instead", value)
}
sv.Status = types.RuleStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpListRules struct {
}
func (*awsRestjson1_deserializeOpListRules) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpListRules) 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_deserializeOpErrorListRules(response, &metadata)
}
output := &ListRulesOutput{}
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_deserializeOpDocumentListRulesOutput(&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_deserializeOpErrorListRules(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("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentListRulesOutput(v **ListRulesOutput, 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 *ListRulesOutput
if *v == nil {
sv = &ListRulesOutput{}
} 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 "Rules":
if err := awsRestjson1_deserializeDocumentRuleSummaryList(&sv.Rules, 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_deserializeDocumentTagList(&sv.Tags, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
type awsRestjson1_deserializeOpLockRule struct {
}
func (*awsRestjson1_deserializeOpLockRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpLockRule) 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_deserializeOpErrorLockRule(response, &metadata)
}
output := &LockRuleOutput{}
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_deserializeOpDocumentLockRuleOutput(&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_deserializeOpErrorLockRule(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("ConflictException", errorCode):
return 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("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentLockRuleOutput(v **LockRuleOutput, 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 *LockRuleOutput
if *v == nil {
sv = &LockRuleOutput{}
} 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 Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Identifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleIdentifier to be of type string, got %T instead", value)
}
sv.Identifier = ptr.String(jtv)
}
case "LockConfiguration":
if err := awsRestjson1_deserializeDocumentLockConfiguration(&sv.LockConfiguration, value); err != nil {
return err
}
case "LockState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LockState to be of type string, got %T instead", value)
}
sv.LockState = types.LockState(jtv)
}
case "ResourceTags":
if err := awsRestjson1_deserializeDocumentResourceTags(&sv.ResourceTags, value); err != nil {
return err
}
case "ResourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value)
}
sv.ResourceType = types.ResourceType(jtv)
}
case "RetentionPeriod":
if err := awsRestjson1_deserializeDocumentRetentionPeriod(&sv.RetentionPeriod, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleStatus to be of type string, got %T instead", value)
}
sv.Status = types.RuleStatus(jtv)
}
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("ServiceQuotaExceededException", errorCode):
return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody)
case strings.EqualFold("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
type awsRestjson1_deserializeOpUnlockRule struct {
}
func (*awsRestjson1_deserializeOpUnlockRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUnlockRule) 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_deserializeOpErrorUnlockRule(response, &metadata)
}
output := &UnlockRuleOutput{}
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_deserializeOpDocumentUnlockRuleOutput(&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_deserializeOpErrorUnlockRule(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("ConflictException", errorCode):
return 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("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUnlockRuleOutput(v **UnlockRuleOutput, 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 *UnlockRuleOutput
if *v == nil {
sv = &UnlockRuleOutput{}
} 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 Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Identifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleIdentifier to be of type string, got %T instead", value)
}
sv.Identifier = ptr.String(jtv)
}
case "LockConfiguration":
if err := awsRestjson1_deserializeDocumentLockConfiguration(&sv.LockConfiguration, value); err != nil {
return err
}
case "LockEndTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LockEndTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected TimeStamp to be a JSON Number, got %T instead", value)
}
}
case "LockState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LockState to be of type string, got %T instead", value)
}
sv.LockState = types.LockState(jtv)
}
case "ResourceTags":
if err := awsRestjson1_deserializeDocumentResourceTags(&sv.ResourceTags, value); err != nil {
return err
}
case "ResourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value)
}
sv.ResourceType = types.ResourceType(jtv)
}
case "RetentionPeriod":
if err := awsRestjson1_deserializeDocumentRetentionPeriod(&sv.RetentionPeriod, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleStatus to be of type string, got %T instead", value)
}
sv.Status = types.RuleStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
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_deserializeOpUpdateRule struct {
}
func (*awsRestjson1_deserializeOpUpdateRule) ID() string {
return "OperationDeserializer"
}
func (m *awsRestjson1_deserializeOpUpdateRule) 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_deserializeOpErrorUpdateRule(response, &metadata)
}
output := &UpdateRuleOutput{}
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_deserializeOpDocumentUpdateRuleOutput(&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_deserializeOpErrorUpdateRule(response *smithyhttp.Response, metadata *middleware.Metadata) error {
var errorBuffer bytes.Buffer
if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
}
errorBody := bytes.NewReader(errorBuffer.Bytes())
errorCode := "UnknownError"
errorMessage := errorCode
headerCode := response.Header.Get("X-Amzn-ErrorType")
if len(headerCode) != 0 {
errorCode = restjson.SanitizeErrorCode(headerCode)
}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
decoder := json.NewDecoder(body)
decoder.UseNumber()
jsonCode, message, err := restjson.GetErrorInfo(decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
err = &smithy.DeserializationError{
Err: fmt.Errorf("failed to decode response body, %w", err),
Snapshot: snapshot.Bytes(),
}
return err
}
errorBody.Seek(0, io.SeekStart)
if len(headerCode) == 0 && len(jsonCode) != 0 {
errorCode = restjson.SanitizeErrorCode(jsonCode)
}
if len(message) != 0 {
errorMessage = message
}
switch {
case strings.EqualFold("ConflictException", errorCode):
return 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("ValidationException", errorCode):
return awsRestjson1_deserializeErrorValidationException(response, errorBody)
default:
genericError := &smithy.GenericAPIError{
Code: errorCode,
Message: errorMessage,
}
return genericError
}
}
func awsRestjson1_deserializeOpDocumentUpdateRuleOutput(v **UpdateRuleOutput, 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 *UpdateRuleOutput
if *v == nil {
sv = &UpdateRuleOutput{}
} 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 Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Identifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleIdentifier to be of type string, got %T instead", value)
}
sv.Identifier = ptr.String(jtv)
}
case "LockEndTime":
if value != nil {
switch jtv := value.(type) {
case json.Number:
f64, err := jtv.Float64()
if err != nil {
return err
}
sv.LockEndTime = ptr.Time(smithytime.ParseEpochSeconds(f64))
default:
return fmt.Errorf("expected TimeStamp to be a JSON Number, got %T instead", value)
}
}
case "LockState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LockState to be of type string, got %T instead", value)
}
sv.LockState = types.LockState(jtv)
}
case "ResourceTags":
if err := awsRestjson1_deserializeDocumentResourceTags(&sv.ResourceTags, value); err != nil {
return err
}
case "ResourceType":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceType to be of type string, got %T instead", value)
}
sv.ResourceType = types.ResourceType(jtv)
}
case "RetentionPeriod":
if err := awsRestjson1_deserializeDocumentRetentionPeriod(&sv.RetentionPeriod, value); err != nil {
return err
}
case "Status":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleStatus to be of type string, got %T instead", value)
}
sv.Status = types.RuleStatus(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
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_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_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 ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "Reason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ConflictExceptionReason to be of type string, got %T instead", value)
}
sv.Reason = types.ConflictExceptionReason(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
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 ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentLockConfiguration(v **types.LockConfiguration, 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.LockConfiguration
if *v == nil {
sv = &types.LockConfiguration{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "UnlockDelay":
if err := awsRestjson1_deserializeDocumentUnlockDelay(&sv.UnlockDelay, value); err != nil {
return err
}
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 ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "Reason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceNotFoundExceptionReason to be of type string, got %T instead", value)
}
sv.Reason = types.ResourceNotFoundExceptionReason(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceTag(v **types.ResourceTag, 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.ResourceTag
if *v == nil {
sv = &types.ResourceTag{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "ResourceTagKey":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceTagKey to be of type string, got %T instead", value)
}
sv.ResourceTagKey = ptr.String(jtv)
}
case "ResourceTagValue":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ResourceTagValue to be of type string, got %T instead", value)
}
sv.ResourceTagValue = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentResourceTags(v *[]types.ResourceTag, 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.ResourceTag
if *v == nil {
cv = []types.ResourceTag{}
} else {
cv = *v
}
for _, value := range shape {
var col types.ResourceTag
destAddr := &col
if err := awsRestjson1_deserializeDocumentResourceTag(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentRetentionPeriod(v **types.RetentionPeriod, 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.RetentionPeriod
if *v == nil {
sv = &types.RetentionPeriod{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "RetentionPeriodUnit":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RetentionPeriodUnit to be of type string, got %T instead", value)
}
sv.RetentionPeriodUnit = types.RetentionPeriodUnit(jtv)
}
case "RetentionPeriodValue":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected RetentionPeriodValue to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.RetentionPeriodValue = ptr.Int32(int32(i64))
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentRuleSummary(v **types.RuleSummary, 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.RuleSummary
if *v == nil {
sv = &types.RuleSummary{}
} 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 Description to be of type string, got %T instead", value)
}
sv.Description = ptr.String(jtv)
}
case "Identifier":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected RuleIdentifier to be of type string, got %T instead", value)
}
sv.Identifier = ptr.String(jtv)
}
case "LockState":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected LockState to be of type string, got %T instead", value)
}
sv.LockState = types.LockState(jtv)
}
case "RetentionPeriod":
if err := awsRestjson1_deserializeDocumentRetentionPeriod(&sv.RetentionPeriod, value); err != nil {
return err
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentRuleSummaryList(v *[]types.RuleSummary, 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.RuleSummary
if *v == nil {
cv = []types.RuleSummary{}
} else {
cv = *v
}
for _, value := range shape {
var col types.RuleSummary
destAddr := &col
if err := awsRestjson1_deserializeDocumentRuleSummary(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
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 ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "Reason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ServiceQuotaExceededExceptionReason to be of type string, got %T instead", value)
}
sv.Reason = types.ServiceQuotaExceededExceptionReason(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentTag(v **types.Tag, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.(map[string]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var sv *types.Tag
if *v == nil {
sv = &types.Tag{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "Key":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagKey to be of type string, got %T instead", value)
}
sv.Key = ptr.String(jtv)
}
case "Value":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected TagValue to be of type string, got %T instead", value)
}
sv.Value = ptr.String(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
func awsRestjson1_deserializeDocumentTagList(v *[]types.Tag, value interface{}) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
if value == nil {
return nil
}
shape, ok := value.([]interface{})
if !ok {
return fmt.Errorf("unexpected JSON type %v", value)
}
var cv []types.Tag
if *v == nil {
cv = []types.Tag{}
} else {
cv = *v
}
for _, value := range shape {
var col types.Tag
destAddr := &col
if err := awsRestjson1_deserializeDocumentTag(&destAddr, value); err != nil {
return err
}
col = *destAddr
cv = append(cv, col)
}
*v = cv
return nil
}
func awsRestjson1_deserializeDocumentUnlockDelay(v **types.UnlockDelay, 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.UnlockDelay
if *v == nil {
sv = &types.UnlockDelay{}
} else {
sv = *v
}
for key, value := range shape {
switch key {
case "UnlockDelayUnit":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected UnlockDelayUnit to be of type string, got %T instead", value)
}
sv.UnlockDelayUnit = types.UnlockDelayUnit(jtv)
}
case "UnlockDelayValue":
if value != nil {
jtv, ok := value.(json.Number)
if !ok {
return fmt.Errorf("expected UnlockDelayValue to be json.Number, got %T instead", value)
}
i64, err := jtv.Int64()
if err != nil {
return err
}
sv.UnlockDelayValue = ptr.Int32(int32(i64))
}
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 ErrorMessage to be of type string, got %T instead", value)
}
sv.Message = ptr.String(jtv)
}
case "Reason":
if value != nil {
jtv, ok := value.(string)
if !ok {
return fmt.Errorf("expected ValidationExceptionReason to be of type string, got %T instead", value)
}
sv.Reason = types.ValidationExceptionReason(jtv)
}
default:
_, _ = key, value
}
}
*v = sv
return nil
}
| 2,524 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
// Package rbin provides the API client, operations, and parameter types for
// Amazon Recycle Bin.
//
// This is the Recycle Bin API Reference. This documentation provides descriptions
// and syntax for each of the actions and data types in Recycle Bin. Recycle Bin is
// a resource recovery feature that enables you to restore accidentally deleted
// snapshots and EBS-backed AMIs. When using Recycle Bin, if your resources are
// deleted, they are retained in the Recycle Bin for a time period that you
// specify. You can restore a resource from the Recycle Bin at any time before its
// retention period expires. After you restore a resource from the Recycle Bin, the
// resource is removed from the Recycle Bin, and you can then use it in the same
// way you use any other resource of that type in your account. If the retention
// period expires and the resource is not restored, the resource is permanently
// deleted from the Recycle Bin and is no longer available for recovery. For more
// information about Recycle Bin, see Recycle Bin (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-recycle-bin.html)
// in the Amazon Elastic Compute Cloud User Guide.
package rbin
| 20 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
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/rbin/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 = "rbin"
}
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 rbin
// goModuleVersion is the tagged release for this module
const goModuleVersion = "1.8.14"
| 7 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
| 4 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
import (
"bytes"
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/rbin/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_serializeOpCreateRule struct {
}
func (*awsRestjson1_serializeOpCreateRule) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpCreateRule) 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.(*CreateRuleInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/rules")
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_serializeOpDocumentCreateRuleInput(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_serializeOpHttpBindingsCreateRuleInput(v *CreateRuleInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentCreateRuleInput(v *CreateRuleInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
if v.LockConfiguration != nil {
ok := object.Key("LockConfiguration")
if err := awsRestjson1_serializeDocumentLockConfiguration(v.LockConfiguration, ok); err != nil {
return err
}
}
if v.ResourceTags != nil {
ok := object.Key("ResourceTags")
if err := awsRestjson1_serializeDocumentResourceTags(v.ResourceTags, ok); err != nil {
return err
}
}
if len(v.ResourceType) > 0 {
ok := object.Key("ResourceType")
ok.String(string(v.ResourceType))
}
if v.RetentionPeriod != nil {
ok := object.Key("RetentionPeriod")
if err := awsRestjson1_serializeDocumentRetentionPeriod(v.RetentionPeriod, ok); err != nil {
return err
}
}
if v.Tags != nil {
ok := object.Key("Tags")
if err := awsRestjson1_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpDeleteRule struct {
}
func (*awsRestjson1_serializeOpDeleteRule) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpDeleteRule) 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.(*DeleteRuleInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/rules/{Identifier}")
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_serializeOpHttpBindingsDeleteRuleInput(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_serializeOpHttpBindingsDeleteRuleInput(v *DeleteRuleInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.Identifier == nil || len(*v.Identifier) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Identifier must not be empty")}
}
if v.Identifier != nil {
if err := encoder.SetURI("Identifier").String(*v.Identifier); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpGetRule struct {
}
func (*awsRestjson1_serializeOpGetRule) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpGetRule) 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.(*GetRuleInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/rules/{Identifier}")
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_serializeOpHttpBindingsGetRuleInput(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_serializeOpHttpBindingsGetRuleInput(v *GetRuleInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.Identifier == nil || len(*v.Identifier) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Identifier must not be empty")}
}
if v.Identifier != nil {
if err := encoder.SetURI("Identifier").String(*v.Identifier); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpListRules struct {
}
func (*awsRestjson1_serializeOpListRules) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpListRules) 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.(*ListRulesInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/list-rules")
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_serializeOpDocumentListRulesInput(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_serializeOpHttpBindingsListRulesInput(v *ListRulesInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
return nil
}
func awsRestjson1_serializeOpDocumentListRulesInput(v *ListRulesInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.LockState) > 0 {
ok := object.Key("LockState")
ok.String(string(v.LockState))
}
if v.MaxResults != nil {
ok := object.Key("MaxResults")
ok.Integer(*v.MaxResults)
}
if v.NextToken != nil {
ok := object.Key("NextToken")
ok.String(*v.NextToken)
}
if v.ResourceTags != nil {
ok := object.Key("ResourceTags")
if err := awsRestjson1_serializeDocumentResourceTags(v.ResourceTags, ok); err != nil {
return err
}
}
if len(v.ResourceType) > 0 {
ok := object.Key("ResourceType")
ok.String(string(v.ResourceType))
}
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_serializeOpLockRule struct {
}
func (*awsRestjson1_serializeOpLockRule) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpLockRule) 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.(*LockRuleInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/rules/{Identifier}/lock")
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_serializeOpHttpBindingsLockRuleInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentLockRuleInput(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_serializeOpHttpBindingsLockRuleInput(v *LockRuleInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.Identifier == nil || len(*v.Identifier) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Identifier must not be empty")}
}
if v.Identifier != nil {
if err := encoder.SetURI("Identifier").String(*v.Identifier); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentLockRuleInput(v *LockRuleInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.LockConfiguration != nil {
ok := object.Key("LockConfiguration")
if err := awsRestjson1_serializeDocumentLockConfiguration(v.LockConfiguration, ok); err != nil {
return err
}
}
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_serializeDocumentTagList(v.Tags, ok); err != nil {
return err
}
}
return nil
}
type awsRestjson1_serializeOpUnlockRule struct {
}
func (*awsRestjson1_serializeOpUnlockRule) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpUnlockRule) 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.(*UnlockRuleInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/rules/{Identifier}/unlock")
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_serializeOpHttpBindingsUnlockRuleInput(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_serializeOpHttpBindingsUnlockRuleInput(v *UnlockRuleInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.Identifier == nil || len(*v.Identifier) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Identifier must not be empty")}
}
if v.Identifier != nil {
if err := encoder.SetURI("Identifier").String(*v.Identifier); 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_serializeOpUpdateRule struct {
}
func (*awsRestjson1_serializeOpUpdateRule) ID() string {
return "OperationSerializer"
}
func (m *awsRestjson1_serializeOpUpdateRule) 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.(*UpdateRuleInput)
_ = input
if !ok {
return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
}
opPath, opQuery := httpbinding.SplitURI("/rules/{Identifier}")
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_serializeOpHttpBindingsUpdateRuleInput(input, restEncoder); err != nil {
return out, metadata, &smithy.SerializationError{Err: err}
}
restEncoder.SetHeader("Content-Type").String("application/json")
jsonEncoder := smithyjson.NewEncoder()
if err := awsRestjson1_serializeOpDocumentUpdateRuleInput(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_serializeOpHttpBindingsUpdateRuleInput(v *UpdateRuleInput, encoder *httpbinding.Encoder) error {
if v == nil {
return fmt.Errorf("unsupported serialization of nil %T", v)
}
if v.Identifier == nil || len(*v.Identifier) == 0 {
return &smithy.SerializationError{Err: fmt.Errorf("input member Identifier must not be empty")}
}
if v.Identifier != nil {
if err := encoder.SetURI("Identifier").String(*v.Identifier); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeOpDocumentUpdateRuleInput(v *UpdateRuleInput, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Description != nil {
ok := object.Key("Description")
ok.String(*v.Description)
}
if v.ResourceTags != nil {
ok := object.Key("ResourceTags")
if err := awsRestjson1_serializeDocumentResourceTags(v.ResourceTags, ok); err != nil {
return err
}
}
if len(v.ResourceType) > 0 {
ok := object.Key("ResourceType")
ok.String(string(v.ResourceType))
}
if v.RetentionPeriod != nil {
ok := object.Key("RetentionPeriod")
if err := awsRestjson1_serializeDocumentRetentionPeriod(v.RetentionPeriod, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentLockConfiguration(v *types.LockConfiguration, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.UnlockDelay != nil {
ok := object.Key("UnlockDelay")
if err := awsRestjson1_serializeDocumentUnlockDelay(v.UnlockDelay, ok); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentResourceTag(v *types.ResourceTag, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.ResourceTagKey != nil {
ok := object.Key("ResourceTagKey")
ok.String(*v.ResourceTagKey)
}
if v.ResourceTagValue != nil {
ok := object.Key("ResourceTagValue")
ok.String(*v.ResourceTagValue)
}
return nil
}
func awsRestjson1_serializeDocumentResourceTags(v []types.ResourceTag, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsRestjson1_serializeDocumentResourceTag(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentRetentionPeriod(v *types.RetentionPeriod, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.RetentionPeriodUnit) > 0 {
ok := object.Key("RetentionPeriodUnit")
ok.String(string(v.RetentionPeriodUnit))
}
if v.RetentionPeriodValue != nil {
ok := object.Key("RetentionPeriodValue")
ok.Integer(*v.RetentionPeriodValue)
}
return nil
}
func awsRestjson1_serializeDocumentTag(v *types.Tag, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if v.Key != nil {
ok := object.Key("Key")
ok.String(*v.Key)
}
if v.Value != nil {
ok := object.Key("Value")
ok.String(*v.Value)
}
return nil
}
func awsRestjson1_serializeDocumentTagList(v []types.Tag, value smithyjson.Value) error {
array := value.Array()
defer array.Close()
for i := range v {
av := array.Value()
if err := awsRestjson1_serializeDocumentTag(&v[i], av); err != nil {
return err
}
}
return nil
}
func awsRestjson1_serializeDocumentUnlockDelay(v *types.UnlockDelay, value smithyjson.Value) error {
object := value.Object()
defer object.Close()
if len(v.UnlockDelayUnit) > 0 {
ok := object.Key("UnlockDelayUnit")
ok.String(string(v.UnlockDelayUnit))
}
if v.UnlockDelayValue != nil {
ok := object.Key("UnlockDelayValue")
ok.Integer(*v.UnlockDelayValue)
}
return nil
}
| 877 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rbin
import (
"context"
"fmt"
"github.com/aws/aws-sdk-go-v2/service/rbin/types"
smithy "github.com/aws/smithy-go"
"github.com/aws/smithy-go/middleware"
)
type validateOpCreateRule struct {
}
func (*validateOpCreateRule) ID() string {
return "OperationInputValidation"
}
func (m *validateOpCreateRule) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateRuleInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpCreateRuleInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpDeleteRule struct {
}
func (*validateOpDeleteRule) ID() string {
return "OperationInputValidation"
}
func (m *validateOpDeleteRule) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*DeleteRuleInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpDeleteRuleInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpGetRule struct {
}
func (*validateOpGetRule) ID() string {
return "OperationInputValidation"
}
func (m *validateOpGetRule) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*GetRuleInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpGetRuleInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
type validateOpListRules struct {
}
func (*validateOpListRules) ID() string {
return "OperationInputValidation"
}
func (m *validateOpListRules) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*ListRulesInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpListRulesInput(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 validateOpLockRule struct {
}
func (*validateOpLockRule) ID() string {
return "OperationInputValidation"
}
func (m *validateOpLockRule) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*LockRuleInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpLockRuleInput(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 validateOpUnlockRule struct {
}
func (*validateOpUnlockRule) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUnlockRule) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UnlockRuleInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUnlockRuleInput(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 validateOpUpdateRule struct {
}
func (*validateOpUpdateRule) ID() string {
return "OperationInputValidation"
}
func (m *validateOpUpdateRule) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
out middleware.InitializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*UpdateRuleInput)
if !ok {
return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
}
if err := validateOpUpdateRuleInput(input); err != nil {
return out, metadata, err
}
return next.HandleInitialize(ctx, in)
}
func addOpCreateRuleValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpCreateRule{}, middleware.After)
}
func addOpDeleteRuleValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpDeleteRule{}, middleware.After)
}
func addOpGetRuleValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetRule{}, middleware.After)
}
func addOpListRulesValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListRules{}, middleware.After)
}
func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After)
}
func addOpLockRuleValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpLockRule{}, middleware.After)
}
func addOpTagResourceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpTagResource{}, middleware.After)
}
func addOpUnlockRuleValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUnlockRule{}, middleware.After)
}
func addOpUntagResourceValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUntagResource{}, middleware.After)
}
func addOpUpdateRuleValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpUpdateRule{}, middleware.After)
}
func validateLockConfiguration(v *types.LockConfiguration) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "LockConfiguration"}
if v.UnlockDelay == nil {
invalidParams.Add(smithy.NewErrParamRequired("UnlockDelay"))
} else if v.UnlockDelay != nil {
if err := validateUnlockDelay(v.UnlockDelay); err != nil {
invalidParams.AddNested("UnlockDelay", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateResourceTag(v *types.ResourceTag) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ResourceTag"}
if v.ResourceTagKey == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceTagKey"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateResourceTags(v []types.ResourceTag) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ResourceTags"}
for i := range v {
if err := validateResourceTag(&v[i]); err != nil {
invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateRetentionPeriod(v *types.RetentionPeriod) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "RetentionPeriod"}
if v.RetentionPeriodValue == nil {
invalidParams.Add(smithy.NewErrParamRequired("RetentionPeriodValue"))
}
if len(v.RetentionPeriodUnit) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("RetentionPeriodUnit"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateTag(v *types.Tag) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "Tag"}
if v.Key == nil {
invalidParams.Add(smithy.NewErrParamRequired("Key"))
}
if v.Value == nil {
invalidParams.Add(smithy.NewErrParamRequired("Value"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateTagList(v []types.Tag) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "TagList"}
for i := range v {
if err := validateTag(&v[i]); err != nil {
invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateUnlockDelay(v *types.UnlockDelay) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UnlockDelay"}
if v.UnlockDelayValue == nil {
invalidParams.Add(smithy.NewErrParamRequired("UnlockDelayValue"))
}
if len(v.UnlockDelayUnit) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("UnlockDelayUnit"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpCreateRuleInput(v *CreateRuleInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "CreateRuleInput"}
if v.RetentionPeriod == nil {
invalidParams.Add(smithy.NewErrParamRequired("RetentionPeriod"))
} else if v.RetentionPeriod != nil {
if err := validateRetentionPeriod(v.RetentionPeriod); err != nil {
invalidParams.AddNested("RetentionPeriod", err.(smithy.InvalidParamsError))
}
}
if v.Tags != nil {
if err := validateTagList(v.Tags); err != nil {
invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
}
}
if len(v.ResourceType) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("ResourceType"))
}
if v.ResourceTags != nil {
if err := validateResourceTags(v.ResourceTags); err != nil {
invalidParams.AddNested("ResourceTags", err.(smithy.InvalidParamsError))
}
}
if v.LockConfiguration != nil {
if err := validateLockConfiguration(v.LockConfiguration); err != nil {
invalidParams.AddNested("LockConfiguration", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpDeleteRuleInput(v *DeleteRuleInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "DeleteRuleInput"}
if v.Identifier == nil {
invalidParams.Add(smithy.NewErrParamRequired("Identifier"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpGetRuleInput(v *GetRuleInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "GetRuleInput"}
if v.Identifier == nil {
invalidParams.Add(smithy.NewErrParamRequired("Identifier"))
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpListRulesInput(v *ListRulesInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "ListRulesInput"}
if len(v.ResourceType) == 0 {
invalidParams.Add(smithy.NewErrParamRequired("ResourceType"))
}
if v.ResourceTags != nil {
if err := validateResourceTags(v.ResourceTags); err != nil {
invalidParams.AddNested("ResourceTags", err.(smithy.InvalidParamsError))
}
}
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 validateOpLockRuleInput(v *LockRuleInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "LockRuleInput"}
if v.Identifier == nil {
invalidParams.Add(smithy.NewErrParamRequired("Identifier"))
}
if v.LockConfiguration == nil {
invalidParams.Add(smithy.NewErrParamRequired("LockConfiguration"))
} else if v.LockConfiguration != nil {
if err := validateLockConfiguration(v.LockConfiguration); err != nil {
invalidParams.AddNested("LockConfiguration", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpTagResourceInput(v *TagResourceInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "TagResourceInput"}
if v.ResourceArn == nil {
invalidParams.Add(smithy.NewErrParamRequired("ResourceArn"))
}
if v.Tags == nil {
invalidParams.Add(smithy.NewErrParamRequired("Tags"))
} else if v.Tags != nil {
if err := validateTagList(v.Tags); err != nil {
invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
func validateOpUnlockRuleInput(v *UnlockRuleInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UnlockRuleInput"}
if v.Identifier == nil {
invalidParams.Add(smithy.NewErrParamRequired("Identifier"))
}
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 validateOpUpdateRuleInput(v *UpdateRuleInput) error {
if v == nil {
return nil
}
invalidParams := smithy.InvalidParamsError{Context: "UpdateRuleInput"}
if v.Identifier == nil {
invalidParams.Add(smithy.NewErrParamRequired("Identifier"))
}
if v.RetentionPeriod != nil {
if err := validateRetentionPeriod(v.RetentionPeriod); err != nil {
invalidParams.AddNested("RetentionPeriod", err.(smithy.InvalidParamsError))
}
}
if v.ResourceTags != nil {
if err := validateResourceTags(v.ResourceTags); err != nil {
invalidParams.AddNested("ResourceTags", err.(smithy.InvalidParamsError))
}
}
if invalidParams.Len() > 0 {
return invalidParams
} else {
return nil
}
}
| 578 |
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 rbin 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: "rbin.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "rbin-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rbin.{region}.amazonaws.com",
Protocols: []string{"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-south-2",
}: 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: "ap-southeast-4",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "ca-central-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.ca-central-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "eu-central-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-central-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-north-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-south-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "eu-south-2",
}: 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: "rbin-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: "rbin-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: "rbin-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: "rbin-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: "rbin-fips.us-west-2.amazonaws.com",
CredentialScope: endpoints.CredentialScope{
Region: "us-west-2",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "me-central-1",
}: endpoints.Endpoint{},
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: "rbin-fips.us-east-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-east-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-east-2",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.us-east-2.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.us-west-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-west-2",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-west-2",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.us-west-2.amazonaws.com",
},
},
},
{
ID: "aws-cn",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.DualStackVariant,
}: {
Hostname: "rbin.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.{region}.amazonaws.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "rbin-fips.{region}.api.amazonwebservices.com.cn",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rbin.{region}.amazonaws.com.cn",
Protocols: []string{"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: "rbin-fips.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rbin.{region}.c2s.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIso,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "fips-us-iso-east-1",
}: endpoints.Endpoint{
Hostname: "rbin-fips.us-iso-east-1.c2s.ic.gov",
CredentialScope: endpoints.CredentialScope{
Region: "us-iso-east-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "us-iso-east-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-iso-east-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.us-iso-east-1.c2s.ic.gov",
},
},
},
{
ID: "aws-iso-b",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rbin.{region}.sc2s.sgov.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
},
RegionRegex: partitionRegexp.AwsIsoB,
IsRegionalized: true,
Endpoints: endpoints.Endpoints{
endpoints.EndpointKey{
Region: "fips-us-isob-east-1",
}: endpoints.Endpoint{
Hostname: "rbin-fips.us-isob-east-1.sc2s.sgov.gov",
CredentialScope: endpoints.CredentialScope{
Region: "us-isob-east-1",
},
Deprecated: aws.TrueTernary,
},
endpoints.EndpointKey{
Region: "us-isob-east-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-isob-east-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.us-isob-east-1.sc2s.sgov.gov",
},
},
},
{
ID: "aws-iso-e",
Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.{region}.cloud.adc-e.uk",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rbin.{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: "rbin-fips.{region}.csp.hci.ic.gov",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rbin.{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: "rbin.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.{region}.amazonaws.com",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
}: {
Hostname: "rbin-fips.{region}.api.aws",
Protocols: []string{"https"},
SignatureVersions: []string{"v4"},
},
{
Variant: 0,
}: {
Hostname: "rbin.{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: "rbin-fips.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: "rbin-fips.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: "rbin-fips.us-gov-east-1.amazonaws.com",
},
endpoints.EndpointKey{
Region: "us-gov-west-1",
}: endpoints.Endpoint{},
endpoints.EndpointKey{
Region: "us-gov-west-1",
Variant: endpoints.FIPSVariant,
}: {
Hostname: "rbin-fips.us-gov-west-1.amazonaws.com",
},
},
},
}
| 541 |
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 ConflictExceptionReason string
// Enum values for ConflictExceptionReason
const (
ConflictExceptionReasonInvalidRuleState ConflictExceptionReason = "INVALID_RULE_STATE"
)
// Values returns all known values for ConflictExceptionReason. 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 (ConflictExceptionReason) Values() []ConflictExceptionReason {
return []ConflictExceptionReason{
"INVALID_RULE_STATE",
}
}
type LockState string
// Enum values for LockState
const (
LockStateLocked LockState = "locked"
LockStatePendingUnlock LockState = "pending_unlock"
LockStateUnlocked LockState = "unlocked"
)
// Values returns all known values for LockState. 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 (LockState) Values() []LockState {
return []LockState{
"locked",
"pending_unlock",
"unlocked",
}
}
type ResourceNotFoundExceptionReason string
// Enum values for ResourceNotFoundExceptionReason
const (
ResourceNotFoundExceptionReasonRuleNotFound ResourceNotFoundExceptionReason = "RULE_NOT_FOUND"
)
// Values returns all known values for ResourceNotFoundExceptionReason. 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 (ResourceNotFoundExceptionReason) Values() []ResourceNotFoundExceptionReason {
return []ResourceNotFoundExceptionReason{
"RULE_NOT_FOUND",
}
}
type ResourceType string
// Enum values for ResourceType
const (
ResourceTypeEbsSnapshot ResourceType = "EBS_SNAPSHOT"
ResourceTypeEc2Image ResourceType = "EC2_IMAGE"
)
// Values returns all known values for ResourceType. 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 (ResourceType) Values() []ResourceType {
return []ResourceType{
"EBS_SNAPSHOT",
"EC2_IMAGE",
}
}
type RetentionPeriodUnit string
// Enum values for RetentionPeriodUnit
const (
RetentionPeriodUnitDays RetentionPeriodUnit = "DAYS"
)
// Values returns all known values for RetentionPeriodUnit. 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 (RetentionPeriodUnit) Values() []RetentionPeriodUnit {
return []RetentionPeriodUnit{
"DAYS",
}
}
type RuleStatus string
// Enum values for RuleStatus
const (
RuleStatusPending RuleStatus = "pending"
RuleStatusAvailable RuleStatus = "available"
)
// Values returns all known values for RuleStatus. 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 (RuleStatus) Values() []RuleStatus {
return []RuleStatus{
"pending",
"available",
}
}
type ServiceQuotaExceededExceptionReason string
// Enum values for ServiceQuotaExceededExceptionReason
const (
ServiceQuotaExceededExceptionReasonServiceQuotaExceeded ServiceQuotaExceededExceptionReason = "SERVICE_QUOTA_EXCEEDED"
)
// Values returns all known values for ServiceQuotaExceededExceptionReason. 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 (ServiceQuotaExceededExceptionReason) Values() []ServiceQuotaExceededExceptionReason {
return []ServiceQuotaExceededExceptionReason{
"SERVICE_QUOTA_EXCEEDED",
}
}
type UnlockDelayUnit string
// Enum values for UnlockDelayUnit
const (
UnlockDelayUnitDays UnlockDelayUnit = "DAYS"
)
// Values returns all known values for UnlockDelayUnit. 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 (UnlockDelayUnit) Values() []UnlockDelayUnit {
return []UnlockDelayUnit{
"DAYS",
}
}
type ValidationExceptionReason string
// Enum values for ValidationExceptionReason
const (
ValidationExceptionReasonInvalidPageToken ValidationExceptionReason = "INVALID_PAGE_TOKEN"
ValidationExceptionReasonInvalidParameterValue ValidationExceptionReason = "INVALID_PARAMETER_VALUE"
)
// Values returns all known values for ValidationExceptionReason. 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 (ValidationExceptionReason) Values() []ValidationExceptionReason {
return []ValidationExceptionReason{
"INVALID_PAGE_TOKEN",
"INVALID_PARAMETER_VALUE",
}
}
| 160 |
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"
)
// The specified retention rule lock request can't be completed.
type ConflictException struct {
Message *string
ErrorCodeOverride *string
Reason ConflictExceptionReason
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 could not respond to the request due to an internal problem.
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 specified resource was not found.
type ResourceNotFoundException struct {
Message *string
ErrorCodeOverride *string
Reason ResourceNotFoundExceptionReason
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 cause a service quota for the number of tags per resource to
// be exceeded.
type ServiceQuotaExceededException struct {
Message *string
ErrorCodeOverride *string
Reason ServiceQuotaExceededExceptionReason
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 }
// One or more of the parameters in the request is not valid.
type ValidationException struct {
Message *string
ErrorCodeOverride *string
Reason ValidationExceptionReason
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 }
| 148 |
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"
)
// Information about a retention rule lock configuration.
type LockConfiguration struct {
// Information about the retention rule unlock delay.
//
// This member is required.
UnlockDelay *UnlockDelay
noSmithyDocumentSerde
}
// Information about the resource tags used to identify resources that are
// retained by the retention rule.
type ResourceTag struct {
// The tag key.
//
// This member is required.
ResourceTagKey *string
// The tag value.
ResourceTagValue *string
noSmithyDocumentSerde
}
// Information about the retention period for which the retention rule is to
// retain resources.
type RetentionPeriod struct {
// The unit of time in which the retention period is measured. Currently, only DAYS
// is supported.
//
// This member is required.
RetentionPeriodUnit RetentionPeriodUnit
// The period value for which the retention rule is to retain resources. The
// period is measured using the unit specified for RetentionPeriodUnit.
//
// This member is required.
RetentionPeriodValue *int32
noSmithyDocumentSerde
}
// Information about a Recycle Bin retention rule.
type RuleSummary struct {
// The retention rule description.
Description *string
// The unique ID of the retention rule.
Identifier *string
// The lock state for the retention rule.
// - locked - The retention rule is locked and can't be modified or deleted.
// - pending_unlock - The retention rule has been unlocked but it is still within
// the unlock delay period. The retention rule can be modified or deleted only
// after the unlock delay period has expired.
// - unlocked - The retention rule is unlocked and it can be modified or deleted
// by any user with the required permissions.
// - null - The retention rule has never been locked. Once a retention rule has
// been locked, it can transition between the locked and unlocked states only; it
// can never transition back to null .
LockState LockState
// Information about the retention period for which the retention rule is to
// retain resources.
RetentionPeriod *RetentionPeriod
noSmithyDocumentSerde
}
// Information about the tags to assign to the retention rule.
type Tag struct {
// The tag key.
//
// This member is required.
Key *string
// The tag value.
//
// This member is required.
Value *string
noSmithyDocumentSerde
}
// Information about the retention rule unlock delay. The unlock delay is the
// period after which a retention rule can be modified or edited after it has been
// unlocked by a user with the required permissions. The retention rule can't be
// modified or deleted during the unlock delay.
type UnlockDelay struct {
// The unit of time in which to measure the unlock delay. Currently, the unlock
// delay can be measure only in days.
//
// This member is required.
UnlockDelayUnit UnlockDelayUnit
// The unlock delay period, measured in the unit specified for UnlockDelayUnit.
//
// This member is required.
UnlockDelayValue *int32
noSmithyDocumentSerde
}
type noSmithyDocumentSerde = smithydocument.NoSerde
| 119 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/protocol/query"
"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"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
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 = "RDS"
const ServiceAPIVersion = "2014-10-31"
// Client provides the API client to make operations call for Amazon Relational
// Database Service.
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, "rds", 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)
}
// HTTPPresignerV4 represents presigner interface used by presign url client
type HTTPPresignerV4 interface {
PresignHTTP(
ctx context.Context, credentials aws.Credentials, r *http.Request,
payloadHash string, service string, region string, signingTime time.Time,
optFns ...func(*v4.SignerOptions),
) (url string, signedHeader http.Header, err error)
}
// PresignOptions represents the presign client options
type PresignOptions struct {
// ClientOptions are list of functional options to mutate client options used by
// the presign client.
ClientOptions []func(*Options)
// Presigner is the presigner used by the presign url client
Presigner HTTPPresignerV4
}
func (o PresignOptions) copy() PresignOptions {
clientOptions := make([]func(*Options), len(o.ClientOptions))
copy(clientOptions, o.ClientOptions)
o.ClientOptions = clientOptions
return o
}
// WithPresignClientFromClientOptions is a helper utility to retrieve a function
// that takes PresignOption as input
func WithPresignClientFromClientOptions(optFns ...func(*Options)) func(*PresignOptions) {
return withPresignClientFromClientOptions(optFns).options
}
type withPresignClientFromClientOptions []func(*Options)
func (w withPresignClientFromClientOptions) options(o *PresignOptions) {
o.ClientOptions = append(o.ClientOptions, w...)
}
// PresignClient represents the presign url client
type PresignClient struct {
client *Client
options PresignOptions
}
// NewPresignClient generates a presign client using provided API Client and
// presign options
func NewPresignClient(c *Client, optFns ...func(*PresignOptions)) *PresignClient {
var options PresignOptions
for _, fn := range optFns {
fn(&options)
}
if len(options.ClientOptions) != 0 {
c = New(c.options, options.ClientOptions...)
}
if options.Presigner == nil {
options.Presigner = newDefaultV4Signer(c.options)
}
return &PresignClient{
client: c,
options: options,
}
}
func withNopHTTPClientAPIOption(o *Options) {
o.HTTPClient = smithyhttp.NopClient{}
}
type presignConverter PresignOptions
func (c presignConverter) convertToPresignMiddleware(stack *middleware.Stack, options Options) (err error) {
stack.Finalize.Clear()
stack.Deserialize.Clear()
stack.Build.Remove((*awsmiddleware.ClientRequestID)(nil).ID())
stack.Build.Remove("UserAgent")
pmw := v4.NewPresignHTTPRequestMiddleware(v4.PresignHTTPRequestMiddlewareOptions{
CredentialsProvider: options.Credentials,
Presigner: c.Presigner,
LogSigning: options.ClientLogMode.IsSigning(),
})
err = stack.Finalize.Add(pmw, middleware.After)
if err != nil {
return err
}
if err = smithyhttp.AddNoPayloadDefaultContentTypeRemover(stack); err != nil {
return err
}
// convert request to a GET request
err = query.AddAsGetRequestMiddleware(stack)
if err != nil {
return err
}
err = presignedurlcust.AddAsIsPresigingMiddleware(stack)
if err != nil {
return err
}
return nil
}
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)
}
| 538 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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 rds
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"
)
// Associates an Identity and Access Management (IAM) role with a DB cluster.
func (c *Client) AddRoleToDBCluster(ctx context.Context, params *AddRoleToDBClusterInput, optFns ...func(*Options)) (*AddRoleToDBClusterOutput, error) {
if params == nil {
params = &AddRoleToDBClusterInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AddRoleToDBCluster", params, optFns, c.addOperationAddRoleToDBClusterMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AddRoleToDBClusterOutput)
out.ResultMetadata = metadata
return out, nil
}
type AddRoleToDBClusterInput struct {
// The name of the DB cluster to associate the IAM role with.
//
// This member is required.
DBClusterIdentifier *string
// The Amazon Resource Name (ARN) of the IAM role to associate with the Aurora DB
// cluster, for example arn:aws:iam::123456789012:role/AuroraAccessRole .
//
// This member is required.
RoleArn *string
// The name of the feature for the DB cluster that the IAM role is to be
// associated with. For information about supported feature names, see
// DBEngineVersion .
FeatureName *string
noSmithyDocumentSerde
}
type AddRoleToDBClusterOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAddRoleToDBClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAddRoleToDBCluster{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAddRoleToDBCluster{}, 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 = addOpAddRoleToDBClusterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddRoleToDBCluster(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_opAddRoleToDBCluster(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "AddRoleToDBCluster",
}
}
| 131 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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"
)
// Associates an Amazon Web Services Identity and Access Management (IAM) role
// with a DB instance. To add a role to a DB instance, the status of the DB
// instance must be available . This command doesn't apply to RDS Custom.
func (c *Client) AddRoleToDBInstance(ctx context.Context, params *AddRoleToDBInstanceInput, optFns ...func(*Options)) (*AddRoleToDBInstanceOutput, error) {
if params == nil {
params = &AddRoleToDBInstanceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AddRoleToDBInstance", params, optFns, c.addOperationAddRoleToDBInstanceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AddRoleToDBInstanceOutput)
out.ResultMetadata = metadata
return out, nil
}
type AddRoleToDBInstanceInput struct {
// The name of the DB instance to associate the IAM role with.
//
// This member is required.
DBInstanceIdentifier *string
// The name of the feature for the DB instance that the IAM role is to be
// associated with. For information about supported feature names, see
// DBEngineVersion .
//
// This member is required.
FeatureName *string
// The Amazon Resource Name (ARN) of the IAM role to associate with the DB
// instance, for example arn:aws:iam::123456789012:role/AccessRole .
//
// This member is required.
RoleArn *string
noSmithyDocumentSerde
}
type AddRoleToDBInstanceOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAddRoleToDBInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAddRoleToDBInstance{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAddRoleToDBInstance{}, 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 = addOpAddRoleToDBInstanceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddRoleToDBInstance(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_opAddRoleToDBInstance(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "AddRoleToDBInstance",
}
}
| 135 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Adds a source identifier to an existing RDS event notification subscription.
func (c *Client) AddSourceIdentifierToSubscription(ctx context.Context, params *AddSourceIdentifierToSubscriptionInput, optFns ...func(*Options)) (*AddSourceIdentifierToSubscriptionOutput, error) {
if params == nil {
params = &AddSourceIdentifierToSubscriptionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AddSourceIdentifierToSubscription", params, optFns, c.addOperationAddSourceIdentifierToSubscriptionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AddSourceIdentifierToSubscriptionOutput)
out.ResultMetadata = metadata
return out, nil
}
type AddSourceIdentifierToSubscriptionInput struct {
// The identifier of the event source to be added. Constraints:
// - If the source type is a DB instance, a DBInstanceIdentifier value must be
// supplied.
// - If the source type is a DB cluster, a DBClusterIdentifier value must be
// supplied.
// - If the source type is a DB parameter group, a DBParameterGroupName value
// must be supplied.
// - If the source type is a DB security group, a DBSecurityGroupName value must
// be supplied.
// - If the source type is a DB snapshot, a DBSnapshotIdentifier value must be
// supplied.
// - If the source type is a DB cluster snapshot, a DBClusterSnapshotIdentifier
// value must be supplied.
// - If the source type is an RDS Proxy, a DBProxyName value must be supplied.
//
// This member is required.
SourceIdentifier *string
// The name of the RDS event notification subscription you want to add a source
// identifier to.
//
// This member is required.
SubscriptionName *string
noSmithyDocumentSerde
}
type AddSourceIdentifierToSubscriptionOutput struct {
// Contains the results of a successful invocation of the
// DescribeEventSubscriptions action.
EventSubscription *types.EventSubscription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAddSourceIdentifierToSubscriptionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAddSourceIdentifierToSubscription{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAddSourceIdentifierToSubscription{}, 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 = addOpAddSourceIdentifierToSubscriptionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddSourceIdentifierToSubscription(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_opAddSourceIdentifierToSubscription(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "AddSourceIdentifierToSubscription",
}
}
| 145 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Adds metadata tags to an Amazon RDS resource. These tags can also be used with
// cost allocation reporting to track cost associated with Amazon RDS resources, or
// used in a Condition statement in an IAM policy for Amazon RDS. For an overview
// on tagging Amazon RDS resources, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.Tagging.html)
// .
func (c *Client) AddTagsToResource(ctx context.Context, params *AddTagsToResourceInput, optFns ...func(*Options)) (*AddTagsToResourceOutput, error) {
if params == nil {
params = &AddTagsToResourceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AddTagsToResource", params, optFns, c.addOperationAddTagsToResourceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AddTagsToResourceOutput)
out.ResultMetadata = metadata
return out, nil
}
type AddTagsToResourceInput struct {
// The Amazon RDS resource that the tags are added to. This value is an Amazon
// Resource Name (ARN). For information about creating an ARN, see Constructing an
// RDS Amazon Resource Name (ARN) (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.ARN.html#USER_Tagging.ARN.Constructing)
// .
//
// This member is required.
ResourceName *string
// The tags to be assigned to the Amazon RDS resource.
//
// This member is required.
Tags []types.Tag
noSmithyDocumentSerde
}
type AddTagsToResourceOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAddTagsToResourceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAddTagsToResource{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAddTagsToResource{}, 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 = addOpAddTagsToResourceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAddTagsToResource(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_opAddTagsToResource(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "AddTagsToResource",
}
}
| 133 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Applies a pending maintenance action to a resource (for example, to a DB
// instance).
func (c *Client) ApplyPendingMaintenanceAction(ctx context.Context, params *ApplyPendingMaintenanceActionInput, optFns ...func(*Options)) (*ApplyPendingMaintenanceActionOutput, error) {
if params == nil {
params = &ApplyPendingMaintenanceActionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "ApplyPendingMaintenanceAction", params, optFns, c.addOperationApplyPendingMaintenanceActionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*ApplyPendingMaintenanceActionOutput)
out.ResultMetadata = metadata
return out, nil
}
type ApplyPendingMaintenanceActionInput struct {
// The pending maintenance action to apply to this resource. Valid values:
// system-update , db-upgrade , hardware-maintenance , ca-certificate-rotation
//
// This member is required.
ApplyAction *string
// A value that specifies the type of opt-in request, or undoes an opt-in request.
// An opt-in request of type immediate can't be undone. Valid values:
// - immediate - Apply the maintenance action immediately.
// - next-maintenance - Apply the maintenance action during the next maintenance
// window for the resource.
// - undo-opt-in - Cancel any existing next-maintenance opt-in requests.
//
// This member is required.
OptInType *string
// The RDS Amazon Resource Name (ARN) of the resource that the pending maintenance
// action applies to. For information about creating an ARN, see Constructing an
// RDS Amazon Resource Name (ARN) (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.ARN.html#USER_Tagging.ARN.Constructing)
// .
//
// This member is required.
ResourceIdentifier *string
noSmithyDocumentSerde
}
type ApplyPendingMaintenanceActionOutput struct {
// Describes the pending maintenance actions for a resource.
ResourcePendingMaintenanceActions *types.ResourcePendingMaintenanceActions
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationApplyPendingMaintenanceActionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpApplyPendingMaintenanceAction{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpApplyPendingMaintenanceAction{}, 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 = addOpApplyPendingMaintenanceActionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opApplyPendingMaintenanceAction(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_opApplyPendingMaintenanceAction(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "ApplyPendingMaintenanceAction",
}
}
| 145 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Enables ingress to a DBSecurityGroup using one of two forms of authorization.
// First, EC2 or VPC security groups can be added to the DBSecurityGroup if the
// application using the database is running on EC2 or VPC instances. Second, IP
// ranges are available if the application accessing your database is running on
// the internet. Required parameters for this API are one of CIDR range,
// EC2SecurityGroupId for VPC, or (EC2SecurityGroupOwnerId and either
// EC2SecurityGroupName or EC2SecurityGroupId for non-VPC). You can't authorize
// ingress from an EC2 security group in one Amazon Web Services Region to an
// Amazon RDS DB instance in another. You can't authorize ingress from a VPC
// security group in one VPC to an Amazon RDS DB instance in another. For an
// overview of CIDR ranges, go to the Wikipedia Tutorial (http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing)
// . EC2-Classic was retired on August 15, 2022. If you haven't migrated from
// EC2-Classic to a VPC, we recommend that you migrate as soon as possible. For
// more information, see Migrate from EC2-Classic to a VPC (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-migrate.html)
// in the Amazon EC2 User Guide, the blog EC2-Classic Networking is Retiring –
// Here’s How to Prepare (http://aws.amazon.com/blogs/aws/ec2-classic-is-retiring-heres-how-to-prepare/)
// , and Moving a DB instance not in a VPC into a VPC (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.Non-VPC2VPC.html)
// in the Amazon RDS User Guide.
func (c *Client) AuthorizeDBSecurityGroupIngress(ctx context.Context, params *AuthorizeDBSecurityGroupIngressInput, optFns ...func(*Options)) (*AuthorizeDBSecurityGroupIngressOutput, error) {
if params == nil {
params = &AuthorizeDBSecurityGroupIngressInput{}
}
result, metadata, err := c.invokeOperation(ctx, "AuthorizeDBSecurityGroupIngress", params, optFns, c.addOperationAuthorizeDBSecurityGroupIngressMiddlewares)
if err != nil {
return nil, err
}
out := result.(*AuthorizeDBSecurityGroupIngressOutput)
out.ResultMetadata = metadata
return out, nil
}
type AuthorizeDBSecurityGroupIngressInput struct {
// The name of the DB security group to add authorization to.
//
// This member is required.
DBSecurityGroupName *string
// The IP range to authorize.
CIDRIP *string
// Id of the EC2 security group to authorize. For VPC DB security groups,
// EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and
// either EC2SecurityGroupName or EC2SecurityGroupId must be provided.
EC2SecurityGroupId *string
// Name of the EC2 security group to authorize. For VPC DB security groups,
// EC2SecurityGroupId must be provided. Otherwise, EC2SecurityGroupOwnerId and
// either EC2SecurityGroupName or EC2SecurityGroupId must be provided.
EC2SecurityGroupName *string
// Amazon Web Services account number of the owner of the EC2 security group
// specified in the EC2SecurityGroupName parameter. The Amazon Web Services access
// key ID isn't an acceptable value. For VPC DB security groups, EC2SecurityGroupId
// must be provided. Otherwise, EC2SecurityGroupOwnerId and either
// EC2SecurityGroupName or EC2SecurityGroupId must be provided.
EC2SecurityGroupOwnerId *string
noSmithyDocumentSerde
}
type AuthorizeDBSecurityGroupIngressOutput struct {
// Contains the details for an Amazon RDS DB security group. This data type is
// used as a response element in the DescribeDBSecurityGroups action.
DBSecurityGroup *types.DBSecurityGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationAuthorizeDBSecurityGroupIngressMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpAuthorizeDBSecurityGroupIngress{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpAuthorizeDBSecurityGroupIngress{}, 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 = addOpAuthorizeDBSecurityGroupIngressValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAuthorizeDBSecurityGroupIngress(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_opAuthorizeDBSecurityGroupIngress(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "AuthorizeDBSecurityGroupIngress",
}
}
| 163 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Backtracks a DB cluster to a specific time, without creating a new DB cluster.
// For more information on backtracking, see Backtracking an Aurora DB Cluster (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Managing.Backtrack.html)
// in the Amazon Aurora User Guide. This action applies only to Aurora MySQL DB
// clusters.
func (c *Client) BacktrackDBCluster(ctx context.Context, params *BacktrackDBClusterInput, optFns ...func(*Options)) (*BacktrackDBClusterOutput, error) {
if params == nil {
params = &BacktrackDBClusterInput{}
}
result, metadata, err := c.invokeOperation(ctx, "BacktrackDBCluster", params, optFns, c.addOperationBacktrackDBClusterMiddlewares)
if err != nil {
return nil, err
}
out := result.(*BacktrackDBClusterOutput)
out.ResultMetadata = metadata
return out, nil
}
type BacktrackDBClusterInput struct {
// The timestamp of the time to backtrack the DB cluster to, specified in ISO 8601
// format. For more information about ISO 8601, see the ISO8601 Wikipedia page. (http://en.wikipedia.org/wiki/ISO_8601)
// If the specified time isn't a consistent time for the DB cluster, Aurora
// automatically chooses the nearest possible consistent time for the DB cluster.
// Constraints:
// - Must contain a valid ISO 8601 timestamp.
// - Can't contain a timestamp set in the future.
// Example: 2017-07-08T18:00Z
//
// This member is required.
BacktrackTo *time.Time
// The DB cluster identifier of the DB cluster to be backtracked. This parameter
// is stored as a lowercase string. Constraints:
// - Must contain from 1 to 63 alphanumeric characters or hyphens.
// - First character must be a letter.
// - Can't end with a hyphen or contain two consecutive hyphens.
// Example: my-cluster1
//
// This member is required.
DBClusterIdentifier *string
// A value that indicates whether to force the DB cluster to backtrack when binary
// logging is enabled. Otherwise, an error occurs when binary logging is enabled.
Force *bool
// A value that indicates whether to backtrack the DB cluster to the earliest
// possible backtrack time when BacktrackTo is set to a timestamp earlier than the
// earliest backtrack time. When this parameter is disabled and BacktrackTo is set
// to a timestamp earlier than the earliest backtrack time, an error occurs.
UseEarliestTimeOnPointInTimeUnavailable *bool
noSmithyDocumentSerde
}
// This data type is used as a response element in the DescribeDBClusterBacktracks
// action.
type BacktrackDBClusterOutput struct {
// Contains the backtrack identifier.
BacktrackIdentifier *string
// The timestamp of the time at which the backtrack was requested.
BacktrackRequestCreationTime *time.Time
// The timestamp of the time to which the DB cluster was backtracked.
BacktrackTo *time.Time
// The timestamp of the time from which the DB cluster was backtracked.
BacktrackedFrom *time.Time
// Contains a user-supplied DB cluster identifier. This identifier is the unique
// key that identifies a DB cluster.
DBClusterIdentifier *string
// The status of the backtrack. This property returns one of the following values:
// - applying - The backtrack is currently being applied to or rolled back from
// the DB cluster.
// - completed - The backtrack has successfully been applied to or rolled back
// from the DB cluster.
// - failed - An error occurred while the backtrack was applied to or rolled back
// from the DB cluster.
// - pending - The backtrack is currently pending application to or rollback from
// the DB cluster.
Status *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationBacktrackDBClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpBacktrackDBCluster{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpBacktrackDBCluster{}, 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 = addOpBacktrackDBClusterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opBacktrackDBCluster(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_opBacktrackDBCluster(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "BacktrackDBCluster",
}
}
| 181 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Cancels an export task in progress that is exporting a snapshot or cluster to
// Amazon S3. Any data that has already been written to the S3 bucket isn't
// removed.
func (c *Client) CancelExportTask(ctx context.Context, params *CancelExportTaskInput, optFns ...func(*Options)) (*CancelExportTaskOutput, error) {
if params == nil {
params = &CancelExportTaskInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CancelExportTask", params, optFns, c.addOperationCancelExportTaskMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CancelExportTaskOutput)
out.ResultMetadata = metadata
return out, nil
}
type CancelExportTaskInput struct {
// The identifier of the snapshot or cluster export task to cancel.
//
// This member is required.
ExportTaskIdentifier *string
noSmithyDocumentSerde
}
// Contains the details of a snapshot or cluster export to Amazon S3. This data
// type is used as a response element in the DescribeExportTasks action.
type CancelExportTaskOutput struct {
// The data exported from the snapshot or cluster. Valid values are the following:
// - database - Export all the data from a specified database.
// - database.table table-name - Export a table of the snapshot or cluster. This
// format is valid only for RDS for MySQL, RDS for MariaDB, and Aurora MySQL.
// - database.schema schema-name - Export a database schema of the snapshot or
// cluster. This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.
//
// - database.schema.table table-name - Export a table of the database schema.
// This format is valid only for RDS for PostgreSQL and Aurora PostgreSQL.
ExportOnly []string
// A unique identifier for the snapshot or cluster export task. This ID isn't an
// identifier for the Amazon S3 bucket where the data is exported.
ExportTaskIdentifier *string
// The reason the export failed, if it failed.
FailureCause *string
// The name of the IAM role that is used to write to Amazon S3 when exporting a
// snapshot or cluster.
IamRoleArn *string
// The key identifier of the Amazon Web Services KMS key that is used to encrypt
// the data when it's exported to Amazon S3. The KMS key identifier is its key ARN,
// key ID, alias ARN, or alias name. The IAM role used for the export must have
// encryption and decryption permissions to use this KMS key.
KmsKeyId *string
// The progress of the snapshot or cluster export task as a percentage.
PercentProgress int32
// The Amazon S3 bucket that the snapshot or cluster is exported to.
S3Bucket *string
// The Amazon S3 bucket prefix that is the file name and path of the exported data.
S3Prefix *string
// The time that the snapshot was created.
SnapshotTime *time.Time
// The Amazon Resource Name (ARN) of the snapshot or cluster exported to Amazon S3.
SourceArn *string
// The type of source for the export.
SourceType types.ExportSourceType
// The progress status of the export task. The status can be one of the following:
// - CANCELED
// - CANCELING
// - COMPLETE
// - FAILED
// - IN_PROGRESS
// - STARTING
Status *string
// The time that the snapshot or cluster export task ended.
TaskEndTime *time.Time
// The time that the snapshot or cluster export task started.
TaskStartTime *time.Time
// The total amount of data exported, in gigabytes.
TotalExtractedDataInGB int32
// A warning about the snapshot or cluster export task.
WarningMessage *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCancelExportTaskMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCancelExportTask{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCancelExportTask{}, 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 = addOpCancelExportTaskValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelExportTask(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_opCancelExportTask(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CancelExportTask",
}
}
| 194 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Copies the specified DB cluster parameter group.
func (c *Client) CopyDBClusterParameterGroup(ctx context.Context, params *CopyDBClusterParameterGroupInput, optFns ...func(*Options)) (*CopyDBClusterParameterGroupOutput, error) {
if params == nil {
params = &CopyDBClusterParameterGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CopyDBClusterParameterGroup", params, optFns, c.addOperationCopyDBClusterParameterGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CopyDBClusterParameterGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CopyDBClusterParameterGroupInput struct {
// The identifier or Amazon Resource Name (ARN) for the source DB cluster
// parameter group. For information about creating an ARN, see Constructing an ARN
// for Amazon RDS (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_Tagging.ARN.html#USER_Tagging.ARN.Constructing)
// in the Amazon Aurora User Guide. Constraints:
// - Must specify a valid DB cluster parameter group.
//
// This member is required.
SourceDBClusterParameterGroupIdentifier *string
// A description for the copied DB cluster parameter group.
//
// This member is required.
TargetDBClusterParameterGroupDescription *string
// The identifier for the copied DB cluster parameter group. Constraints:
// - Can't be null, empty, or blank
// - Must contain from 1 to 255 letters, numbers, or hyphens
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// Example: my-cluster-param-group1
//
// This member is required.
TargetDBClusterParameterGroupIdentifier *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
noSmithyDocumentSerde
}
type CopyDBClusterParameterGroupOutput struct {
// Contains the details of an Amazon RDS DB cluster parameter group. This data
// type is used as a response element in the DescribeDBClusterParameterGroups
// action.
DBClusterParameterGroup *types.DBClusterParameterGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCopyDBClusterParameterGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCopyDBClusterParameterGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCopyDBClusterParameterGroup{}, 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 = addOpCopyDBClusterParameterGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCopyDBClusterParameterGroup(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_opCopyDBClusterParameterGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CopyDBClusterParameterGroup",
}
}
| 150 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
"github.com/aws/aws-sdk-go-v2/service/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Copies a snapshot of a DB cluster. To copy a DB cluster snapshot from a shared
// manual DB cluster snapshot, SourceDBClusterSnapshotIdentifier must be the
// Amazon Resource Name (ARN) of the shared DB cluster snapshot. You can copy an
// encrypted DB cluster snapshot from another Amazon Web Services Region. In that
// case, the Amazon Web Services Region where you call the CopyDBClusterSnapshot
// operation is the destination Amazon Web Services Region for the encrypted DB
// cluster snapshot to be copied to. To copy an encrypted DB cluster snapshot from
// another Amazon Web Services Region, you must provide the following values:
// - KmsKeyId - The Amazon Web Services Key Management System (Amazon Web
// Services KMS) key identifier for the key to use to encrypt the copy of the DB
// cluster snapshot in the destination Amazon Web Services Region.
// - TargetDBClusterSnapshotIdentifier - The identifier for the new copy of the
// DB cluster snapshot in the destination Amazon Web Services Region.
// - SourceDBClusterSnapshotIdentifier - The DB cluster snapshot identifier for
// the encrypted DB cluster snapshot to be copied. This identifier must be in the
// ARN format for the source Amazon Web Services Region and is the same value as
// the SourceDBClusterSnapshotIdentifier in the presigned URL.
//
// To cancel the copy operation once it is in progress, delete the target DB
// cluster snapshot identified by TargetDBClusterSnapshotIdentifier while that DB
// cluster snapshot is in "copying" status. For more information on copying
// encrypted Amazon Aurora DB cluster snapshots from one Amazon Web Services Region
// to another, see Copying a Snapshot (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_CopySnapshot.html)
// in the Amazon Aurora User Guide. For more information on Amazon Aurora DB
// clusters, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) CopyDBClusterSnapshot(ctx context.Context, params *CopyDBClusterSnapshotInput, optFns ...func(*Options)) (*CopyDBClusterSnapshotOutput, error) {
if params == nil {
params = &CopyDBClusterSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CopyDBClusterSnapshot", params, optFns, c.addOperationCopyDBClusterSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CopyDBClusterSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type CopyDBClusterSnapshotInput struct {
// The identifier of the DB cluster snapshot to copy. This parameter isn't
// case-sensitive. You can't copy an encrypted, shared DB cluster snapshot from one
// Amazon Web Services Region to another. Constraints:
// - Must specify a valid system snapshot in the "available" state.
// - If the source snapshot is in the same Amazon Web Services Region as the
// copy, specify a valid DB snapshot identifier.
// - If the source snapshot is in a different Amazon Web Services Region than
// the copy, specify a valid DB cluster snapshot ARN. For more information, go to
// Copying Snapshots Across Amazon Web Services Regions (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_CopySnapshot.html#USER_CopySnapshot.AcrossRegions)
// in the Amazon Aurora User Guide.
// Example: my-cluster-snapshot1
//
// This member is required.
SourceDBClusterSnapshotIdentifier *string
// The identifier of the new DB cluster snapshot to create from the source DB
// cluster snapshot. This parameter isn't case-sensitive. Constraints:
// - Must contain from 1 to 63 letters, numbers, or hyphens.
// - First character must be a letter.
// - Can't end with a hyphen or contain two consecutive hyphens.
// Example: my-cluster-snapshot2
//
// This member is required.
TargetDBClusterSnapshotIdentifier *string
// A value that indicates whether to copy all tags from the source DB cluster
// snapshot to the target DB cluster snapshot. By default, tags are not copied.
CopyTags *bool
// The Amazon Web Services KMS key identifier for an encrypted DB cluster
// snapshot. The Amazon Web Services KMS key identifier is the key ARN, key ID,
// alias ARN, or alias name for the Amazon Web Services KMS key. If you copy an
// encrypted DB cluster snapshot from your Amazon Web Services account, you can
// specify a value for KmsKeyId to encrypt the copy with a new KMS key. If you
// don't specify a value for KmsKeyId , then the copy of the DB cluster snapshot is
// encrypted with the same KMS key as the source DB cluster snapshot. If you copy
// an encrypted DB cluster snapshot that is shared from another Amazon Web Services
// account, then you must specify a value for KmsKeyId . To copy an encrypted DB
// cluster snapshot to another Amazon Web Services Region, you must set KmsKeyId
// to the Amazon Web Services KMS key identifier you want to use to encrypt the
// copy of the DB cluster snapshot in the destination Amazon Web Services Region.
// KMS keys are specific to the Amazon Web Services Region that they are created
// in, and you can't use KMS keys from one Amazon Web Services Region in another
// Amazon Web Services Region. If you copy an unencrypted DB cluster snapshot and
// specify a value for the KmsKeyId parameter, an error is returned.
KmsKeyId *string
// When you are copying a DB cluster snapshot from one Amazon Web Services
// GovCloud (US) Region to another, the URL that contains a Signature Version 4
// signed request for the CopyDBClusterSnapshot API operation in the Amazon Web
// Services Region that contains the source DB cluster snapshot to copy. Use the
// PreSignedUrl parameter when copying an encrypted DB cluster snapshot from
// another Amazon Web Services Region. Don't specify PreSignedUrl when copying an
// encrypted DB cluster snapshot in the same Amazon Web Services Region. This
// setting applies only to Amazon Web Services GovCloud (US) Regions. It's ignored
// in other Amazon Web Services Regions. The presigned URL must be a valid request
// for the CopyDBClusterSnapshot API operation that can run in the source Amazon
// Web Services Region that contains the encrypted DB cluster snapshot to copy. The
// presigned URL request must contain the following parameter values:
// - KmsKeyId - The KMS key identifier for the KMS key to use to encrypt the copy
// of the DB cluster snapshot in the destination Amazon Web Services Region. This
// is the same identifier for both the CopyDBClusterSnapshot operation that is
// called in the destination Amazon Web Services Region, and the operation
// contained in the presigned URL.
// - DestinationRegion - The name of the Amazon Web Services Region that the DB
// cluster snapshot is to be created in.
// - SourceDBClusterSnapshotIdentifier - The DB cluster snapshot identifier for
// the encrypted DB cluster snapshot to be copied. This identifier must be in the
// Amazon Resource Name (ARN) format for the source Amazon Web Services Region. For
// example, if you are copying an encrypted DB cluster snapshot from the us-west-2
// Amazon Web Services Region, then your SourceDBClusterSnapshotIdentifier looks
// like the following example:
// arn:aws:rds:us-west-2:123456789012:cluster-snapshot:aurora-cluster1-snapshot-20161115
// .
// To learn how to generate a Signature Version 4 signed request, see
// Authenticating Requests: Using Query Parameters (Amazon Web Services Signature
// Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html)
// and Signature Version 4 Signing Process (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)
// . If you are using an Amazon Web Services SDK tool or the CLI, you can specify
// SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl
// manually. Specifying SourceRegion autogenerates a presigned URL that is a valid
// request for the operation that can run in the source Amazon Web Services Region.
PreSignedUrl *string
// The AWS region the resource is in. The presigned URL will be created with this
// region, if the PresignURL member is empty set.
SourceRegion *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
// Used by the SDK's PresignURL autofill customization to specify the region the
// of the client's request.
destinationRegion *string
noSmithyDocumentSerde
}
type CopyDBClusterSnapshotOutput struct {
// Contains the details for an Amazon RDS DB cluster snapshot This data type is
// used as a response element in the DescribeDBClusterSnapshots action.
DBClusterSnapshot *types.DBClusterSnapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCopyDBClusterSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCopyDBClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCopyDBClusterSnapshot{}, 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 = addCopyDBClusterSnapshotPresignURLMiddleware(stack, options); err != nil {
return err
}
if err = addOpCopyDBClusterSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCopyDBClusterSnapshot(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 copyCopyDBClusterSnapshotInputForPresign(params interface{}) (interface{}, error) {
input, ok := params.(*CopyDBClusterSnapshotInput)
if !ok {
return nil, fmt.Errorf("expect *CopyDBClusterSnapshotInput type, got %T", params)
}
cpy := *input
return &cpy, nil
}
func getCopyDBClusterSnapshotPreSignedUrl(params interface{}) (string, bool, error) {
input, ok := params.(*CopyDBClusterSnapshotInput)
if !ok {
return ``, false, fmt.Errorf("expect *CopyDBClusterSnapshotInput type, got %T", params)
}
if input.PreSignedUrl == nil || len(*input.PreSignedUrl) == 0 {
return ``, false, nil
}
return *input.PreSignedUrl, true, nil
}
func getCopyDBClusterSnapshotSourceRegion(params interface{}) (string, bool, error) {
input, ok := params.(*CopyDBClusterSnapshotInput)
if !ok {
return ``, false, fmt.Errorf("expect *CopyDBClusterSnapshotInput type, got %T", params)
}
if input.SourceRegion == nil || len(*input.SourceRegion) == 0 {
return ``, false, nil
}
return *input.SourceRegion, true, nil
}
func setCopyDBClusterSnapshotPreSignedUrl(params interface{}, value string) error {
input, ok := params.(*CopyDBClusterSnapshotInput)
if !ok {
return fmt.Errorf("expect *CopyDBClusterSnapshotInput type, got %T", params)
}
input.PreSignedUrl = &value
return nil
}
func setCopyDBClusterSnapshotdestinationRegion(params interface{}, value string) error {
input, ok := params.(*CopyDBClusterSnapshotInput)
if !ok {
return fmt.Errorf("expect *CopyDBClusterSnapshotInput type, got %T", params)
}
input.destinationRegion = &value
return nil
}
func addCopyDBClusterSnapshotPresignURLMiddleware(stack *middleware.Stack, options Options) error {
return presignedurlcust.AddMiddleware(stack, presignedurlcust.Options{
Accessor: presignedurlcust.ParameterAccessor{
GetPresignedURL: getCopyDBClusterSnapshotPreSignedUrl,
GetSourceRegion: getCopyDBClusterSnapshotSourceRegion,
CopyInput: copyCopyDBClusterSnapshotInputForPresign,
SetDestinationRegion: setCopyDBClusterSnapshotdestinationRegion,
SetPresignedURL: setCopyDBClusterSnapshotPreSignedUrl,
},
Presigner: &presignAutoFillCopyDBClusterSnapshotClient{client: NewPresignClient(New(options))},
})
}
type presignAutoFillCopyDBClusterSnapshotClient struct {
client *PresignClient
}
// PresignURL is a middleware accessor that satisfies URLPresigner interface.
func (c *presignAutoFillCopyDBClusterSnapshotClient) PresignURL(ctx context.Context, srcRegion string, params interface{}) (*v4.PresignedHTTPRequest, error) {
input, ok := params.(*CopyDBClusterSnapshotInput)
if !ok {
return nil, fmt.Errorf("expect *CopyDBClusterSnapshotInput type, got %T", params)
}
optFn := func(o *Options) {
o.Region = srcRegion
o.APIOptions = append(o.APIOptions, presignedurlcust.RemoveMiddleware)
}
presignOptFn := WithPresignClientFromClientOptions(optFn)
return c.client.PresignCopyDBClusterSnapshot(ctx, input, presignOptFn)
}
func newServiceMetadataMiddleware_opCopyDBClusterSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CopyDBClusterSnapshot",
}
}
// PresignCopyDBClusterSnapshot is used to generate a presigned HTTP Request which
// contains presigned URL, signed headers and HTTP method used.
func (c *PresignClient) PresignCopyDBClusterSnapshot(ctx context.Context, params *CopyDBClusterSnapshotInput, optFns ...func(*PresignOptions)) (*v4.PresignedHTTPRequest, error) {
if params == nil {
params = &CopyDBClusterSnapshotInput{}
}
options := c.options.copy()
for _, fn := range optFns {
fn(&options)
}
clientOptFns := append(options.ClientOptions, withNopHTTPClientAPIOption)
result, _, err := c.client.invokeOperation(ctx, "CopyDBClusterSnapshot", params, clientOptFns,
c.client.addOperationCopyDBClusterSnapshotMiddlewares,
presignConverter(options).convertToPresignMiddleware,
)
if err != nil {
return nil, err
}
out := result.(*v4.PresignedHTTPRequest)
return out, nil
}
| 352 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awstesting/unit"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net/http"
"strings"
"testing"
)
func TestClientCopyDBClusterSnapshot_presignURLCustomization(t *testing.T) {
cases := map[string]struct {
Input *CopyDBClusterSnapshotInput
ClientRegion string
ExpectPresignedURL string
ExpectPresignedURLDestinationRegion string
ExpectRequestURL string
ExpectErr string
}{
"have presigned URL no auto fill": {
Input: &CopyDBClusterSnapshotInput{
PreSignedUrl: aws.String("https://example.aws/signed-url"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://example.aws/signed-url",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"no source region no auto fill": {
Input: &CopyDBClusterSnapshotInput{},
ClientRegion: "mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"auto fill presign URL matching region": {
Input: &CopyDBClusterSnapshotInput{
SourceRegion: aws.String("mock-region"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://service.mock-region.amazonaws.com/",
ExpectPresignedURLDestinationRegion: "DestinationRegion=mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"auto fill presign URL different region": {
Input: &CopyDBClusterSnapshotInput{
SourceRegion: aws.String("mock-other-region"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://service.mock-other-region.amazonaws.com/",
ExpectPresignedURLDestinationRegion: "DestinationRegion=mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
client := New(Options{
Region: c.ClientRegion,
Credentials: unit.StubCredentialsProvider{},
HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
if e, a := c.ExpectRequestURL, r.URL.String(); !strings.HasPrefix(a, e) {
t.Errorf("expect presigned URL to contain %v, got %v", e, a)
}
return smithyhttp.NopClient{}.Do(r)
}),
EndpointResolver: EndpointResolverFunc(
func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
return aws.Endpoint{
URL: "https://service." + region + ".amazonaws.com",
SigningRegion: c.ClientRegion,
}, nil
}),
})
_, err := client.CopyDBClusterSnapshot(context.Background(), c.Input,
func(o *Options) {
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) (err error) {
_, err = stack.Initialize.Remove("OperationInputValidation")
if err != nil {
return err
}
return stack.Serialize.Add(middleware.SerializeMiddlewareFunc(t.Name(),
func(
ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CopyDBClusterSnapshotInput)
if !ok {
t.Fatalf("expect CopyDBClusterSnapshotInput, got %T", in.Parameters)
}
// Switch based on if presign flow or not
if presignedurlcust.GetIsPresigning(ctx) {
// Presign Flow
if v := input.PreSignedUrl; v != nil {
t.Errorf("expect no presigned URL, got %v", *v)
}
if input.destinationRegion == nil {
t.Fatalf("expect destination region to be set")
}
if e, a := c.ClientRegion, *input.destinationRegion; e != a {
t.Errorf("expect %v destination region, got %v", e, a)
}
} else {
// Operation flow
if v := input.destinationRegion; v != nil {
t.Errorf("expect no destination region, got %v", *v)
}
if len(c.ExpectPresignedURL) != 0 {
if input.PreSignedUrl == nil {
t.Fatalf("expect presigned URL, got none")
}
if e, a := c.ExpectPresignedURL, *input.PreSignedUrl; !strings.HasPrefix(a, e) {
t.Errorf("expect presigned URL to contain %v, got %v", e, a)
}
if e, a := c.ExpectPresignedURLDestinationRegion, *input.PreSignedUrl; !strings.Contains(a, e) {
t.Errorf("expect presigned URL destination region to contain %v, got %v", e, a)
}
return next.HandleSerialize(ctx, in)
}
if v := input.PreSignedUrl; v != nil {
t.Errorf("expect no presigned url, got %v", *v)
}
}
return next.HandleSerialize(ctx, in)
},
), middleware.After)
})
},
)
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)
}
return
}
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
})
}
}
| 160 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Copies the specified DB parameter group.
func (c *Client) CopyDBParameterGroup(ctx context.Context, params *CopyDBParameterGroupInput, optFns ...func(*Options)) (*CopyDBParameterGroupOutput, error) {
if params == nil {
params = &CopyDBParameterGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CopyDBParameterGroup", params, optFns, c.addOperationCopyDBParameterGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CopyDBParameterGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CopyDBParameterGroupInput struct {
// The identifier or ARN for the source DB parameter group. For information about
// creating an ARN, see Constructing an ARN for Amazon RDS (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.ARN.html#USER_Tagging.ARN.Constructing)
// in the Amazon RDS User Guide. Constraints:
// - Must specify a valid DB parameter group.
//
// This member is required.
SourceDBParameterGroupIdentifier *string
// A description for the copied DB parameter group.
//
// This member is required.
TargetDBParameterGroupDescription *string
// The identifier for the copied DB parameter group. Constraints:
// - Can't be null, empty, or blank
// - Must contain from 1 to 255 letters, numbers, or hyphens
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// Example: my-db-parameter-group
//
// This member is required.
TargetDBParameterGroupIdentifier *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
noSmithyDocumentSerde
}
type CopyDBParameterGroupOutput struct {
// Contains the details of an Amazon RDS DB parameter group. This data type is
// used as a response element in the DescribeDBParameterGroups action.
DBParameterGroup *types.DBParameterGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCopyDBParameterGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCopyDBParameterGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCopyDBParameterGroup{}, 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 = addOpCopyDBParameterGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCopyDBParameterGroup(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_opCopyDBParameterGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CopyDBParameterGroup",
}
}
| 148 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
"github.com/aws/aws-sdk-go-v2/service/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Copies the specified DB snapshot. The source DB snapshot must be in the
// available state. You can copy a snapshot from one Amazon Web Services Region to
// another. In that case, the Amazon Web Services Region where you call the
// CopyDBSnapshot operation is the destination Amazon Web Services Region for the
// DB snapshot copy. This command doesn't apply to RDS Custom. For more information
// about copying snapshots, see Copying a DB Snapshot (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CopySnapshot.html#USER_CopyDBSnapshot)
// in the Amazon RDS User Guide.
func (c *Client) CopyDBSnapshot(ctx context.Context, params *CopyDBSnapshotInput, optFns ...func(*Options)) (*CopyDBSnapshotOutput, error) {
if params == nil {
params = &CopyDBSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CopyDBSnapshot", params, optFns, c.addOperationCopyDBSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CopyDBSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type CopyDBSnapshotInput struct {
// The identifier for the source DB snapshot. If the source snapshot is in the
// same Amazon Web Services Region as the copy, specify a valid DB snapshot
// identifier. For example, you might specify rds:mysql-instance1-snapshot-20130805
// . If the source snapshot is in a different Amazon Web Services Region than the
// copy, specify a valid DB snapshot ARN. For example, you might specify
// arn:aws:rds:us-west-2:123456789012:snapshot:mysql-instance1-snapshot-20130805 .
// If you are copying from a shared manual DB snapshot, this parameter must be the
// Amazon Resource Name (ARN) of the shared DB snapshot. If you are copying an
// encrypted snapshot this parameter must be in the ARN format for the source
// Amazon Web Services Region. Constraints:
// - Must specify a valid system snapshot in the "available" state.
// Example: rds:mydb-2012-04-02-00-01 Example:
// arn:aws:rds:us-west-2:123456789012:snapshot:mysql-instance1-snapshot-20130805
//
// This member is required.
SourceDBSnapshotIdentifier *string
// The identifier for the copy of the snapshot. Constraints:
// - Can't be null, empty, or blank
// - Must contain from 1 to 255 letters, numbers, or hyphens
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// Example: my-db-snapshot
//
// This member is required.
TargetDBSnapshotIdentifier *string
// A value that indicates whether to copy the DB option group associated with the
// source DB snapshot to the target Amazon Web Services account and associate with
// the target DB snapshot. The associated option group can be copied only with
// cross-account snapshot copy calls.
CopyOptionGroup *bool
// A value that indicates whether to copy all tags from the source DB snapshot to
// the target DB snapshot. By default, tags aren't copied.
CopyTags *bool
// The Amazon Web Services KMS key identifier for an encrypted DB snapshot. The
// Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or
// alias name for the KMS key. If you copy an encrypted DB snapshot from your
// Amazon Web Services account, you can specify a value for this parameter to
// encrypt the copy with a new KMS key. If you don't specify a value for this
// parameter, then the copy of the DB snapshot is encrypted with the same Amazon
// Web Services KMS key as the source DB snapshot. If you copy an encrypted DB
// snapshot that is shared from another Amazon Web Services account, then you must
// specify a value for this parameter. If you specify this parameter when you copy
// an unencrypted snapshot, the copy is encrypted. If you copy an encrypted
// snapshot to a different Amazon Web Services Region, then you must specify an
// Amazon Web Services KMS key identifier for the destination Amazon Web Services
// Region. KMS keys are specific to the Amazon Web Services Region that they are
// created in, and you can't use KMS keys from one Amazon Web Services Region in
// another Amazon Web Services Region.
KmsKeyId *string
// The name of an option group to associate with the copy of the snapshot. Specify
// this option if you are copying a snapshot from one Amazon Web Services Region to
// another, and your DB instance uses a nondefault option group. If your source DB
// instance uses Transparent Data Encryption for Oracle or Microsoft SQL Server,
// you must specify this option when copying across Amazon Web Services Regions.
// For more information, see Option group considerations (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CopySnapshot.html#USER_CopySnapshot.Options)
// in the Amazon RDS User Guide.
OptionGroupName *string
// When you are copying a snapshot from one Amazon Web Services GovCloud (US)
// Region to another, the URL that contains a Signature Version 4 signed request
// for the CopyDBSnapshot API operation in the source Amazon Web Services Region
// that contains the source DB snapshot to copy. This setting applies only to
// Amazon Web Services GovCloud (US) Regions. It's ignored in other Amazon Web
// Services Regions. You must specify this parameter when you copy an encrypted DB
// snapshot from another Amazon Web Services Region by using the Amazon RDS API.
// Don't specify PreSignedUrl when you are copying an encrypted DB snapshot in the
// same Amazon Web Services Region. The presigned URL must be a valid request for
// the CopyDBClusterSnapshot API operation that can run in the source Amazon Web
// Services Region that contains the encrypted DB cluster snapshot to copy. The
// presigned URL request must contain the following parameter values:
// - DestinationRegion - The Amazon Web Services Region that the encrypted DB
// snapshot is copied to. This Amazon Web Services Region is the same one where the
// CopyDBSnapshot operation is called that contains this presigned URL. For
// example, if you copy an encrypted DB snapshot from the us-west-2 Amazon Web
// Services Region to the us-east-1 Amazon Web Services Region, then you call the
// CopyDBSnapshot operation in the us-east-1 Amazon Web Services Region and
// provide a presigned URL that contains a call to the CopyDBSnapshot operation
// in the us-west-2 Amazon Web Services Region. For this example, the
// DestinationRegion in the presigned URL must be set to the us-east-1 Amazon Web
// Services Region.
// - KmsKeyId - The KMS key identifier for the KMS key to use to encrypt the copy
// of the DB snapshot in the destination Amazon Web Services Region. This is the
// same identifier for both the CopyDBSnapshot operation that is called in the
// destination Amazon Web Services Region, and the operation contained in the
// presigned URL.
// - SourceDBSnapshotIdentifier - The DB snapshot identifier for the encrypted
// snapshot to be copied. This identifier must be in the Amazon Resource Name (ARN)
// format for the source Amazon Web Services Region. For example, if you are
// copying an encrypted DB snapshot from the us-west-2 Amazon Web Services Region,
// then your SourceDBSnapshotIdentifier looks like the following example:
// arn:aws:rds:us-west-2:123456789012:snapshot:mysql-instance1-snapshot-20161115
// .
// To learn how to generate a Signature Version 4 signed request, see
// Authenticating Requests: Using Query Parameters (Amazon Web Services Signature
// Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html)
// and Signature Version 4 Signing Process (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)
// . If you are using an Amazon Web Services SDK tool or the CLI, you can specify
// SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl
// manually. Specifying SourceRegion autogenerates a presigned URL that is a valid
// request for the operation that can run in the source Amazon Web Services Region.
PreSignedUrl *string
// The AWS region the resource is in. The presigned URL will be created with this
// region, if the PresignURL member is empty set.
SourceRegion *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
// The external custom Availability Zone (CAZ) identifier for the target CAZ.
// Example: rds-caz-aiqhTgQv .
TargetCustomAvailabilityZone *string
// Used by the SDK's PresignURL autofill customization to specify the region the
// of the client's request.
destinationRegion *string
noSmithyDocumentSerde
}
type CopyDBSnapshotOutput struct {
// Contains the details of an Amazon RDS DB snapshot. This data type is used as a
// response element in the DescribeDBSnapshots action.
DBSnapshot *types.DBSnapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCopyDBSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCopyDBSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCopyDBSnapshot{}, 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 = addCopyDBSnapshotPresignURLMiddleware(stack, options); err != nil {
return err
}
if err = addOpCopyDBSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCopyDBSnapshot(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 copyCopyDBSnapshotInputForPresign(params interface{}) (interface{}, error) {
input, ok := params.(*CopyDBSnapshotInput)
if !ok {
return nil, fmt.Errorf("expect *CopyDBSnapshotInput type, got %T", params)
}
cpy := *input
return &cpy, nil
}
func getCopyDBSnapshotPreSignedUrl(params interface{}) (string, bool, error) {
input, ok := params.(*CopyDBSnapshotInput)
if !ok {
return ``, false, fmt.Errorf("expect *CopyDBSnapshotInput type, got %T", params)
}
if input.PreSignedUrl == nil || len(*input.PreSignedUrl) == 0 {
return ``, false, nil
}
return *input.PreSignedUrl, true, nil
}
func getCopyDBSnapshotSourceRegion(params interface{}) (string, bool, error) {
input, ok := params.(*CopyDBSnapshotInput)
if !ok {
return ``, false, fmt.Errorf("expect *CopyDBSnapshotInput type, got %T", params)
}
if input.SourceRegion == nil || len(*input.SourceRegion) == 0 {
return ``, false, nil
}
return *input.SourceRegion, true, nil
}
func setCopyDBSnapshotPreSignedUrl(params interface{}, value string) error {
input, ok := params.(*CopyDBSnapshotInput)
if !ok {
return fmt.Errorf("expect *CopyDBSnapshotInput type, got %T", params)
}
input.PreSignedUrl = &value
return nil
}
func setCopyDBSnapshotdestinationRegion(params interface{}, value string) error {
input, ok := params.(*CopyDBSnapshotInput)
if !ok {
return fmt.Errorf("expect *CopyDBSnapshotInput type, got %T", params)
}
input.destinationRegion = &value
return nil
}
func addCopyDBSnapshotPresignURLMiddleware(stack *middleware.Stack, options Options) error {
return presignedurlcust.AddMiddleware(stack, presignedurlcust.Options{
Accessor: presignedurlcust.ParameterAccessor{
GetPresignedURL: getCopyDBSnapshotPreSignedUrl,
GetSourceRegion: getCopyDBSnapshotSourceRegion,
CopyInput: copyCopyDBSnapshotInputForPresign,
SetDestinationRegion: setCopyDBSnapshotdestinationRegion,
SetPresignedURL: setCopyDBSnapshotPreSignedUrl,
},
Presigner: &presignAutoFillCopyDBSnapshotClient{client: NewPresignClient(New(options))},
})
}
type presignAutoFillCopyDBSnapshotClient struct {
client *PresignClient
}
// PresignURL is a middleware accessor that satisfies URLPresigner interface.
func (c *presignAutoFillCopyDBSnapshotClient) PresignURL(ctx context.Context, srcRegion string, params interface{}) (*v4.PresignedHTTPRequest, error) {
input, ok := params.(*CopyDBSnapshotInput)
if !ok {
return nil, fmt.Errorf("expect *CopyDBSnapshotInput type, got %T", params)
}
optFn := func(o *Options) {
o.Region = srcRegion
o.APIOptions = append(o.APIOptions, presignedurlcust.RemoveMiddleware)
}
presignOptFn := WithPresignClientFromClientOptions(optFn)
return c.client.PresignCopyDBSnapshot(ctx, input, presignOptFn)
}
func newServiceMetadataMiddleware_opCopyDBSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CopyDBSnapshot",
}
}
// PresignCopyDBSnapshot is used to generate a presigned HTTP Request which
// contains presigned URL, signed headers and HTTP method used.
func (c *PresignClient) PresignCopyDBSnapshot(ctx context.Context, params *CopyDBSnapshotInput, optFns ...func(*PresignOptions)) (*v4.PresignedHTTPRequest, error) {
if params == nil {
params = &CopyDBSnapshotInput{}
}
options := c.options.copy()
for _, fn := range optFns {
fn(&options)
}
clientOptFns := append(options.ClientOptions, withNopHTTPClientAPIOption)
result, _, err := c.client.invokeOperation(ctx, "CopyDBSnapshot", params, clientOptFns,
c.client.addOperationCopyDBSnapshotMiddlewares,
presignConverter(options).convertToPresignMiddleware,
)
if err != nil {
return nil, err
}
out := result.(*v4.PresignedHTTPRequest)
return out, nil
}
| 358 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awstesting/unit"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net/http"
"strings"
"testing"
)
func TestClientCopyDBSnapshot_presignURLCustomization(t *testing.T) {
cases := map[string]struct {
Input *CopyDBSnapshotInput
ClientRegion string
ExpectPresignedURL string
ExpectPresignedURLDestinationRegion string
ExpectRequestURL string
ExpectErr string
}{
"have presigned URL no auto fill": {
Input: &CopyDBSnapshotInput{
PreSignedUrl: aws.String("https://example.aws/signed-url"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://example.aws/signed-url",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"no source region no auto fill": {
Input: &CopyDBSnapshotInput{},
ClientRegion: "mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"auto fill presign URL matching region": {
Input: &CopyDBSnapshotInput{
SourceRegion: aws.String("mock-region"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://service.mock-region.amazonaws.com/",
ExpectPresignedURLDestinationRegion: "DestinationRegion=mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"auto fill presign URL different region": {
Input: &CopyDBSnapshotInput{
SourceRegion: aws.String("mock-other-region"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://service.mock-other-region.amazonaws.com/",
ExpectPresignedURLDestinationRegion: "DestinationRegion=mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
client := New(Options{
Region: c.ClientRegion,
Credentials: unit.StubCredentialsProvider{},
HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
if e, a := c.ExpectRequestURL, r.URL.String(); !strings.HasPrefix(a, e) {
t.Errorf("expect presigned URL to contain %v, got %v", e, a)
}
return smithyhttp.NopClient{}.Do(r)
}),
EndpointResolver: EndpointResolverFunc(
func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
return aws.Endpoint{
URL: "https://service." + region + ".amazonaws.com",
SigningRegion: c.ClientRegion,
}, nil
}),
})
_, err := client.CopyDBSnapshot(context.Background(), c.Input,
func(o *Options) {
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) (err error) {
_, err = stack.Initialize.Remove("OperationInputValidation")
if err != nil {
return err
}
return stack.Serialize.Add(middleware.SerializeMiddlewareFunc(t.Name(),
func(
ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CopyDBSnapshotInput)
if !ok {
t.Fatalf("expect CopyDBSnapshotInput, got %T", in.Parameters)
}
// Switch based on if presign flow or not
if presignedurlcust.GetIsPresigning(ctx) {
// Presign Flow
if v := input.PreSignedUrl; v != nil {
t.Errorf("expect no presigned URL, got %v", *v)
}
if input.destinationRegion == nil {
t.Fatalf("expect destination region to be set")
}
if e, a := c.ClientRegion, *input.destinationRegion; e != a {
t.Errorf("expect %v destination region, got %v", e, a)
}
} else {
// Operation flow
if v := input.destinationRegion; v != nil {
t.Errorf("expect no destination region, got %v", *v)
}
if len(c.ExpectPresignedURL) != 0 {
if input.PreSignedUrl == nil {
t.Fatalf("expect presigned URL, got none")
}
if e, a := c.ExpectPresignedURL, *input.PreSignedUrl; !strings.HasPrefix(a, e) {
t.Errorf("expect presigned URL to contain %v, got %v", e, a)
}
if e, a := c.ExpectPresignedURLDestinationRegion, *input.PreSignedUrl; !strings.Contains(a, e) {
t.Errorf("expect presigned URL destination region to contain %v, got %v", e, a)
}
return next.HandleSerialize(ctx, in)
}
if v := input.PreSignedUrl; v != nil {
t.Errorf("expect no presigned url, got %v", *v)
}
}
return next.HandleSerialize(ctx, in)
},
), middleware.After)
})
},
)
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)
}
return
}
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
})
}
}
| 160 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Copies the specified option group.
func (c *Client) CopyOptionGroup(ctx context.Context, params *CopyOptionGroupInput, optFns ...func(*Options)) (*CopyOptionGroupOutput, error) {
if params == nil {
params = &CopyOptionGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CopyOptionGroup", params, optFns, c.addOperationCopyOptionGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CopyOptionGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CopyOptionGroupInput struct {
// The identifier for the source option group. Constraints:
// - Must specify a valid option group.
//
// This member is required.
SourceOptionGroupIdentifier *string
// The description for the copied option group.
//
// This member is required.
TargetOptionGroupDescription *string
// The identifier for the copied option group. Constraints:
// - Can't be null, empty, or blank
// - Must contain from 1 to 255 letters, numbers, or hyphens
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// Example: my-option-group
//
// This member is required.
TargetOptionGroupIdentifier *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
noSmithyDocumentSerde
}
type CopyOptionGroupOutput struct {
//
OptionGroup *types.OptionGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCopyOptionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCopyOptionGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCopyOptionGroup{}, 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 = addOpCopyOptionGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCopyOptionGroup(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_opCopyOptionGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CopyOptionGroup",
}
}
| 145 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a blue/green deployment. A blue/green deployment creates a staging
// environment that copies the production environment. In a blue/green deployment,
// the blue environment is the current production environment. The green
// environment is the staging environment. The staging environment stays in sync
// with the current production environment using logical replication. You can make
// changes to the databases in the green environment without affecting production
// workloads. For example, you can upgrade the major or minor DB engine version,
// change database parameters, or make schema changes in the staging environment.
// You can thoroughly test changes in the green environment. When ready, you can
// switch over the environments to promote the green environment to be the new
// production environment. The switchover typically takes under a minute. For more
// information, see Using Amazon RDS Blue/Green Deployments for database updates (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html)
// in the Amazon RDS User Guide and Using Amazon RDS Blue/Green Deployments for
// database updates (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html)
// in the Amazon Aurora User Guide.
func (c *Client) CreateBlueGreenDeployment(ctx context.Context, params *CreateBlueGreenDeploymentInput, optFns ...func(*Options)) (*CreateBlueGreenDeploymentOutput, error) {
if params == nil {
params = &CreateBlueGreenDeploymentInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateBlueGreenDeployment", params, optFns, c.addOperationCreateBlueGreenDeploymentMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateBlueGreenDeploymentOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateBlueGreenDeploymentInput struct {
// The name of the blue/green deployment. Constraints:
// - Can't be the same as an existing blue/green deployment name in the same
// account and Amazon Web Services Region.
//
// This member is required.
BlueGreenDeploymentName *string
// The Amazon Resource Name (ARN) of the source production database. Specify the
// database that you want to clone. The blue/green deployment creates this database
// in the green environment. You can make updates to the database in the green
// environment, such as an engine version upgrade. When you are ready, you can
// switch the database in the green environment to be the production database.
//
// This member is required.
Source *string
// Tags to assign to the blue/green deployment.
Tags []types.Tag
// The DB cluster parameter group associated with the Aurora DB cluster in the
// green environment. To test parameter changes, specify a DB cluster parameter
// group that is different from the one associated with the source DB cluster.
TargetDBClusterParameterGroupName *string
// The DB parameter group associated with the DB instance in the green
// environment. To test parameter changes, specify a DB parameter group that is
// different from the one associated with the source DB instance.
TargetDBParameterGroupName *string
// The engine version of the database in the green environment. Specify the engine
// version to upgrade to in the green environment.
TargetEngineVersion *string
noSmithyDocumentSerde
}
type CreateBlueGreenDeploymentOutput struct {
// Contains the details about a blue/green deployment. For more information, see
// Using Amazon RDS Blue/Green Deployments for database updates (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html)
// in the Amazon RDS User Guide and Using Amazon RDS Blue/Green Deployments for
// database updates (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html)
// in the Amazon Aurora User Guide.
BlueGreenDeployment *types.BlueGreenDeployment
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateBlueGreenDeploymentMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateBlueGreenDeployment{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateBlueGreenDeployment{}, 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 = addOpCreateBlueGreenDeploymentValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateBlueGreenDeployment(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_opCreateBlueGreenDeployment(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateBlueGreenDeployment",
}
}
| 171 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Creates a custom DB engine version (CEV).
func (c *Client) CreateCustomDBEngineVersion(ctx context.Context, params *CreateCustomDBEngineVersionInput, optFns ...func(*Options)) (*CreateCustomDBEngineVersionOutput, error) {
if params == nil {
params = &CreateCustomDBEngineVersionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateCustomDBEngineVersion", params, optFns, c.addOperationCreateCustomDBEngineVersionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateCustomDBEngineVersionOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateCustomDBEngineVersionInput struct {
// The database engine to use for your custom engine version (CEV). The only
// supported value is custom-oracle-ee .
//
// This member is required.
Engine *string
// The name of your CEV. The name format is 19.customized_string. For example, a
// valid CEV name is 19.my_cev1 . This setting is required for RDS Custom for
// Oracle, but optional for Amazon RDS. The combination of Engine and EngineVersion
// is unique per customer per Region.
//
// This member is required.
EngineVersion *string
// The name of an Amazon S3 bucket that contains database installation files for
// your CEV. For example, a valid bucket name is my-custom-installation-files .
DatabaseInstallationFilesS3BucketName *string
// The Amazon S3 directory that contains the database installation files for your
// CEV. For example, a valid bucket name is 123456789012/cev1 . If this setting
// isn't specified, no prefix is assumed.
DatabaseInstallationFilesS3Prefix *string
// An optional description of your CEV.
Description *string
// The ID of the Amazon Machine Image (AMI). For RDS Custom for SQL Server, an AMI
// ID is required to create a CEV. For RDS Custom for Oracle, the default is the
// most recent AMI available, but you can specify an AMI ID that was used in a
// different Oracle CEV. Find the AMIs used by your CEVs by calling the
// DescribeDBEngineVersions (https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBEngineVersions.html)
// operation.
ImageId *string
// The Amazon Web Services KMS key identifier for an encrypted CEV. A symmetric
// encryption KMS key is required for RDS Custom, but optional for Amazon RDS. If
// you have an existing symmetric encryption KMS key in your account, you can use
// it with RDS Custom. No further action is necessary. If you don't already have a
// symmetric encryption KMS key in your account, follow the instructions in
// Creating a symmetric encryption KMS key (https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#create-symmetric-cmk)
// in the Amazon Web Services Key Management Service Developer Guide. You can
// choose the same symmetric encryption key when you create a CEV and a DB
// instance, or choose different keys.
KMSKeyId *string
// The CEV manifest, which is a JSON document that describes the installation .zip
// files stored in Amazon S3. Specify the name/value pairs in a file or a quoted
// string. RDS Custom applies the patches in the order in which they are listed.
// The following JSON fields are valid: MediaImportTemplateVersion Version of the
// CEV manifest. The date is in the format YYYY-MM-DD .
// databaseInstallationFileNames Ordered list of installation files for the CEV.
// opatchFileNames Ordered list of OPatch installers used for the Oracle DB engine.
// psuRuPatchFileNames The PSU and RU patches for this CEV. OtherPatchFileNames The
// patches that are not in the list of PSU and RU patches. Amazon RDS applies these
// patches after applying the PSU and RU patches. For more information, see
// Creating the CEV manifest (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-cev.html#custom-cev.preparing.manifest)
// in the Amazon RDS User Guide.
Manifest *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
noSmithyDocumentSerde
}
// This data type is used as a response element in the action
// DescribeDBEngineVersions .
type CreateCustomDBEngineVersionOutput struct {
// The creation time of the DB engine version.
CreateTime *time.Time
// JSON string that lists the installation files and parameters that RDS Custom
// uses to create a custom engine version (CEV). RDS Custom applies the patches in
// the order in which they're listed in the manifest. You can set the Oracle home,
// Oracle base, and UNIX/Linux user and group using the installation parameters.
// For more information, see JSON fields in the CEV manifest (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-cev.preparing.html#custom-cev.preparing.manifest.fields)
// in the Amazon RDS User Guide.
CustomDBEngineVersionManifest *string
// The description of the database engine.
DBEngineDescription *string
// A value that indicates the source media provider of the AMI based on the usage
// operation. Applicable for RDS Custom for SQL Server.
DBEngineMediaType *string
// The ARN of the custom engine version.
DBEngineVersionArn *string
// The description of the database engine version.
DBEngineVersionDescription *string
// The name of the DB parameter group family for the database engine.
DBParameterGroupFamily *string
// The name of the Amazon S3 bucket that contains your database installation files.
DatabaseInstallationFilesS3BucketName *string
// The Amazon S3 directory that contains the database installation files. If not
// specified, then no prefix is assumed.
DatabaseInstallationFilesS3Prefix *string
// The default character set for new instances of this engine version, if the
// CharacterSetName parameter of the CreateDBInstance API isn't specified.
DefaultCharacterSet *types.CharacterSet
// The name of the database engine.
Engine *string
// The version number of the database engine.
EngineVersion *string
// The types of logs that the database engine has available for export to
// CloudWatch Logs.
ExportableLogTypes []string
// The EC2 image
Image *types.CustomDBEngineVersionAMI
// The Amazon Web Services KMS key identifier for an encrypted CEV. This parameter
// is required for RDS Custom, but optional for Amazon RDS.
KMSKeyId *string
// The major engine version of the CEV.
MajorEngineVersion *string
// The status of the DB engine version, either available or deprecated .
Status *string
// A list of the supported CA certificate identifiers. For more information, see
// Using SSL/TLS to encrypt a connection to a DB instance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html)
// in the Amazon RDS User Guide and Using SSL/TLS to encrypt a connection to a DB
// cluster (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.SSL.html)
// in the Amazon Aurora User Guide.
SupportedCACertificateIdentifiers []string
// A list of the character sets supported by this engine for the CharacterSetName
// parameter of the CreateDBInstance operation.
SupportedCharacterSets []types.CharacterSet
// A list of the supported DB engine modes.
SupportedEngineModes []string
// A list of features supported by the DB engine. The supported features vary by
// DB engine and DB engine version. To determine the supported features for a
// specific DB engine and DB engine version using the CLI, use the following
// command: aws rds describe-db-engine-versions --engine --engine-version For
// example, to determine the supported features for RDS for PostgreSQL version 13.3
// using the CLI, use the following command: aws rds describe-db-engine-versions
// --engine postgres --engine-version 13.3 The supported features are listed under
// SupportedFeatureNames in the output.
SupportedFeatureNames []string
// A list of the character sets supported by the Oracle DB engine for the
// NcharCharacterSetName parameter of the CreateDBInstance operation.
SupportedNcharCharacterSets []types.CharacterSet
// A list of the time zones supported by this engine for the Timezone parameter of
// the CreateDBInstance action.
SupportedTimezones []types.Timezone
// A value that indicates whether the engine version supports Babelfish for Aurora
// PostgreSQL.
SupportsBabelfish bool
// A value that indicates whether the engine version supports rotating the server
// certificate without rebooting the DB instance.
SupportsCertificateRotationWithoutRestart *bool
// A value that indicates whether you can use Aurora global databases with a
// specific DB engine version.
SupportsGlobalDatabases bool
// A value that indicates whether the engine version supports exporting the log
// types specified by ExportableLogTypes to CloudWatch Logs.
SupportsLogExportsToCloudwatchLogs bool
// A value that indicates whether you can use Aurora parallel query with a
// specific DB engine version.
SupportsParallelQuery bool
// Indicates whether the database engine version supports read replicas.
SupportsReadReplica bool
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
TagList []types.Tag
// A list of engine versions that this database engine version can be upgraded to.
ValidUpgradeTarget []types.UpgradeTarget
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateCustomDBEngineVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateCustomDBEngineVersion{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateCustomDBEngineVersion{}, 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 = addOpCreateCustomDBEngineVersionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateCustomDBEngineVersion(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_opCreateCustomDBEngineVersion(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateCustomDBEngineVersion",
}
}
| 306 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
"github.com/aws/aws-sdk-go-v2/service/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new Amazon Aurora DB cluster or Multi-AZ DB cluster. If you create an
// Aurora DB cluster, the request creates an empty cluster. You must explicitly
// create the writer instance for your DB cluster using the CreateDBInstance (https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html)
// operation. If you create a Multi-AZ DB cluster, the request creates a writer and
// two reader DB instances for you, each in a different Availability Zone. You can
// use the ReplicationSourceIdentifier parameter to create an Amazon Aurora DB
// cluster as a read replica of another DB cluster or Amazon RDS for MySQL or
// PostgreSQL DB instance. For more information about Amazon Aurora, see What is
// Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. You can also use the
// ReplicationSourceIdentifier parameter to create a Multi-AZ DB cluster read
// replica with an RDS for MySQL or PostgreSQL DB instance as the source. For more
// information about Multi-AZ DB clusters, see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) CreateDBCluster(ctx context.Context, params *CreateDBClusterInput, optFns ...func(*Options)) (*CreateDBClusterOutput, error) {
if params == nil {
params = &CreateDBClusterInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBCluster", params, optFns, c.addOperationCreateDBClusterMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBClusterOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBClusterInput struct {
// The identifier for this DB cluster. This parameter is stored as a lowercase
// string. Valid for Cluster Type: Aurora DB clusters and Multi-AZ DB clusters
// Constraints:
// - Must contain from 1 to 63 letters, numbers, or hyphens.
// - First character must be a letter.
// - Can't end with a hyphen or contain two consecutive hyphens.
// Example: my-cluster1
//
// This member is required.
DBClusterIdentifier *string
// The database engine to use for this DB cluster. Valid for Cluster Type: Aurora
// DB clusters and Multi-AZ DB clusters Valid Values: aurora-mysql |
// aurora-postgresql | mysql | postgres
//
// This member is required.
Engine *string
// The amount of storage in gibibytes (GiB) to allocate to each DB instance in the
// Multi-AZ DB cluster. Valid for Cluster Type: Multi-AZ DB clusters only This
// setting is required to create a Multi-AZ DB cluster.
AllocatedStorage *int32
// Specifies whether minor engine upgrades are applied automatically to the DB
// cluster during the maintenance window. By default, minor engine upgrades are
// applied automatically. Valid for Cluster Type: Multi-AZ DB clusters only
AutoMinorVersionUpgrade *bool
// A list of Availability Zones (AZs) where DB instances in the DB cluster can be
// created. For information on Amazon Web Services Regions and Availability Zones,
// see Choosing the Regions and Availability Zones (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.RegionsAndAvailabilityZones.html)
// in the Amazon Aurora User Guide. Valid for Cluster Type: Aurora DB clusters only
AvailabilityZones []string
// The target backtrack window, in seconds. To disable backtracking, set this
// value to 0 . Valid for Cluster Type: Aurora MySQL DB clusters only Default: 0
// Constraints:
// - If specified, this value must be set to a number from 0 to 259,200 (72
// hours).
BacktrackWindow *int64
// The number of days for which automated backups are retained. Valid for Cluster
// Type: Aurora DB clusters and Multi-AZ DB clusters Default: 1 Constraints:
// - Must be a value from 1 to 35.
BackupRetentionPeriod *int32
// The name of the character set ( CharacterSet ) to associate the DB cluster with.
// Valid for Cluster Type: Aurora DB clusters only
CharacterSetName *string
// Specifies whether to copy all tags from the DB cluster to snapshots of the DB
// cluster. The default is not to copy them. Valid for Cluster Type: Aurora DB
// clusters and Multi-AZ DB clusters
CopyTagsToSnapshot *bool
// The compute and memory capacity of each DB instance in the Multi-AZ DB cluster,
// for example db.m6gd.xlarge . Not all DB instance classes are available in all
// Amazon Web Services Regions, or for all database engines. For the full list of
// DB instance classes and availability for your engine, see DB instance class (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html)
// in the Amazon RDS User Guide. This setting is required to create a Multi-AZ DB
// cluster. Valid for Cluster Type: Multi-AZ DB clusters only
DBClusterInstanceClass *string
// The name of the DB cluster parameter group to associate with this DB cluster.
// If you don't specify a value, then the default DB cluster parameter group for
// the specified DB engine and version is used. Valid for Cluster Type: Aurora DB
// clusters and Multi-AZ DB clusters Constraints:
// - If supplied, must match the name of an existing DB cluster parameter group.
DBClusterParameterGroupName *string
// A DB subnet group to associate with this DB cluster. This setting is required
// to create a Multi-AZ DB cluster. Valid for Cluster Type: Aurora DB clusters and
// Multi-AZ DB clusters Constraints:
// - Must match the name of an existing DB subnet group.
// - Must not be default .
// Example: mydbsubnetgroup
DBSubnetGroupName *string
// Reserved for future use.
DBSystemId *string
// The name for your database of up to 64 alphanumeric characters. If you don't
// provide a name, Amazon RDS doesn't create a database in the DB cluster you are
// creating. Valid for Cluster Type: Aurora DB clusters and Multi-AZ DB clusters
DatabaseName *string
// Specifies whether the DB cluster has deletion protection enabled. The database
// can't be deleted when deletion protection is enabled. By default, deletion
// protection isn't enabled. Valid for Cluster Type: Aurora DB clusters and
// Multi-AZ DB clusters
DeletionProtection *bool
// The Active Directory directory ID to create the DB cluster in. For Amazon
// Aurora DB clusters, Amazon RDS can use Kerberos authentication to authenticate
// users that connect to the DB cluster. For more information, see Kerberos
// authentication (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/kerberos-authentication.html)
// in the Amazon Aurora User Guide. Valid for Cluster Type: Aurora DB clusters only
Domain *string
// The name of the IAM role to use when making API calls to the Directory Service.
// Valid for Cluster Type: Aurora DB clusters only
DomainIAMRoleName *string
// The list of log types that need to be enabled for exporting to CloudWatch Logs.
// Valid for Cluster Type: Aurora DB clusters and Multi-AZ DB clusters The
// following values are valid for each DB engine:
// - Aurora MySQL - audit | error | general | slowquery
// - Aurora PostgreSQL - postgresql
// - RDS for MySQL - error | general | slowquery
// - RDS for PostgreSQL - postgresql | upgrade
// For more information about exporting CloudWatch Logs for Amazon RDS, see
// Publishing Database Logs to Amazon CloudWatch Logs (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch)
// in the Amazon RDS User Guide. For more information about exporting CloudWatch
// Logs for Amazon Aurora, see Publishing Database Logs to Amazon CloudWatch Logs (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch)
// in the Amazon Aurora User Guide.
EnableCloudwatchLogsExports []string
// Specifies whether to enable this DB cluster to forward write operations to the
// primary cluster of a global cluster (Aurora global database). By default, write
// operations are not allowed on Aurora DB clusters that are secondary clusters in
// an Aurora global database. You can set this value only on Aurora DB clusters
// that are members of an Aurora global database. With this parameter enabled, a
// secondary cluster can forward writes to the current primary cluster, and the
// resulting changes are replicated back to this cluster. For the primary DB
// cluster of an Aurora global database, this value is used immediately if the
// primary is demoted by a global cluster API operation, but it does nothing until
// then. Valid for Cluster Type: Aurora DB clusters only
EnableGlobalWriteForwarding *bool
// Specifies whether to enable the HTTP endpoint for an Aurora Serverless v1 DB
// cluster. By default, the HTTP endpoint is disabled. When enabled, the HTTP
// endpoint provides a connectionless web service API for running SQL queries on
// the Aurora Serverless v1 DB cluster. You can also query your database from
// inside the RDS console with the query editor. For more information, see Using
// the Data API for Aurora Serverless v1 (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html)
// in the Amazon Aurora User Guide. Valid for Cluster Type: Aurora DB clusters only
EnableHttpEndpoint *bool
// Specifies whether to enable mapping of Amazon Web Services Identity and Access
// Management (IAM) accounts to database accounts. By default, mapping isn't
// enabled. For more information, see IAM Database Authentication (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.html)
// in the Amazon Aurora User Guide. Valid for Cluster Type: Aurora DB clusters only
EnableIAMDatabaseAuthentication *bool
// Specifies whether to turn on Performance Insights for the DB cluster. For more
// information, see Using Amazon Performance Insights (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html)
// in the Amazon RDS User Guide. Valid for Cluster Type: Multi-AZ DB clusters only
EnablePerformanceInsights *bool
// The DB engine mode of the DB cluster, either provisioned or serverless . The
// serverless engine mode only applies for Aurora Serverless v1 DB clusters. For
// information about limitations and requirements for Serverless DB clusters, see
// the following sections in the Amazon Aurora User Guide:
// - Limitations of Aurora Serverless v1 (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html#aurora-serverless.limitations)
// - Requirements for Aurora Serverless v2 (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.requirements.html)
// Valid for Cluster Type: Aurora DB clusters only
EngineMode *string
// The version number of the database engine to use. To list all of the available
// engine versions for Aurora MySQL version 2 (5.7-compatible) and version 3 (MySQL
// 8.0-compatible), use the following command: aws rds describe-db-engine-versions
// --engine aurora-mysql --query "DBEngineVersions[].EngineVersion" You can supply
// either 5.7 or 8.0 to use the default engine version for Aurora MySQL version 2
// or version 3, respectively. To list all of the available engine versions for
// Aurora PostgreSQL, use the following command: aws rds
// describe-db-engine-versions --engine aurora-postgresql --query
// "DBEngineVersions[].EngineVersion" To list all of the available engine versions
// for RDS for MySQL, use the following command: aws rds
// describe-db-engine-versions --engine mysql --query
// "DBEngineVersions[].EngineVersion" To list all of the available engine versions
// for RDS for PostgreSQL, use the following command: aws rds
// describe-db-engine-versions --engine postgres --query
// "DBEngineVersions[].EngineVersion" For information about a specific engine, see
// the following topics:
// - Aurora MySQL - see Database engine updates for Amazon Aurora MySQL (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Updates.html)
// in the Amazon Aurora User Guide.
// - Aurora PostgreSQL - see Amazon Aurora PostgreSQL releases and engine
// versions (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraPostgreSQL.Updates.20180305.html)
// in the Amazon Aurora User Guide.
// - RDS for MySQL - see Amazon RDS for MySQL (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.VersionMgmt)
// in the Amazon RDS User Guide.
// - RDS for PostgreSQL - see Amazon RDS for PostgreSQL (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts)
// in the Amazon RDS User Guide.
// Valid for Cluster Type: Aurora DB clusters and Multi-AZ DB clusters
EngineVersion *string
// The global cluster ID of an Aurora cluster that becomes the primary cluster in
// the new global database cluster. Valid for Cluster Type: Aurora DB clusters only
GlobalClusterIdentifier *string
// The amount of Provisioned IOPS (input/output operations per second) to be
// initially allocated for each DB instance in the Multi-AZ DB cluster. For
// information about valid IOPS values, see Provisioned IOPS storage (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS)
// in the Amazon RDS User Guide. This setting is required to create a Multi-AZ DB
// cluster. Valid for Cluster Type: Multi-AZ DB clusters only Constraints:
// - Must be a multiple between .5 and 50 of the storage amount for the DB
// cluster.
Iops *int32
// The Amazon Web Services KMS key identifier for an encrypted DB cluster. The
// Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or
// alias name for the KMS key. To use a KMS key in a different Amazon Web Services
// account, specify the key ARN or alias ARN. When a KMS key isn't specified in
// KmsKeyId :
// - If ReplicationSourceIdentifier identifies an encrypted source, then Amazon
// RDS uses the KMS key used to encrypt the source. Otherwise, Amazon RDS uses your
// default KMS key.
// - If the StorageEncrypted parameter is enabled and ReplicationSourceIdentifier
// isn't specified, then Amazon RDS uses your default KMS key.
// There is a default KMS key for your Amazon Web Services account. Your Amazon
// Web Services account has a different default KMS key for each Amazon Web
// Services Region. If you create a read replica of an encrypted DB cluster in
// another Amazon Web Services Region, make sure to set KmsKeyId to a KMS key
// identifier that is valid in the destination Amazon Web Services Region. This KMS
// key is used to encrypt the read replica in that Amazon Web Services Region.
// Valid for Cluster Type: Aurora DB clusters and Multi-AZ DB clusters
KmsKeyId *string
// Specifies whether to manage the master user password with Amazon Web Services
// Secrets Manager. For more information, see Password management with Amazon Web
// Services Secrets Manager (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-secrets-manager.html)
// in the Amazon RDS User Guide and Password management with Amazon Web Services
// Secrets Manager (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/rds-secrets-manager.html)
// in the Amazon Aurora User Guide. Valid for Cluster Type: Aurora DB clusters and
// Multi-AZ DB clusters Constraints:
// - Can't manage the master user password with Amazon Web Services Secrets
// Manager if MasterUserPassword is specified.
ManageMasterUserPassword *bool
// The password for the master database user. Valid for Cluster Type: Aurora DB
// clusters and Multi-AZ DB clusters Constraints:
// - Must contain from 8 to 41 characters.
// - Can contain any printable ASCII character except "/", """, or "@".
// - Can't be specified if ManageMasterUserPassword is turned on.
MasterUserPassword *string
// The Amazon Web Services KMS key identifier to encrypt a secret that is
// automatically generated and managed in Amazon Web Services Secrets Manager. This
// setting is valid only if the master user password is managed by RDS in Amazon
// Web Services Secrets Manager for the DB cluster. The Amazon Web Services KMS key
// identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key. To
// use a KMS key in a different Amazon Web Services account, specify the key ARN or
// alias ARN. If you don't specify MasterUserSecretKmsKeyId , then the
// aws/secretsmanager KMS key is used to encrypt the secret. If the secret is in a
// different Amazon Web Services account, then you can't use the aws/secretsmanager
// KMS key to encrypt the secret, and you must use a customer managed KMS key.
// There is a default KMS key for your Amazon Web Services account. Your Amazon Web
// Services account has a different default KMS key for each Amazon Web Services
// Region. Valid for Cluster Type: Aurora DB clusters and Multi-AZ DB clusters
MasterUserSecretKmsKeyId *string
// The name of the master user for the DB cluster. Valid for Cluster Type: Aurora
// DB clusters and Multi-AZ DB clusters Constraints:
// - Must be 1 to 16 letters or numbers.
// - First character must be a letter.
// - Can't be a reserved word for the chosen database engine.
MasterUsername *string
// The interval, in seconds, between points when Enhanced Monitoring metrics are
// collected for the DB cluster. To turn off collecting Enhanced Monitoring
// metrics, specify 0 . If MonitoringRoleArn is specified, also set
// MonitoringInterval to a value other than 0 . Valid for Cluster Type: Multi-AZ DB
// clusters only Valid Values: 0 | 1 | 5 | 10 | 15 | 30 | 60 Default: 0
MonitoringInterval *int32
// The Amazon Resource Name (ARN) for the IAM role that permits RDS to send
// Enhanced Monitoring metrics to Amazon CloudWatch Logs. An example is
// arn:aws:iam:123456789012:role/emaccess . For information on creating a
// monitoring role, see Setting up and enabling Enhanced Monitoring (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.Enabling)
// in the Amazon RDS User Guide. If MonitoringInterval is set to a value other
// than 0 , supply a MonitoringRoleArn value. Valid for Cluster Type: Multi-AZ DB
// clusters only
MonitoringRoleArn *string
// The network type of the DB cluster. The network type is determined by the
// DBSubnetGroup specified for the DB cluster. A DBSubnetGroup can support only
// the IPv4 protocol or the IPv4 and the IPv6 protocols ( DUAL ). For more
// information, see Working with a DB instance in a VPC (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html)
// in the Amazon Aurora User Guide. Valid for Cluster Type: Aurora DB clusters only
// Valid Values: IPV4 | DUAL
NetworkType *string
// The option group to associate the DB cluster with. DB clusters are associated
// with a default option group that can't be modified.
OptionGroupName *string
// The Amazon Web Services KMS key identifier for encryption of Performance
// Insights data. The Amazon Web Services KMS key identifier is the key ARN, key
// ID, alias ARN, or alias name for the KMS key. If you don't specify a value for
// PerformanceInsightsKMSKeyId , then Amazon RDS uses your default KMS key. There
// is a default KMS key for your Amazon Web Services account. Your Amazon Web
// Services account has a different default KMS key for each Amazon Web Services
// Region. Valid for Cluster Type: Multi-AZ DB clusters only
PerformanceInsightsKMSKeyId *string
// The number of days to retain Performance Insights data. Valid for Cluster Type:
// Multi-AZ DB clusters only Valid Values:
// - 7
// - month * 31, where month is a number of months from 1-23. Examples: 93 (3
// months * 31), 341 (11 months * 31), 589 (19 months * 31)
// - 731
// Default: 7 days If you specify a retention period that isn't valid, such as 94 ,
// Amazon RDS issues an error.
PerformanceInsightsRetentionPeriod *int32
// The port number on which the instances in the DB cluster accept connections.
// Valid for Cluster Type: Aurora DB clusters and Multi-AZ DB clusters Valid
// Values: 1150-65535 Default:
// - RDS for MySQL and Aurora MySQL - 3306
// - RDS for PostgreSQL and Aurora PostgreSQL - 5432
Port *int32
// When you are replicating a DB cluster from one Amazon Web Services GovCloud
// (US) Region to another, an URL that contains a Signature Version 4 signed
// request for the CreateDBCluster operation to be called in the source Amazon Web
// Services Region where the DB cluster is replicated from. Specify PreSignedUrl
// only when you are performing cross-Region replication from an encrypted DB
// cluster. The presigned URL must be a valid request for the CreateDBCluster API
// operation that can run in the source Amazon Web Services Region that contains
// the encrypted DB cluster to copy. The presigned URL request must contain the
// following parameter values:
// - KmsKeyId - The KMS key identifier for the KMS key to use to encrypt the copy
// of the DB cluster in the destination Amazon Web Services Region. This should
// refer to the same KMS key for both the CreateDBCluster operation that is
// called in the destination Amazon Web Services Region, and the operation
// contained in the presigned URL.
// - DestinationRegion - The name of the Amazon Web Services Region that Aurora
// read replica will be created in.
// - ReplicationSourceIdentifier - The DB cluster identifier for the encrypted DB
// cluster to be copied. This identifier must be in the Amazon Resource Name (ARN)
// format for the source Amazon Web Services Region. For example, if you are
// copying an encrypted DB cluster from the us-west-2 Amazon Web Services Region,
// then your ReplicationSourceIdentifier would look like Example:
// arn:aws:rds:us-west-2:123456789012:cluster:aurora-cluster1 .
// To learn how to generate a Signature Version 4 signed request, see
// Authenticating Requests: Using Query Parameters (Amazon Web Services Signature
// Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html)
// and Signature Version 4 Signing Process (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)
// . If you are using an Amazon Web Services SDK tool or the CLI, you can specify
// SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl
// manually. Specifying SourceRegion autogenerates a presigned URL that is a valid
// request for the operation that can run in the source Amazon Web Services Region.
// Valid for Cluster Type: Aurora DB clusters only
PreSignedUrl *string
// The daily time range during which automated backups are created if automated
// backups are enabled using the BackupRetentionPeriod parameter. Valid for
// Cluster Type: Aurora DB clusters and Multi-AZ DB clusters The default is a
// 30-minute window selected at random from an 8-hour block of time for each Amazon
// Web Services Region. To view the time blocks available, see Backup window (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Managing.Backups.html#Aurora.Managing.Backups.BackupWindow)
// in the Amazon Aurora User Guide. Constraints:
// - Must be in the format hh24:mi-hh24:mi .
// - Must be in Universal Coordinated Time (UTC).
// - Must not conflict with the preferred maintenance window.
// - Must be at least 30 minutes.
PreferredBackupWindow *string
// The weekly time range during which system maintenance can occur. Valid for
// Cluster Type: Aurora DB clusters and Multi-AZ DB clusters The default is a
// 30-minute window selected at random from an 8-hour block of time for each Amazon
// Web Services Region, occurring on a random day of the week. To see the time
// blocks available, see Adjusting the Preferred DB Cluster Maintenance Window (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow.Aurora)
// in the Amazon Aurora User Guide. Constraints:
// - Must be in the format ddd:hh24:mi-ddd:hh24:mi .
// - Days must be one of Mon | Tue | Wed | Thu | Fri | Sat | Sun .
// - Must be in Universal Coordinated Time (UTC).
// - Must be at least 30 minutes.
PreferredMaintenanceWindow *string
// Specifies whether the DB cluster is publicly accessible. When the DB cluster is
// publicly accessible, its Domain Name System (DNS) endpoint resolves to the
// private IP address from within the DB cluster's virtual private cloud (VPC). It
// resolves to the public IP address from outside of the DB cluster's VPC. Access
// to the DB cluster is ultimately controlled by the security group it uses. That
// public access isn't permitted if the security group assigned to the DB cluster
// doesn't permit it. When the DB cluster isn't publicly accessible, it is an
// internal DB cluster with a DNS name that resolves to a private IP address. Valid
// for Cluster Type: Multi-AZ DB clusters only Default: The default behavior varies
// depending on whether DBSubnetGroupName is specified. If DBSubnetGroupName isn't
// specified, and PubliclyAccessible isn't specified, the following applies:
// - If the default VPC in the target Region doesn’t have an internet gateway
// attached to it, the DB cluster is private.
// - If the default VPC in the target Region has an internet gateway attached to
// it, the DB cluster is public.
// If DBSubnetGroupName is specified, and PubliclyAccessible isn't specified, the
// following applies:
// - If the subnets are part of a VPC that doesn’t have an internet gateway
// attached to it, the DB cluster is private.
// - If the subnets are part of a VPC that has an internet gateway attached to
// it, the DB cluster is public.
PubliclyAccessible *bool
// The Amazon Resource Name (ARN) of the source DB instance or DB cluster if this
// DB cluster is created as a read replica. Valid for Cluster Type: Aurora DB
// clusters and Multi-AZ DB clusters
ReplicationSourceIdentifier *string
// For DB clusters in serverless DB engine mode, the scaling properties of the DB
// cluster. Valid for Cluster Type: Aurora DB clusters only
ScalingConfiguration *types.ScalingConfiguration
// Contains the scaling configuration of an Aurora Serverless v2 DB cluster. For
// more information, see Using Amazon Aurora Serverless v2 (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.html)
// in the Amazon Aurora User Guide.
ServerlessV2ScalingConfiguration *types.ServerlessV2ScalingConfiguration
// The AWS region the resource is in. The presigned URL will be created with this
// region, if the PresignURL member is empty set.
SourceRegion *string
// Specifies whether the DB cluster is encrypted. Valid for Cluster Type: Aurora
// DB clusters and Multi-AZ DB clusters
StorageEncrypted *bool
// The storage type to associate with the DB cluster. For information on storage
// types for Aurora DB clusters, see Storage configurations for Amazon Aurora DB
// clusters (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.StorageReliability.html#aurora-storage-type)
// . For information on storage types for Multi-AZ DB clusters, see Settings for
// creating Multi-AZ DB clusters (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/create-multi-az-db-cluster.html#create-multi-az-db-cluster-settings)
// . This setting is required to create a Multi-AZ DB cluster. When specified for a
// Multi-AZ DB cluster, a value for the Iops parameter is required. Valid for
// Cluster Type: Aurora DB clusters and Multi-AZ DB clusters Valid Values:
// - Aurora DB clusters - aurora | aurora-iopt1
// - Multi-AZ DB clusters - io1
// Default:
// - Aurora DB clusters - aurora
// - Multi-AZ DB clusters - io1
StorageType *string
// Tags to assign to the DB cluster. Valid for Cluster Type: Aurora DB clusters
// and Multi-AZ DB clusters
Tags []types.Tag
// A list of EC2 VPC security groups to associate with this DB cluster. Valid for
// Cluster Type: Aurora DB clusters and Multi-AZ DB clusters
VpcSecurityGroupIds []string
// Used by the SDK's PresignURL autofill customization to specify the region the
// of the client's request.
destinationRegion *string
noSmithyDocumentSerde
}
type CreateDBClusterOutput struct {
// Contains the details of an Amazon Aurora DB cluster or Multi-AZ DB cluster. For
// an Amazon Aurora DB cluster, this data type is used as a response element in the
// operations CreateDBCluster , DeleteDBCluster , DescribeDBClusters ,
// FailoverDBCluster , ModifyDBCluster , PromoteReadReplicaDBCluster ,
// RestoreDBClusterFromS3 , RestoreDBClusterFromSnapshot ,
// RestoreDBClusterToPointInTime , StartDBCluster , and StopDBCluster . For a
// Multi-AZ DB cluster, this data type is used as a response element in the
// operations CreateDBCluster , DeleteDBCluster , DescribeDBClusters ,
// FailoverDBCluster , ModifyDBCluster , RebootDBCluster ,
// RestoreDBClusterFromSnapshot , and RestoreDBClusterToPointInTime . For more
// information on Amazon Aurora DB clusters, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ deployments with two readable standby DB instances (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
DBCluster *types.DBCluster
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBCluster{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBCluster{}, 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 = addCreateDBClusterPresignURLMiddleware(stack, options); err != nil {
return err
}
if err = addOpCreateDBClusterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBCluster(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 copyCreateDBClusterInputForPresign(params interface{}) (interface{}, error) {
input, ok := params.(*CreateDBClusterInput)
if !ok {
return nil, fmt.Errorf("expect *CreateDBClusterInput type, got %T", params)
}
cpy := *input
return &cpy, nil
}
func getCreateDBClusterPreSignedUrl(params interface{}) (string, bool, error) {
input, ok := params.(*CreateDBClusterInput)
if !ok {
return ``, false, fmt.Errorf("expect *CreateDBClusterInput type, got %T", params)
}
if input.PreSignedUrl == nil || len(*input.PreSignedUrl) == 0 {
return ``, false, nil
}
return *input.PreSignedUrl, true, nil
}
func getCreateDBClusterSourceRegion(params interface{}) (string, bool, error) {
input, ok := params.(*CreateDBClusterInput)
if !ok {
return ``, false, fmt.Errorf("expect *CreateDBClusterInput type, got %T", params)
}
if input.SourceRegion == nil || len(*input.SourceRegion) == 0 {
return ``, false, nil
}
return *input.SourceRegion, true, nil
}
func setCreateDBClusterPreSignedUrl(params interface{}, value string) error {
input, ok := params.(*CreateDBClusterInput)
if !ok {
return fmt.Errorf("expect *CreateDBClusterInput type, got %T", params)
}
input.PreSignedUrl = &value
return nil
}
func setCreateDBClusterdestinationRegion(params interface{}, value string) error {
input, ok := params.(*CreateDBClusterInput)
if !ok {
return fmt.Errorf("expect *CreateDBClusterInput type, got %T", params)
}
input.destinationRegion = &value
return nil
}
func addCreateDBClusterPresignURLMiddleware(stack *middleware.Stack, options Options) error {
return presignedurlcust.AddMiddleware(stack, presignedurlcust.Options{
Accessor: presignedurlcust.ParameterAccessor{
GetPresignedURL: getCreateDBClusterPreSignedUrl,
GetSourceRegion: getCreateDBClusterSourceRegion,
CopyInput: copyCreateDBClusterInputForPresign,
SetDestinationRegion: setCreateDBClusterdestinationRegion,
SetPresignedURL: setCreateDBClusterPreSignedUrl,
},
Presigner: &presignAutoFillCreateDBClusterClient{client: NewPresignClient(New(options))},
})
}
type presignAutoFillCreateDBClusterClient struct {
client *PresignClient
}
// PresignURL is a middleware accessor that satisfies URLPresigner interface.
func (c *presignAutoFillCreateDBClusterClient) PresignURL(ctx context.Context, srcRegion string, params interface{}) (*v4.PresignedHTTPRequest, error) {
input, ok := params.(*CreateDBClusterInput)
if !ok {
return nil, fmt.Errorf("expect *CreateDBClusterInput type, got %T", params)
}
optFn := func(o *Options) {
o.Region = srcRegion
o.APIOptions = append(o.APIOptions, presignedurlcust.RemoveMiddleware)
}
presignOptFn := WithPresignClientFromClientOptions(optFn)
return c.client.PresignCreateDBCluster(ctx, input, presignOptFn)
}
func newServiceMetadataMiddleware_opCreateDBCluster(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBCluster",
}
}
// PresignCreateDBCluster is used to generate a presigned HTTP Request which
// contains presigned URL, signed headers and HTTP method used.
func (c *PresignClient) PresignCreateDBCluster(ctx context.Context, params *CreateDBClusterInput, optFns ...func(*PresignOptions)) (*v4.PresignedHTTPRequest, error) {
if params == nil {
params = &CreateDBClusterInput{}
}
options := c.options.copy()
for _, fn := range optFns {
fn(&options)
}
clientOptFns := append(options.ClientOptions, withNopHTTPClientAPIOption)
result, _, err := c.client.invokeOperation(ctx, "CreateDBCluster", params, clientOptFns,
c.client.addOperationCreateDBClusterMiddlewares,
presignConverter(options).convertToPresignMiddleware,
)
if err != nil {
return nil, err
}
out := result.(*v4.PresignedHTTPRequest)
return out, nil
}
| 695 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new custom endpoint and associates it with an Amazon Aurora DB
// cluster. This action applies only to Aurora DB clusters.
func (c *Client) CreateDBClusterEndpoint(ctx context.Context, params *CreateDBClusterEndpointInput, optFns ...func(*Options)) (*CreateDBClusterEndpointOutput, error) {
if params == nil {
params = &CreateDBClusterEndpointInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBClusterEndpoint", params, optFns, c.addOperationCreateDBClusterEndpointMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBClusterEndpointOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBClusterEndpointInput struct {
// The identifier to use for the new endpoint. This parameter is stored as a
// lowercase string.
//
// This member is required.
DBClusterEndpointIdentifier *string
// The DB cluster identifier of the DB cluster associated with the endpoint. This
// parameter is stored as a lowercase string.
//
// This member is required.
DBClusterIdentifier *string
// The type of the endpoint, one of: READER , WRITER , ANY .
//
// This member is required.
EndpointType *string
// List of DB instance identifiers that aren't part of the custom endpoint group.
// All other eligible instances are reachable through the custom endpoint. This
// parameter is relevant only if the list of static members is empty.
ExcludedMembers []string
// List of DB instance identifiers that are part of the custom endpoint group.
StaticMembers []string
// The tags to be assigned to the Amazon RDS resource.
Tags []types.Tag
noSmithyDocumentSerde
}
// This data type represents the information you need to connect to an Amazon
// Aurora DB cluster. This data type is used as a response element in the following
// actions:
// - CreateDBClusterEndpoint
// - DescribeDBClusterEndpoints
// - ModifyDBClusterEndpoint
// - DeleteDBClusterEndpoint
//
// For the data structure that represents Amazon RDS DB instance endpoints, see
// Endpoint .
type CreateDBClusterEndpointOutput struct {
// The type associated with a custom endpoint. One of: READER , WRITER , ANY .
CustomEndpointType *string
// The Amazon Resource Name (ARN) for the endpoint.
DBClusterEndpointArn *string
// The identifier associated with the endpoint. This parameter is stored as a
// lowercase string.
DBClusterEndpointIdentifier *string
// A unique system-generated identifier for an endpoint. It remains the same for
// the whole life of the endpoint.
DBClusterEndpointResourceIdentifier *string
// The DB cluster identifier of the DB cluster associated with the endpoint. This
// parameter is stored as a lowercase string.
DBClusterIdentifier *string
// The DNS address of the endpoint.
Endpoint *string
// The type of the endpoint. One of: READER , WRITER , CUSTOM .
EndpointType *string
// List of DB instance identifiers that aren't part of the custom endpoint group.
// All other eligible instances are reachable through the custom endpoint. Only
// relevant if the list of static members is empty.
ExcludedMembers []string
// List of DB instance identifiers that are part of the custom endpoint group.
StaticMembers []string
// The current status of the endpoint. One of: creating , available , deleting ,
// inactive , modifying . The inactive state applies to an endpoint that can't be
// used for a certain kind of cluster, such as a writer endpoint for a read-only
// secondary cluster in a global database.
Status *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBClusterEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBClusterEndpoint{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBClusterEndpoint{}, 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 = addOpCreateDBClusterEndpointValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBClusterEndpoint(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_opCreateDBClusterEndpoint(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBClusterEndpoint",
}
}
| 194 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new DB cluster parameter group. Parameters in a DB cluster parameter
// group apply to all of the instances in a DB cluster. A DB cluster parameter
// group is initially created with the default parameters for the database engine
// used by instances in the DB cluster. To provide custom values for any of the
// parameters, you must modify the group after creating it using
// ModifyDBClusterParameterGroup . Once you've created a DB cluster parameter
// group, you need to associate it with your DB cluster using ModifyDBCluster .
// When you associate a new DB cluster parameter group with a running Aurora DB
// cluster, reboot the DB instances in the DB cluster without failover for the new
// DB cluster parameter group and associated settings to take effect. When you
// associate a new DB cluster parameter group with a running Multi-AZ DB cluster,
// reboot the DB cluster without failover for the new DB cluster parameter group
// and associated settings to take effect. After you create a DB cluster parameter
// group, you should wait at least 5 minutes before creating your first DB cluster
// that uses that DB cluster parameter group as the default parameter group. This
// allows Amazon RDS to fully complete the create action before the DB cluster
// parameter group is used as the default for a new DB cluster. This is especially
// important for parameters that are critical when creating the default database
// for a DB cluster, such as the character set for the default database defined by
// the character_set_database parameter. You can use the Parameter Groups option
// of the Amazon RDS console (https://console.aws.amazon.com/rds/) or the
// DescribeDBClusterParameters operation to verify that your DB cluster parameter
// group has been created or modified. For more information on Amazon Aurora, see
// What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) CreateDBClusterParameterGroup(ctx context.Context, params *CreateDBClusterParameterGroupInput, optFns ...func(*Options)) (*CreateDBClusterParameterGroupOutput, error) {
if params == nil {
params = &CreateDBClusterParameterGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBClusterParameterGroup", params, optFns, c.addOperationCreateDBClusterParameterGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBClusterParameterGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBClusterParameterGroupInput struct {
// The name of the DB cluster parameter group. Constraints:
// - Must not match the name of an existing DB cluster parameter group.
// This value is stored as a lowercase string.
//
// This member is required.
DBClusterParameterGroupName *string
// The DB cluster parameter group family name. A DB cluster parameter group can be
// associated with one and only one DB cluster parameter group family, and can be
// applied only to a DB cluster running a database engine and engine version
// compatible with that DB cluster parameter group family. Aurora MySQL Example:
// aurora-mysql5.7 , aurora-mysql8.0 Aurora PostgreSQL Example: aurora-postgresql14
// RDS for MySQL Example: mysql8.0 RDS for PostgreSQL Example: postgres12 To list
// all of the available parameter group families for a DB engine, use the following
// command: aws rds describe-db-engine-versions --query
// "DBEngineVersions[].DBParameterGroupFamily" --engine For example, to list all
// of the available parameter group families for the Aurora PostgreSQL DB engine,
// use the following command: aws rds describe-db-engine-versions --query
// "DBEngineVersions[].DBParameterGroupFamily" --engine aurora-postgresql The
// output contains duplicates. The following are the valid DB engine values:
// - aurora-mysql
// - aurora-postgresql
// - mysql
// - postgres
//
// This member is required.
DBParameterGroupFamily *string
// The description for the DB cluster parameter group.
//
// This member is required.
Description *string
// Tags to assign to the DB cluster parameter group.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateDBClusterParameterGroupOutput struct {
// Contains the details of an Amazon RDS DB cluster parameter group. This data
// type is used as a response element in the DescribeDBClusterParameterGroups
// action.
DBClusterParameterGroup *types.DBClusterParameterGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBClusterParameterGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBClusterParameterGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBClusterParameterGroup{}, 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 = addOpCreateDBClusterParameterGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBClusterParameterGroup(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_opCreateDBClusterParameterGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBClusterParameterGroup",
}
}
| 184 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a snapshot of a DB cluster. For more information on Amazon Aurora, see
// What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) CreateDBClusterSnapshot(ctx context.Context, params *CreateDBClusterSnapshotInput, optFns ...func(*Options)) (*CreateDBClusterSnapshotOutput, error) {
if params == nil {
params = &CreateDBClusterSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBClusterSnapshot", params, optFns, c.addOperationCreateDBClusterSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBClusterSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBClusterSnapshotInput struct {
// The identifier of the DB cluster to create a snapshot for. This parameter isn't
// case-sensitive. Constraints:
// - Must match the identifier of an existing DBCluster.
// Example: my-cluster1
//
// This member is required.
DBClusterIdentifier *string
// The identifier of the DB cluster snapshot. This parameter is stored as a
// lowercase string. Constraints:
// - Must contain from 1 to 63 letters, numbers, or hyphens.
// - First character must be a letter.
// - Can't end with a hyphen or contain two consecutive hyphens.
// Example: my-cluster1-snapshot1
//
// This member is required.
DBClusterSnapshotIdentifier *string
// The tags to be assigned to the DB cluster snapshot.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateDBClusterSnapshotOutput struct {
// Contains the details for an Amazon RDS DB cluster snapshot This data type is
// used as a response element in the DescribeDBClusterSnapshots action.
DBClusterSnapshot *types.DBClusterSnapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBClusterSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBClusterSnapshot{}, 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 = addOpCreateDBClusterSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBClusterSnapshot(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_opCreateDBClusterSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBClusterSnapshot",
}
}
| 146 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awstesting/unit"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net/http"
"strings"
"testing"
)
func TestClientCreateDBCluster_presignURLCustomization(t *testing.T) {
cases := map[string]struct {
Input *CreateDBClusterInput
ClientRegion string
ExpectPresignedURL string
ExpectPresignedURLDestinationRegion string
ExpectRequestURL string
ExpectErr string
}{
"have presigned URL no auto fill": {
Input: &CreateDBClusterInput{
PreSignedUrl: aws.String("https://example.aws/signed-url"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://example.aws/signed-url",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"no source region no auto fill": {
Input: &CreateDBClusterInput{},
ClientRegion: "mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"auto fill presign URL matching region": {
Input: &CreateDBClusterInput{
SourceRegion: aws.String("mock-region"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://service.mock-region.amazonaws.com/",
ExpectPresignedURLDestinationRegion: "DestinationRegion=mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"auto fill presign URL different region": {
Input: &CreateDBClusterInput{
SourceRegion: aws.String("mock-other-region"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://service.mock-other-region.amazonaws.com/",
ExpectPresignedURLDestinationRegion: "DestinationRegion=mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
client := New(Options{
Region: c.ClientRegion,
Credentials: unit.StubCredentialsProvider{},
HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
if e, a := c.ExpectRequestURL, r.URL.String(); !strings.HasPrefix(a, e) {
t.Errorf("expect presigned URL to contain %v, got %v", e, a)
}
return smithyhttp.NopClient{}.Do(r)
}),
EndpointResolver: EndpointResolverFunc(
func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
return aws.Endpoint{
URL: "https://service." + region + ".amazonaws.com",
SigningRegion: c.ClientRegion,
}, nil
}),
})
_, err := client.CreateDBCluster(context.Background(), c.Input,
func(o *Options) {
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) (err error) {
_, err = stack.Initialize.Remove("OperationInputValidation")
if err != nil {
return err
}
return stack.Serialize.Add(middleware.SerializeMiddlewareFunc(t.Name(),
func(
ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateDBClusterInput)
if !ok {
t.Fatalf("expect CreateDBClusterInput, got %T", in.Parameters)
}
// Switch based on if presign flow or not
if presignedurlcust.GetIsPresigning(ctx) {
// Presign Flow
if v := input.PreSignedUrl; v != nil {
t.Errorf("expect no presigned URL, got %v", *v)
}
if input.destinationRegion == nil {
t.Fatalf("expect destination region to be set")
}
if e, a := c.ClientRegion, *input.destinationRegion; e != a {
t.Errorf("expect %v destination region, got %v", e, a)
}
} else {
// Operation flow
if v := input.destinationRegion; v != nil {
t.Errorf("expect no destination region, got %v", *v)
}
if len(c.ExpectPresignedURL) != 0 {
if input.PreSignedUrl == nil {
t.Fatalf("expect presigned URL, got none")
}
if e, a := c.ExpectPresignedURL, *input.PreSignedUrl; !strings.HasPrefix(a, e) {
t.Errorf("expect presigned URL to contain %v, got %v", e, a)
}
if e, a := c.ExpectPresignedURLDestinationRegion, *input.PreSignedUrl; !strings.Contains(a, e) {
t.Errorf("expect presigned URL destination region to contain %v, got %v", e, a)
}
return next.HandleSerialize(ctx, in)
}
if v := input.PreSignedUrl; v != nil {
t.Errorf("expect no presigned url, got %v", *v)
}
}
return next.HandleSerialize(ctx, in)
},
), middleware.After)
})
},
)
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)
}
return
}
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
})
}
}
| 160 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new DB instance. The new DB instance can be an RDS DB instance, or it
// can be a DB instance in an Aurora DB cluster. For an Aurora DB cluster, you can
// call this operation multiple times to add more than one DB instance to the
// cluster. For more information about creating an RDS DB instance, see Creating
// an Amazon RDS DB instance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateDBInstance.html)
// in the Amazon RDS User Guide. For more information about creating a DB instance
// in an Aurora DB cluster, see Creating an Amazon Aurora DB cluster (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.CreateInstance.html)
// in the Amazon Aurora User Guide.
func (c *Client) CreateDBInstance(ctx context.Context, params *CreateDBInstanceInput, optFns ...func(*Options)) (*CreateDBInstanceOutput, error) {
if params == nil {
params = &CreateDBInstanceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBInstance", params, optFns, c.addOperationCreateDBInstanceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBInstanceOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBInstanceInput struct {
// The compute and memory capacity of the DB instance, for example db.m5.large .
// Not all DB instance classes are available in all Amazon Web Services Regions, or
// for all database engines. For the full list of DB instance classes, and
// availability for your engine, see DB instance classes (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html)
// in the Amazon RDS User Guide or Aurora DB instance classes (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.DBInstanceClass.html)
// in the Amazon Aurora User Guide.
//
// This member is required.
DBInstanceClass *string
// The identifier for this DB instance. This parameter is stored as a lowercase
// string. Constraints:
// - Must contain from 1 to 63 letters, numbers, or hyphens.
// - First character must be a letter.
// - Can't end with a hyphen or contain two consecutive hyphens.
// Example: mydbinstance
//
// This member is required.
DBInstanceIdentifier *string
// The database engine to use for this DB instance. Not every database engine is
// available in every Amazon Web Services Region. Valid Values:
// - aurora-mysql (for Aurora MySQL DB instances)
// - aurora-postgresql (for Aurora PostgreSQL DB instances)
// - custom-oracle-ee (for RDS Custom for Oracle DB instances)
// - custom-oracle-ee-cdb (for RDS Custom for Oracle DB instances)
// - custom-sqlserver-ee (for RDS Custom for SQL Server DB instances)
// - custom-sqlserver-se (for RDS Custom for SQL Server DB instances)
// - custom-sqlserver-web (for RDS Custom for SQL Server DB instances)
// - mariadb
// - mysql
// - oracle-ee
// - oracle-ee-cdb
// - oracle-se2
// - oracle-se2-cdb
// - postgres
// - sqlserver-ee
// - sqlserver-se
// - sqlserver-ex
// - sqlserver-web
//
// This member is required.
Engine *string
// The amount of storage in gibibytes (GiB) to allocate for the DB instance. This
// setting doesn't apply to Amazon Aurora DB instances. Aurora cluster volumes
// automatically grow as the amount of data in your database increases, though you
// are only charged for the space that you use in an Aurora cluster volume. Amazon
// RDS Custom RDS for MariaDB RDS for MySQL RDS for Oracle RDS for PostgreSQL RDS
// for SQL Server Constraints to the amount of storage for each storage type are
// the following:
// - General Purpose (SSD) storage (gp2, gp3): Must be an integer from 40 to
// 65536 for RDS Custom for Oracle, 16384 for RDS Custom for SQL Server.
// - Provisioned IOPS storage (io1): Must be an integer from 40 to 65536 for RDS
// Custom for Oracle, 16384 for RDS Custom for SQL Server.
// Constraints to the amount of storage for each storage type are the following:
// - General Purpose (SSD) storage (gp2, gp3): Must be an integer from 20 to
// 65536.
// - Provisioned IOPS storage (io1): Must be an integer from 100 to 65536.
// - Magnetic storage (standard): Must be an integer from 5 to 3072.
// Constraints to the amount of storage for each storage type are the following:
// - General Purpose (SSD) storage (gp2, gp3): Must be an integer from 20 to
// 65536.
// - Provisioned IOPS storage (io1): Must be an integer from 100 to 65536.
// - Magnetic storage (standard): Must be an integer from 5 to 3072.
// Constraints to the amount of storage for each storage type are the following:
// - General Purpose (SSD) storage (gp2, gp3): Must be an integer from 20 to
// 65536.
// - Provisioned IOPS storage (io1): Must be an integer from 100 to 65536.
// - Magnetic storage (standard): Must be an integer from 10 to 3072.
// Constraints to the amount of storage for each storage type are the following:
// - General Purpose (SSD) storage (gp2, gp3): Must be an integer from 20 to
// 65536.
// - Provisioned IOPS storage (io1): Must be an integer from 100 to 65536.
// - Magnetic storage (standard): Must be an integer from 5 to 3072.
// Constraints to the amount of storage for each storage type are the following:
// - General Purpose (SSD) storage (gp2, gp3):
// - Enterprise and Standard editions: Must be an integer from 20 to 16384.
// - Web and Express editions: Must be an integer from 20 to 16384.
// - Provisioned IOPS storage (io1):
// - Enterprise and Standard editions: Must be an integer from 100 to 16384.
// - Web and Express editions: Must be an integer from 100 to 16384.
// - Magnetic storage (standard):
// - Enterprise and Standard editions: Must be an integer from 20 to 1024.
// - Web and Express editions: Must be an integer from 20 to 1024.
AllocatedStorage *int32
// Specifies whether minor engine upgrades are applied automatically to the DB
// instance during the maintenance window. By default, minor engine upgrades are
// applied automatically. If you create an RDS Custom DB instance, you must set
// AutoMinorVersionUpgrade to false .
AutoMinorVersionUpgrade *bool
// The Availability Zone (AZ) where the database will be created. For information
// on Amazon Web Services Regions and Availability Zones, see Regions and
// Availability Zones (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html)
// . For Amazon Aurora, each Aurora DB cluster hosts copies of its storage in three
// separate Availability Zones. Specify one of these Availability Zones. Aurora
// automatically chooses an appropriate Availability Zone if you don't specify one.
// Default: A random, system-chosen Availability Zone in the endpoint's Amazon Web
// Services Region. Constraints:
// - The AvailabilityZone parameter can't be specified if the DB instance is a
// Multi-AZ deployment.
// - The specified Availability Zone must be in the same Amazon Web Services
// Region as the current endpoint.
// Example: us-east-1d
AvailabilityZone *string
// The number of days for which automated backups are retained. Setting this
// parameter to a positive number enables backups. Setting this parameter to 0
// disables automated backups. This setting doesn't apply to Amazon Aurora DB
// instances. The retention period for automated backups is managed by the DB
// cluster. Default: 1 Constraints:
// - Must be a value from 0 to 35.
// - Can't be set to 0 if the DB instance is a source to read replicas.
// - Can't be set to 0 for an RDS Custom for Oracle DB instance.
BackupRetentionPeriod *int32
// The location for storing automated backups and manual snapshots. Valie Values:
// - outposts (Amazon Web Services Outposts)
// - region (Amazon Web Services Region)
// Default: region For more information, see Working with Amazon RDS on Amazon Web
// Services Outposts (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-on-outposts.html)
// in the Amazon RDS User Guide.
BackupTarget *string
// The CA certificate identifier to use for the DB instance's server certificate.
// This setting doesn't apply to RDS Custom DB instances. For more information, see
// Using SSL/TLS to encrypt a connection to a DB instance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html)
// in the Amazon RDS User Guide and Using SSL/TLS to encrypt a connection to a DB
// cluster (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.SSL.html)
// in the Amazon Aurora User Guide.
CACertificateIdentifier *string
// For supported engines, the character set ( CharacterSet ) to associate the DB
// instance with. This setting doesn't apply to the following DB instances:
// - Amazon Aurora - The character set is managed by the DB cluster. For more
// information, see CreateDBCluster .
// - RDS Custom - However, if you need to change the character set, you can
// change it on the database itself.
CharacterSetName *string
// Spcifies whether to copy tags from the DB instance to snapshots of the DB
// instance. By default, tags are not copied. This setting doesn't apply to Amazon
// Aurora DB instances. Copying tags to snapshots is managed by the DB cluster.
// Setting this value for an Aurora DB instance has no effect on the DB cluster
// setting.
CopyTagsToSnapshot *bool
// The instance profile associated with the underlying Amazon EC2 instance of an
// RDS Custom DB instance. This setting is required for RDS Custom. Constraints:
// - The profile must exist in your account.
// - The profile must have an IAM role that Amazon EC2 has permissions to
// assume.
// - The instance profile name and the associated IAM role name must start with
// the prefix AWSRDSCustom .
// For the list of permissions required for the IAM role, see Configure IAM and
// your VPC (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-setup-orcl.html#custom-setup-orcl.iam-vpc)
// in the Amazon RDS User Guide.
CustomIamInstanceProfile *string
// The identifier of the DB cluster that this DB instance will belong to. This
// setting doesn't apply to RDS Custom DB instances.
DBClusterIdentifier *string
// The meaning of this parameter differs depending on the database engine. Amazon
// Aurora MySQL Amazon Aurora PostgreSQL Amazon RDS Custom for Oracle Amazon RDS
// Custom for SQL Server RDS for MariaDB RDS for MySQL RDS for Oracle RDS for
// PostgreSQL RDS for SQL Server The name of the database to create when the
// primary DB instance of the Aurora MySQL DB cluster is created. If you don't
// specify a value, Amazon RDS doesn't create a database in the DB cluster.
// Constraints:
// - Must contain 1 to 64 alphanumeric characters.
// - Can't be a word reserved by the database engine.
// The name of the database to create when the primary DB instance of the Aurora
// PostgreSQL DB cluster is created. Default: postgres Constraints:
// - Must contain 1 to 63 alphanumeric characters.
// - Must begin with a letter. Subsequent characters can be letters,
// underscores, or digits (0 to 9).
// - Can't be a word reserved by the database engine.
// The Oracle System ID (SID) of the created RDS Custom DB instance. Default: ORCL
// Constraints:
// - Must contain 1 to 8 alphanumeric characters.
// - Must contain a letter.
// - Can't be a word reserved by the database engine.
// Not applicable. Must be null. The name of the database to create when the DB
// instance is created. If you don't specify a value, Amazon RDS doesn't create a
// database in the DB instance. Constraints:
// - Must contain 1 to 64 letters or numbers.
// - Must begin with a letter. Subsequent characters can be letters,
// underscores, or digits (0-9).
// - Can't be a word reserved by the database engine.
// The name of the database to create when the DB instance is created. If you
// don't specify a value, Amazon RDS doesn't create a database in the DB instance.
// Constraints:
// - Must contain 1 to 64 letters or numbers.
// - Must begin with a letter. Subsequent characters can be letters,
// underscores, or digits (0-9).
// - Can't be a word reserved by the database engine.
// The Oracle System ID (SID) of the created DB instance. Default: ORCL
// Constraints:
// - Can't be longer than 8 characters.
// - Can't be a word reserved by the database engine, such as the string NULL .
// The name of the database to create when the DB instance is created. Default:
// postgres Constraints:
// - Must contain 1 to 63 letters, numbers, or underscores.
// - Must begin with a letter. Subsequent characters can be letters,
// underscores, or digits (0-9).
// - Can't be a word reserved by the database engine.
// Not applicable. Must be null.
DBName *string
// The name of the DB parameter group to associate with this DB instance. If you
// don't specify a value, then Amazon RDS uses the default DB parameter group for
// the specified DB engine and version. This setting doesn't apply to RDS Custom DB
// instances. Constraints:
// - Must be 1 to 255 letters, numbers, or hyphens.
// - The first character must be a letter.
// - Can't end with a hyphen or contain two consecutive hyphens.
DBParameterGroupName *string
// A list of DB security groups to associate with this DB instance. This setting
// applies to the legacy EC2-Classic platform, which is no longer used to create
// new DB instances. Use the VpcSecurityGroupIds setting instead.
DBSecurityGroups []string
// A DB subnet group to associate with this DB instance. Constraints:
// - Must match the name of an existing DB subnet group.
// - Must not be default .
// Example: mydbsubnetgroup
DBSubnetGroupName *string
// Specifies whether the DB instance has deletion protection enabled. The database
// can't be deleted when deletion protection is enabled. By default, deletion
// protection isn't enabled. For more information, see Deleting a DB Instance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DeleteInstance.html)
// . This setting doesn't apply to Amazon Aurora DB instances. You can enable or
// disable deletion protection for the DB cluster. For more information, see
// CreateDBCluster . DB instances in a DB cluster can be deleted even when deletion
// protection is enabled for the DB cluster.
DeletionProtection *bool
// The Active Directory directory ID to create the DB instance in. Currently, only
// Microsoft SQL Server, MySQL, Oracle, and PostgreSQL DB instances can be created
// in an Active Directory Domain. For more information, see Kerberos Authentication (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/kerberos-authentication.html)
// in the Amazon RDS User Guide. This setting doesn't apply to the following DB
// instances:
// - Amazon Aurora (The domain is managed by the DB cluster.)
// - RDS Custom
Domain *string
// The ARN for the Secrets Manager secret that contains the credentials for the
// user performing the domain join. Example:
// arn:aws:secretsmanager:region:account-number:secret:myselfmanagedADtestsecret-123456
DomainAuthSecretArn *string
// The IPv4 DNS IP addresses of your primary and secondary Active Directory domain
// controllers. Constraints:
// - Two IP addresses must be provided. If there isn't a secondary domain
// controller, use the IP address of the primary domain controller for both entries
// in the list.
// Example: 123.124.125.126,234.235.236.237
DomainDnsIps []string
// Specifies the fully qualified domain name of an Active Directory domain.
// Constraints:
// - Cannot be greater than 64 characters.
// Example: mymanagedADtest.mymanagedAD.mydomain
DomainFqdn *string
// The name of the IAM role to use when making API calls to the Directory Service.
// This setting doesn't apply to the following DB instances:
// - Amazon Aurora (The domain is managed by the DB cluster.)
// - RDS Custom
DomainIAMRoleName *string
// The Active Directory organizational unit for your DB instance to join.
// Constraints:
// - Must be in the distinguished name format.
// - Cannot be greater than 64 characters.
// Example: OU=mymanagedADtestOU,DC=mymanagedADtest,DC=mymanagedAD,DC=mydomain
DomainOu *string
// The list of log types that need to be enabled for exporting to CloudWatch Logs.
// For more information, see Publishing Database Logs to Amazon CloudWatch Logs (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch)
// in the Amazon RDS User Guide. This setting doesn't apply to the following DB
// instances:
// - Amazon Aurora (CloudWatch Logs exports are managed by the DB cluster.)
// - RDS Custom
// The following values are valid for each DB engine:
// - RDS for MariaDB - audit | error | general | slowquery
// - RDS for Microsoft SQL Server - agent | error
// - RDS for MySQL - audit | error | general | slowquery
// - RDS for Oracle - alert | audit | listener | trace | oemagent
// - RDS for PostgreSQL - postgresql | upgrade
EnableCloudwatchLogsExports []string
// Specifies whether to enable a customer-owned IP address (CoIP) for an RDS on
// Outposts DB instance. A CoIP provides local or external connectivity to
// resources in your Outpost subnets through your on-premises network. For some use
// cases, a CoIP can provide lower latency for connections to the DB instance from
// outside of its virtual private cloud (VPC) on your local network. For more
// information about RDS on Outposts, see Working with Amazon RDS on Amazon Web
// Services Outposts (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-on-outposts.html)
// in the Amazon RDS User Guide. For more information about CoIPs, see
// Customer-owned IP addresses (https://docs.aws.amazon.com/outposts/latest/userguide/routing.html#ip-addressing)
// in the Amazon Web Services Outposts User Guide.
EnableCustomerOwnedIp *bool
// Specifies whether to enable mapping of Amazon Web Services Identity and Access
// Management (IAM) accounts to database accounts. By default, mapping isn't
// enabled. For more information, see IAM Database Authentication for MySQL and
// PostgreSQL (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html)
// in the Amazon RDS User Guide. This setting doesn't apply to the following DB
// instances:
// - Amazon Aurora (Mapping Amazon Web Services IAM accounts to database
// accounts is managed by the DB cluster.)
// - RDS Custom
EnableIAMDatabaseAuthentication *bool
// Specifies whether to enable Performance Insights for the DB instance. For more
// information, see Using Amazon Performance Insights (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html)
// in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom DB
// instances.
EnablePerformanceInsights *bool
// The version number of the database engine to use. This setting doesn't apply to
// Amazon Aurora DB instances. The version number of the database engine the DB
// instance uses is managed by the DB cluster. For a list of valid engine versions,
// use the DescribeDBEngineVersions operation. The following are the database
// engines and links to information about the major and minor versions that are
// available with Amazon RDS. Not every database engine is available for every
// Amazon Web Services Region. Amazon RDS Custom for Oracle Amazon RDS Custom for
// SQL Server RDS for MariaDB RDS for Microsoft SQL Server RDS for MySQL RDS for
// Oracle RDS for PostgreSQL A custom engine version (CEV) that you have previously
// created. This setting is required for RDS Custom for Oracle. The CEV name has
// the following format: 19.customized_string. A valid CEV name is 19.my_cev1 . For
// more information, see Creating an RDS Custom for Oracle DB instance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-creating.html#custom-creating.create)
// in the Amazon RDS User Guide. See RDS Custom for SQL Server general requirements (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-reqs-limits-MS.html)
// in the Amazon RDS User Guide. For information, see MariaDB on Amazon RDS
// versions (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MariaDB.html#MariaDB.Concepts.VersionMgmt)
// in the Amazon RDS User Guide. For information, see Microsoft SQL Server
// versions on Amazon RDS (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.VersionSupport)
// in the Amazon RDS User Guide. For information, see MySQL on Amazon RDS versions (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.VersionMgmt)
// in the Amazon RDS User Guide. For information, see Oracle Database Engine
// release notes (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.PatchComposition.html)
// in the Amazon RDS User Guide. For information, see Amazon RDS for PostgreSQL
// versions and extensions (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts)
// in the Amazon RDS User Guide.
EngineVersion *string
// The amount of Provisioned IOPS (input/output operations per second) to
// initially allocate for the DB instance. For information about valid IOPS values,
// see Amazon RDS DB instance storage (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html)
// in the Amazon RDS User Guide. This setting doesn't apply to Amazon Aurora DB
// instances. Storage is managed by the DB cluster. Constraints:
// - For RDS for MariaDB, MySQL, Oracle, and PostgreSQL - Must be a multiple
// between .5 and 50 of the storage amount for the DB instance.
// - For RDS for SQL Server - Must be a multiple between 1 and 50 of the storage
// amount for the DB instance.
Iops *int32
// The Amazon Web Services KMS key identifier for an encrypted DB instance. The
// Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or
// alias name for the KMS key. To use a KMS key in a different Amazon Web Services
// account, specify the key ARN or alias ARN. This setting doesn't apply to Amazon
// Aurora DB instances. The Amazon Web Services KMS key identifier is managed by
// the DB cluster. For more information, see CreateDBCluster . If StorageEncrypted
// is enabled, and you do not specify a value for the KmsKeyId parameter, then
// Amazon RDS uses your default KMS key. There is a default KMS key for your Amazon
// Web Services account. Your Amazon Web Services account has a different default
// KMS key for each Amazon Web Services Region. For Amazon RDS Custom, a KMS key is
// required for DB instances. For most RDS engines, if you leave this parameter
// empty while enabling StorageEncrypted , the engine uses the default KMS key.
// However, RDS Custom doesn't use the default key when this parameter is empty.
// You must explicitly specify a key.
KmsKeyId *string
// The license model information for this DB instance. This setting doesn't apply
// to Amazon Aurora or RDS Custom DB instances. Valid Values:
// - RDS for MariaDB - general-public-license
// - RDS for Microsoft SQL Server - license-included
// - RDS for MySQL - general-public-license
// - RDS for Oracle - bring-your-own-license | license-included
// - RDS for PostgreSQL - postgresql-license
LicenseModel *string
// Specifies whether to manage the master user password with Amazon Web Services
// Secrets Manager. For more information, see Password management with Amazon Web
// Services Secrets Manager (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-secrets-manager.html)
// in the Amazon RDS User Guide. Constraints:
// - Can't manage the master user password with Amazon Web Services Secrets
// Manager if MasterUserPassword is specified.
ManageMasterUserPassword *bool
// The password for the master user. This setting doesn't apply to Amazon Aurora
// DB instances. The password for the master user is managed by the DB cluster.
// Constraints:
// - Can't be specified if ManageMasterUserPassword is turned on.
// - Can include any printable ASCII character except "/", """, or "@".
// Length Constraints:
// - RDS for MariaDB - Must contain from 8 to 41 characters.
// - RDS for Microsoft SQL Server - Must contain from 8 to 128 characters.
// - RDS for MySQL - Must contain from 8 to 41 characters.
// - RDS for Oracle - Must contain from 8 to 30 characters.
// - RDS for PostgreSQL - Must contain from 8 to 128 characters.
MasterUserPassword *string
// The Amazon Web Services KMS key identifier to encrypt a secret that is
// automatically generated and managed in Amazon Web Services Secrets Manager. This
// setting is valid only if the master user password is managed by RDS in Amazon
// Web Services Secrets Manager for the DB instance. The Amazon Web Services KMS
// key identifier is the key ARN, key ID, alias ARN, or alias name for the KMS key.
// To use a KMS key in a different Amazon Web Services account, specify the key ARN
// or alias ARN. If you don't specify MasterUserSecretKmsKeyId , then the
// aws/secretsmanager KMS key is used to encrypt the secret. If the secret is in a
// different Amazon Web Services account, then you can't use the aws/secretsmanager
// KMS key to encrypt the secret, and you must use a customer managed KMS key.
// There is a default KMS key for your Amazon Web Services account. Your Amazon Web
// Services account has a different default KMS key for each Amazon Web Services
// Region.
MasterUserSecretKmsKeyId *string
// The name for the master user. This setting doesn't apply to Amazon Aurora DB
// instances. The name for the master user is managed by the DB cluster. This
// setting is required for RDS DB instances. Constraints:
// - Must be 1 to 16 letters, numbers, or underscores.
// - First character must be a letter.
// - Can't be a reserved word for the chosen database engine.
MasterUsername *string
// The upper limit in gibibytes (GiB) to which Amazon RDS can automatically scale
// the storage of the DB instance. For more information about this setting,
// including limitations that apply to it, see Managing capacity automatically
// with Amazon RDS storage autoscaling (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling)
// in the Amazon RDS User Guide. This setting doesn't apply to the following DB
// instances:
// - Amazon Aurora (Storage is managed by the DB cluster.)
// - RDS Custom
MaxAllocatedStorage *int32
// The interval, in seconds, between points when Enhanced Monitoring metrics are
// collected for the DB instance. To disable collection of Enhanced Monitoring
// metrics, specify 0 . If MonitoringRoleArn is specified, then you must set
// MonitoringInterval to a value other than 0 . This setting doesn't apply to RDS
// Custom DB instances. Valid Values: 0 | 1 | 5 | 10 | 15 | 30 | 60 Default: 0
MonitoringInterval *int32
// The ARN for the IAM role that permits RDS to send enhanced monitoring metrics
// to Amazon CloudWatch Logs. For example, arn:aws:iam:123456789012:role/emaccess .
// For information on creating a monitoring role, see Setting Up and Enabling
// Enhanced Monitoring (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.OS.html#USER_Monitoring.OS.Enabling)
// in the Amazon RDS User Guide. If MonitoringInterval is set to a value other
// than 0 , then you must supply a MonitoringRoleArn value. This setting doesn't
// apply to RDS Custom DB instances.
MonitoringRoleArn *string
// Specifies whether the DB instance is a Multi-AZ deployment. You can't set the
// AvailabilityZone parameter if the DB instance is a Multi-AZ deployment. This
// setting doesn't apply to the following DB instances:
// - Amazon Aurora (DB instance Availability Zones (AZs) are managed by the DB
// cluster.)
// - RDS Custom
MultiAZ *bool
// The name of the NCHAR character set for the Oracle DB instance. This setting
// doesn't apply to RDS Custom DB instances.
NcharCharacterSetName *string
// The network type of the DB instance. The network type is determined by the
// DBSubnetGroup specified for the DB instance. A DBSubnetGroup can support only
// the IPv4 protocol or the IPv4 and the IPv6 protocols ( DUAL ). For more
// information, see Working with a DB instance in a VPC (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html)
// in the Amazon RDS User Guide. Valid Values: IPV4 | DUAL
NetworkType *string
// The option group to associate the DB instance with. Permanent options, such as
// the TDE option for Oracle Advanced Security TDE, can't be removed from an option
// group. Also, that option group can't be removed from a DB instance after it is
// associated with a DB instance. This setting doesn't apply to Amazon Aurora or
// RDS Custom DB instances.
OptionGroupName *string
// The Amazon Web Services KMS key identifier for encryption of Performance
// Insights data. The Amazon Web Services KMS key identifier is the key ARN, key
// ID, alias ARN, or alias name for the KMS key. If you don't specify a value for
// PerformanceInsightsKMSKeyId , then Amazon RDS uses your default KMS key. There
// is a default KMS key for your Amazon Web Services account. Your Amazon Web
// Services account has a different default KMS key for each Amazon Web Services
// Region. This setting doesn't apply to RDS Custom DB instances.
PerformanceInsightsKMSKeyId *string
// The number of days to retain Performance Insights data. This setting doesn't
// apply to RDS Custom DB instances. Valid Values:
// - 7
// - month * 31, where month is a number of months from 1-23. Examples: 93 (3
// months * 31), 341 (11 months * 31), 589 (19 months * 31)
// - 731
// Default: 7 days If you specify a retention period that isn't valid, such as 94 ,
// Amazon RDS returns an error.
PerformanceInsightsRetentionPeriod *int32
// The port number on which the database accepts connections. This setting doesn't
// apply to Aurora DB instances. The port number is managed by the cluster. Valid
// Values: 1150-65535 Default:
// - RDS for MariaDB - 3306
// - RDS for Microsoft SQL Server - 1433
// - RDS for MySQL - 3306
// - RDS for Oracle - 1521
// - RDS for PostgreSQL - 5432
// Constraints:
// - For RDS for Microsoft SQL Server, the value can't be 1234 , 1434 , 3260 ,
// 3343 , 3389 , 47001 , or 49152-49156 .
Port *int32
// The daily time range during which automated backups are created if automated
// backups are enabled, using the BackupRetentionPeriod parameter. The default is
// a 30-minute window selected at random from an 8-hour block of time for each
// Amazon Web Services Region. For more information, see Backup window (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow)
// in the Amazon RDS User Guide. This setting doesn't apply to Amazon Aurora DB
// instances. The daily time range for creating automated backups is managed by the
// DB cluster. Constraints:
// - Must be in the format hh24:mi-hh24:mi .
// - Must be in Universal Coordinated Time (UTC).
// - Must not conflict with the preferred maintenance window.
// - Must be at least 30 minutes.
PreferredBackupWindow *string
// The time range each week during which system maintenance can occur. For more
// information, see Amazon RDS Maintenance Window (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#Concepts.DBMaintenance)
// in the Amazon RDS User Guide. The default is a 30-minute window selected at
// random from an 8-hour block of time for each Amazon Web Services Region,
// occurring on a random day of the week. Constraints:
// - Must be in the format ddd:hh24:mi-ddd:hh24:mi .
// - The day values must be mon | tue | wed | thu | fri | sat | sun .
// - Must be in Universal Coordinated Time (UTC).
// - Must not conflict with the preferred backup window.
// - Must be at least 30 minutes.
PreferredMaintenanceWindow *string
// The number of CPU cores and the number of threads per core for the DB instance
// class of the DB instance. This setting doesn't apply to Amazon Aurora or RDS
// Custom DB instances.
ProcessorFeatures []types.ProcessorFeature
// The order of priority in which an Aurora Replica is promoted to the primary
// instance after a failure of the existing primary instance. For more information,
// see Fault Tolerance for an Aurora DB Cluster (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.AuroraHighAvailability.html#Aurora.Managing.FaultTolerance)
// in the Amazon Aurora User Guide. This setting doesn't apply to RDS Custom DB
// instances. Default: 1 Valid Values: 0 - 15
PromotionTier *int32
// Specifies whether the DB instance is publicly accessible. When the DB instance
// is publicly accessible, its Domain Name System (DNS) endpoint resolves to the
// private IP address from within the DB instance's virtual private cloud (VPC). It
// resolves to the public IP address from outside of the DB instance's VPC. Access
// to the DB instance is ultimately controlled by the security group it uses. That
// public access is not permitted if the security group assigned to the DB instance
// doesn't permit it. When the DB instance isn't publicly accessible, it is an
// internal DB instance with a DNS name that resolves to a private IP address.
// Default: The default behavior varies depending on whether DBSubnetGroupName is
// specified. If DBSubnetGroupName isn't specified, and PubliclyAccessible isn't
// specified, the following applies:
// - If the default VPC in the target Region doesn’t have an internet gateway
// attached to it, the DB instance is private.
// - If the default VPC in the target Region has an internet gateway attached to
// it, the DB instance is public.
// If DBSubnetGroupName is specified, and PubliclyAccessible isn't specified, the
// following applies:
// - If the subnets are part of a VPC that doesn’t have an internet gateway
// attached to it, the DB instance is private.
// - If the subnets are part of a VPC that has an internet gateway attached to
// it, the DB instance is public.
PubliclyAccessible *bool
// Specifes whether the DB instance is encrypted. By default, it isn't encrypted.
// For RDS Custom DB instances, either enable this setting or leave it unset.
// Otherwise, Amazon RDS reports an error. This setting doesn't apply to Amazon
// Aurora DB instances. The encryption for DB instances is managed by the DB
// cluster.
StorageEncrypted *bool
// The storage throughput value for the DB instance. This setting applies only to
// the gp3 storage type. This setting doesn't apply to Amazon Aurora or RDS Custom
// DB instances.
StorageThroughput *int32
// The storage type to associate with the DB instance. If you specify io1 or gp3 ,
// you must also include a value for the Iops parameter. This setting doesn't
// apply to Amazon Aurora DB instances. Storage is managed by the DB cluster. Valid
// Values: gp2 | gp3 | io1 | standard Default: io1 , if the Iops parameter is
// specified. Otherwise, gp2 .
StorageType *string
// Tags to assign to the DB instance.
Tags []types.Tag
// The ARN from the key store with which to associate the instance for TDE
// encryption. This setting doesn't apply to Amazon Aurora or RDS Custom DB
// instances.
TdeCredentialArn *string
// The password for the given ARN from the key store in order to access the
// device. This setting doesn't apply to RDS Custom DB instances.
TdeCredentialPassword *string
// The time zone of the DB instance. The time zone parameter is currently
// supported only by Microsoft SQL Server (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.TimeZone)
// .
Timezone *string
// A list of Amazon EC2 VPC security groups to associate with this DB instance.
// This setting doesn't apply to Amazon Aurora DB instances. The associated list of
// EC2 VPC security groups is managed by the DB cluster. Default: The default EC2
// VPC security group for the DB subnet group's VPC.
VpcSecurityGroupIds []string
noSmithyDocumentSerde
}
type CreateDBInstanceOutput struct {
// Contains the details of an Amazon RDS DB instance. This data type is used as a
// response element in the operations CreateDBInstance ,
// CreateDBInstanceReadReplica , DeleteDBInstance , DescribeDBInstances ,
// ModifyDBInstance , PromoteReadReplica , RebootDBInstance ,
// RestoreDBInstanceFromDBSnapshot , RestoreDBInstanceFromS3 ,
// RestoreDBInstanceToPointInTime , StartDBInstance , and StopDBInstance .
DBInstance *types.DBInstance
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBInstance{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBInstance{}, 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 = addOpCreateDBInstanceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBInstance(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_opCreateDBInstance(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBInstance",
}
}
| 748 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"fmt"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
"github.com/aws/aws-sdk-go-v2/service/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new DB instance that acts as a read replica for an existing source DB
// instance or Multi-AZ DB cluster. You can create a read replica for a DB instance
// running MySQL, MariaDB, Oracle, PostgreSQL, or SQL Server. You can create a read
// replica for a Multi-AZ DB cluster running MySQL or PostgreSQL. For more
// information, see Working with read replicas (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html)
// and Migrating from a Multi-AZ DB cluster to a DB instance using a read replica (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html#multi-az-db-clusters-migrating-to-instance-with-read-replica)
// in the Amazon RDS User Guide. Amazon Aurora doesn't support this operation. Call
// the CreateDBInstance operation to create a DB instance for an Aurora DB
// cluster. All read replica DB instances are created with backups disabled. All
// other attributes (including DB security groups and DB parameter groups) are
// inherited from the source DB instance or cluster, except as specified. Your
// source DB instance or cluster must have backup retention enabled.
func (c *Client) CreateDBInstanceReadReplica(ctx context.Context, params *CreateDBInstanceReadReplicaInput, optFns ...func(*Options)) (*CreateDBInstanceReadReplicaOutput, error) {
if params == nil {
params = &CreateDBInstanceReadReplicaInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBInstanceReadReplica", params, optFns, c.addOperationCreateDBInstanceReadReplicaMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBInstanceReadReplicaOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBInstanceReadReplicaInput struct {
// The DB instance identifier of the read replica. This identifier is the unique
// key that identifies a DB instance. This parameter is stored as a lowercase
// string.
//
// This member is required.
DBInstanceIdentifier *string
// The amount of storage (in gibibytes) to allocate initially for the read
// replica. Follow the allocation rules specified in CreateDBInstance . Be sure to
// allocate enough storage for your read replica so that the create operation can
// succeed. You can also allocate additional storage for future growth.
AllocatedStorage *int32
// A value that indicates whether minor engine upgrades are applied automatically
// to the read replica during the maintenance window. This setting doesn't apply to
// RDS Custom. Default: Inherits from the source DB instance
AutoMinorVersionUpgrade *bool
// The Availability Zone (AZ) where the read replica will be created. Default: A
// random, system-chosen Availability Zone in the endpoint's Amazon Web Services
// Region. Example: us-east-1d
AvailabilityZone *string
// A value that indicates whether to copy all tags from the read replica to
// snapshots of the read replica. By default, tags are not copied.
CopyTagsToSnapshot *bool
// The instance profile associated with the underlying Amazon EC2 instance of an
// RDS Custom DB instance. The instance profile must meet the following
// requirements:
// - The profile must exist in your account.
// - The profile must have an IAM role that Amazon EC2 has permissions to
// assume.
// - The instance profile name and the associated IAM role name must start with
// the prefix AWSRDSCustom .
// For the list of permissions required for the IAM role, see Configure IAM and
// your VPC (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-setup-orcl.html#custom-setup-orcl.iam-vpc)
// in the Amazon RDS User Guide. This setting is required for RDS Custom.
CustomIamInstanceProfile *string
// The compute and memory capacity of the read replica, for example db.m4.large.
// Not all DB instance classes are available in all Amazon Web Services Regions, or
// for all database engines. For the full list of DB instance classes, and
// availability for your engine, see DB Instance Class (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html)
// in the Amazon RDS User Guide. Default: Inherits from the source DB instance.
DBInstanceClass *string
// The name of the DB parameter group to associate with this DB instance. If you
// do not specify a value for DBParameterGroupName , then Amazon RDS uses the
// DBParameterGroup of source DB instance for a same Region read replica, or the
// default DBParameterGroup for the specified DB engine for a cross-Region read
// replica. Specifying a parameter group for this operation is only supported for
// MySQL and Oracle DB instances. It isn't supported for RDS Custom. Constraints:
// - Must be 1 to 255 letters, numbers, or hyphens.
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
DBParameterGroupName *string
// Specifies a DB subnet group for the DB instance. The new DB instance is created
// in the VPC associated with the DB subnet group. If no DB subnet group is
// specified, then the new DB instance isn't created in a VPC. Constraints:
// - If supplied, must match the name of an existing DBSubnetGroup.
// - The specified DB subnet group must be in the same Amazon Web Services
// Region in which the operation is running.
// - All read replicas in one Amazon Web Services Region that are created from
// the same source DB instance must either:>
// - Specify DB subnet groups from the same VPC. All these read replicas are
// created in the same VPC.
// - Not specify a DB subnet group. All these read replicas are created outside
// of any VPC.
// Example: mydbsubnetgroup
DBSubnetGroupName *string
// A value that indicates whether the DB instance has deletion protection enabled.
// The database can't be deleted when deletion protection is enabled. By default,
// deletion protection isn't enabled. For more information, see Deleting a DB
// Instance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_DeleteInstance.html)
// .
DeletionProtection *bool
// The Active Directory directory ID to create the DB instance in. Currently, only
// MySQL, Microsoft SQL Server, Oracle, and PostgreSQL DB instances can be created
// in an Active Directory Domain. For more information, see Kerberos Authentication (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/kerberos-authentication.html)
// in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom.
Domain *string
// The ARN for the Secrets Manager secret that contains the credentials for the
// user performing the domain join. Example:
// arn:aws:secretsmanager:region:account-number:secret:myselfmanagedADtestsecret-123456
DomainAuthSecretArn *string
// The IPv4 DNS IP addresses of your primary and secondary Active Directory domain
// controllers. Constraints:
// - Two IP addresses must be provided. If there isn't a secondary domain
// controller, use the IP address of the primary domain controller for both entries
// in the list.
// Example: 123.124.125.126,234.235.236.237
DomainDnsIps []string
// Specifies the fully qualified domain name of an Active Directory domain.
// Constraints:
// - Cannot be greater than 64 characters.
// Example: mymanagedADtest.mymanagedAD.mydomain
DomainFqdn *string
// The name of the IAM role to be used when making API calls to the Directory
// Service. This setting doesn't apply to RDS Custom.
DomainIAMRoleName *string
// The Active Directory organizational unit for your DB instance to join.
// Constraints:
// - Must be in the distinguished name format.
// - Cannot be greater than 64 characters.
// Example: OU=mymanagedADtestOU,DC=mymanagedADtest,DC=mymanagedAD,DC=mydomain
DomainOu *string
// The list of logs that the new DB instance is to export to CloudWatch Logs. The
// values in the list depend on the DB engine being used. For more information, see
// Publishing Database Logs to Amazon CloudWatch Logs (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch)
// in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom.
EnableCloudwatchLogsExports []string
// A value that indicates whether to enable a customer-owned IP address (CoIP) for
// an RDS on Outposts read replica. A CoIP provides local or external connectivity
// to resources in your Outpost subnets through your on-premises network. For some
// use cases, a CoIP can provide lower latency for connections to the read replica
// from outside of its virtual private cloud (VPC) on your local network. For more
// information about RDS on Outposts, see Working with Amazon RDS on Amazon Web
// Services Outposts (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-on-outposts.html)
// in the Amazon RDS User Guide. For more information about CoIPs, see
// Customer-owned IP addresses (https://docs.aws.amazon.com/outposts/latest/userguide/routing.html#ip-addressing)
// in the Amazon Web Services Outposts User Guide.
EnableCustomerOwnedIp *bool
// A value that indicates whether to enable mapping of Amazon Web Services
// Identity and Access Management (IAM) accounts to database accounts. By default,
// mapping isn't enabled. For more information about IAM database authentication,
// see IAM Database Authentication for MySQL and PostgreSQL (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html)
// in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom.
EnableIAMDatabaseAuthentication *bool
// A value that indicates whether to enable Performance Insights for the read
// replica. For more information, see Using Amazon Performance Insights (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html)
// in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom.
EnablePerformanceInsights *bool
// The amount of Provisioned IOPS (input/output operations per second) to be
// initially allocated for the DB instance.
Iops *int32
// The Amazon Web Services KMS key identifier for an encrypted read replica. The
// Amazon Web Services KMS key identifier is the key ARN, key ID, alias ARN, or
// alias name for the KMS key. If you create an encrypted read replica in the same
// Amazon Web Services Region as the source DB instance or Multi-AZ DB cluster,
// don't specify a value for this parameter. A read replica in the same Amazon Web
// Services Region is always encrypted with the same KMS key as the source DB
// instance or cluster. If you create an encrypted read replica in a different
// Amazon Web Services Region, then you must specify a KMS key identifier for the
// destination Amazon Web Services Region. KMS keys are specific to the Amazon Web
// Services Region that they are created in, and you can't use KMS keys from one
// Amazon Web Services Region in another Amazon Web Services Region. You can't
// create an encrypted read replica from an unencrypted DB instance or Multi-AZ DB
// cluster. This setting doesn't apply to RDS Custom, which uses the same KMS key
// as the primary replica.
KmsKeyId *string
// The upper limit in gibibytes (GiB) to which Amazon RDS can automatically scale
// the storage of the DB instance. For more information about this setting,
// including limitations that apply to it, see Managing capacity automatically
// with Amazon RDS storage autoscaling (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling)
// in the Amazon RDS User Guide.
MaxAllocatedStorage *int32
// The interval, in seconds, between points when Enhanced Monitoring metrics are
// collected for the read replica. To disable collecting Enhanced Monitoring
// metrics, specify 0. The default is 0. If MonitoringRoleArn is specified, then
// you must also set MonitoringInterval to a value other than 0. This setting
// doesn't apply to RDS Custom. Valid Values: 0, 1, 5, 10, 15, 30, 60
MonitoringInterval *int32
// The ARN for the IAM role that permits RDS to send enhanced monitoring metrics
// to Amazon CloudWatch Logs. For example, arn:aws:iam:123456789012:role/emaccess .
// For information on creating a monitoring role, go to To create an IAM role for
// Amazon RDS Enhanced Monitoring (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.html#USER_Monitoring.OS.IAMRole)
// in the Amazon RDS User Guide. If MonitoringInterval is set to a value other
// than 0, then you must supply a MonitoringRoleArn value. This setting doesn't
// apply to RDS Custom.
MonitoringRoleArn *string
// A value that indicates whether the read replica is in a Multi-AZ deployment.
// You can create a read replica as a Multi-AZ DB instance. RDS creates a standby
// of your replica in another Availability Zone for failover support for the
// replica. Creating your read replica as a Multi-AZ DB instance is independent of
// whether the source is a Multi-AZ DB instance or a Multi-AZ DB cluster. This
// setting doesn't apply to RDS Custom.
MultiAZ *bool
// The network type of the DB instance. Valid values:
// - IPV4
// - DUAL
// The network type is determined by the DBSubnetGroup specified for read replica.
// A DBSubnetGroup can support only the IPv4 protocol or the IPv4 and the IPv6
// protocols ( DUAL ). For more information, see Working with a DB instance in a
// VPC (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.WorkingWithRDSInstanceinaVPC.html)
// in the Amazon RDS User Guide.
NetworkType *string
// The option group the DB instance is associated with. If omitted, the option
// group associated with the source instance or cluster is used. For SQL Server,
// you must use the option group associated with the source. This setting doesn't
// apply to RDS Custom.
OptionGroupName *string
// The Amazon Web Services KMS key identifier for encryption of Performance
// Insights data. The Amazon Web Services KMS key identifier is the key ARN, key
// ID, alias ARN, or alias name for the KMS key. If you do not specify a value for
// PerformanceInsightsKMSKeyId , then Amazon RDS uses your default KMS key. There
// is a default KMS key for your Amazon Web Services account. Your Amazon Web
// Services account has a different default KMS key for each Amazon Web Services
// Region. This setting doesn't apply to RDS Custom.
PerformanceInsightsKMSKeyId *string
// The number of days to retain Performance Insights data. The default is 7 days.
// The following values are valid:
// - 7
// - month * 31, where month is a number of months from 1-23
// - 731
// For example, the following values are valid:
// - 93 (3 months * 31)
// - 341 (11 months * 31)
// - 589 (19 months * 31)
// - 731
// If you specify a retention period such as 94, which isn't a valid value, RDS
// issues an error. This setting doesn't apply to RDS Custom.
PerformanceInsightsRetentionPeriod *int32
// The port number that the DB instance uses for connections. Default: Inherits
// from the source DB instance Valid Values: 1150-65535
Port *int32
// When you are creating a read replica from one Amazon Web Services GovCloud (US)
// Region to another or from one China Amazon Web Services Region to another, the
// URL that contains a Signature Version 4 signed request for the
// CreateDBInstanceReadReplica API operation in the source Amazon Web Services
// Region that contains the source DB instance. This setting applies only to Amazon
// Web Services GovCloud (US) Regions and China Amazon Web Services Regions. It's
// ignored in other Amazon Web Services Regions. This setting applies only when
// replicating from a source DB instance. Source DB clusters aren't supported in
// Amazon Web Services GovCloud (US) Regions and China Amazon Web Services Regions.
// You must specify this parameter when you create an encrypted read replica from
// another Amazon Web Services Region by using the Amazon RDS API. Don't specify
// PreSignedUrl when you are creating an encrypted read replica in the same Amazon
// Web Services Region. The presigned URL must be a valid request for the
// CreateDBInstanceReadReplica API operation that can run in the source Amazon Web
// Services Region that contains the encrypted source DB instance. The presigned
// URL request must contain the following parameter values:
// - DestinationRegion - The Amazon Web Services Region that the encrypted read
// replica is created in. This Amazon Web Services Region is the same one where the
// CreateDBInstanceReadReplica operation is called that contains this presigned
// URL. For example, if you create an encrypted DB instance in the us-west-1 Amazon
// Web Services Region, from a source DB instance in the us-east-2 Amazon Web
// Services Region, then you call the CreateDBInstanceReadReplica operation in
// the us-east-1 Amazon Web Services Region and provide a presigned URL that
// contains a call to the CreateDBInstanceReadReplica operation in the us-west-2
// Amazon Web Services Region. For this example, the DestinationRegion in the
// presigned URL must be set to the us-east-1 Amazon Web Services Region.
// - KmsKeyId - The KMS key identifier for the key to use to encrypt the read
// replica in the destination Amazon Web Services Region. This is the same
// identifier for both the CreateDBInstanceReadReplica operation that is called
// in the destination Amazon Web Services Region, and the operation contained in
// the presigned URL.
// - SourceDBInstanceIdentifier - The DB instance identifier for the encrypted DB
// instance to be replicated. This identifier must be in the Amazon Resource Name
// (ARN) format for the source Amazon Web Services Region. For example, if you are
// creating an encrypted read replica from a DB instance in the us-west-2 Amazon
// Web Services Region, then your SourceDBInstanceIdentifier looks like the
// following example:
// arn:aws:rds:us-west-2:123456789012:instance:mysql-instance1-20161115 .
// To learn how to generate a Signature Version 4 signed request, see
// Authenticating Requests: Using Query Parameters (Amazon Web Services Signature
// Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html)
// and Signature Version 4 Signing Process (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)
// . If you are using an Amazon Web Services SDK tool or the CLI, you can specify
// SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl
// manually. Specifying SourceRegion autogenerates a presigned URL that is a valid
// request for the operation that can run in the source Amazon Web Services Region.
// SourceRegion isn't supported for SQL Server, because Amazon RDS for SQL Server
// doesn't support cross-Region read replicas. This setting doesn't apply to RDS
// Custom.
PreSignedUrl *string
// The number of CPU cores and the number of threads per core for the DB instance
// class of the DB instance. This setting doesn't apply to RDS Custom.
ProcessorFeatures []types.ProcessorFeature
// A value that indicates whether the DB instance is publicly accessible. When the
// DB cluster is publicly accessible, its Domain Name System (DNS) endpoint
// resolves to the private IP address from within the DB cluster's virtual private
// cloud (VPC). It resolves to the public IP address from outside of the DB
// cluster's VPC. Access to the DB cluster is ultimately controlled by the security
// group it uses. That public access isn't permitted if the security group assigned
// to the DB cluster doesn't permit it. When the DB instance isn't publicly
// accessible, it is an internal DB instance with a DNS name that resolves to a
// private IP address. For more information, see CreateDBInstance .
PubliclyAccessible *bool
// The open mode of the replica database: mounted or read-only. This parameter is
// only supported for Oracle DB instances. Mounted DB replicas are included in
// Oracle Database Enterprise Edition. The main use case for mounted replicas is
// cross-Region disaster recovery. The primary database doesn't use Active Data
// Guard to transmit information to the mounted replica. Because it doesn't accept
// user connections, a mounted replica can't serve a read-only workload. You can
// create a combination of mounted and read-only DB replicas for the same primary
// DB instance. For more information, see Working with Oracle Read Replicas for
// Amazon RDS (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-read-replicas.html)
// in the Amazon RDS User Guide. For RDS Custom, you must specify this parameter
// and set it to mounted . The value won't be set by default. After replica
// creation, you can manage the open mode manually.
ReplicaMode types.ReplicaMode
// The identifier of the Multi-AZ DB cluster that will act as the source for the
// read replica. Each DB cluster can have up to 15 read replicas. Constraints:
// - Must be the identifier of an existing Multi-AZ DB cluster.
// - Can't be specified if the SourceDBInstanceIdentifier parameter is also
// specified.
// - The specified DB cluster must have automatic backups enabled, that is, its
// backup retention period must be greater than 0.
// - The source DB cluster must be in the same Amazon Web Services Region as the
// read replica. Cross-Region replication isn't supported.
SourceDBClusterIdentifier *string
// The identifier of the DB instance that will act as the source for the read
// replica. Each DB instance can have up to 15 read replicas, with the exception of
// Oracle and SQL Server, which can have up to five. Constraints:
// - Must be the identifier of an existing MySQL, MariaDB, Oracle, PostgreSQL,
// or SQL Server DB instance.
// - Can't be specified if the SourceDBClusterIdentifier parameter is also
// specified.
// - For the limitations of Oracle read replicas, see Version and licensing
// considerations for RDS for Oracle replicas (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/oracle-read-replicas.limitations.html#oracle-read-replicas.limitations.versions-and-licenses)
// in the Amazon RDS User Guide.
// - For the limitations of SQL Server read replicas, see Read replica
// limitations with SQL Server (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.ReadReplicas.html#SQLServer.ReadReplicas.Limitations)
// in the Amazon RDS User Guide.
// - The specified DB instance must have automatic backups enabled, that is, its
// backup retention period must be greater than 0.
// - If the source DB instance is in the same Amazon Web Services Region as the
// read replica, specify a valid DB instance identifier.
// - If the source DB instance is in a different Amazon Web Services Region from
// the read replica, specify a valid DB instance ARN. For more information, see
// Constructing an ARN for Amazon RDS (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.ARN.html#USER_Tagging.ARN.Constructing)
// in the Amazon RDS User Guide. This doesn't apply to SQL Server or RDS Custom,
// which don't support cross-Region replicas.
SourceDBInstanceIdentifier *string
// The AWS region the resource is in. The presigned URL will be created with this
// region, if the PresignURL member is empty set.
SourceRegion *string
// Specifies the storage throughput value for the read replica. This setting
// doesn't apply to RDS Custom or Amazon Aurora.
StorageThroughput *int32
// Specifies the storage type to be associated with the read replica. Valid
// values: gp2 | gp3 | io1 | standard If you specify io1 or gp3 , you must also
// include a value for the Iops parameter. Default: io1 if the Iops parameter is
// specified, otherwise gp2
StorageType *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
// A value that indicates whether the DB instance class of the DB instance uses
// its default processor features. This setting doesn't apply to RDS Custom.
UseDefaultProcessorFeatures *bool
// A list of Amazon EC2 VPC security groups to associate with the read replica.
// This setting doesn't apply to RDS Custom. Default: The default EC2 VPC security
// group for the DB subnet group's VPC.
VpcSecurityGroupIds []string
// Used by the SDK's PresignURL autofill customization to specify the region the
// of the client's request.
destinationRegion *string
noSmithyDocumentSerde
}
type CreateDBInstanceReadReplicaOutput struct {
// Contains the details of an Amazon RDS DB instance. This data type is used as a
// response element in the operations CreateDBInstance ,
// CreateDBInstanceReadReplica , DeleteDBInstance , DescribeDBInstances ,
// ModifyDBInstance , PromoteReadReplica , RebootDBInstance ,
// RestoreDBInstanceFromDBSnapshot , RestoreDBInstanceFromS3 ,
// RestoreDBInstanceToPointInTime , StartDBInstance , and StopDBInstance .
DBInstance *types.DBInstance
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBInstanceReadReplicaMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBInstanceReadReplica{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBInstanceReadReplica{}, 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 = addCreateDBInstanceReadReplicaPresignURLMiddleware(stack, options); err != nil {
return err
}
if err = addOpCreateDBInstanceReadReplicaValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBInstanceReadReplica(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 copyCreateDBInstanceReadReplicaInputForPresign(params interface{}) (interface{}, error) {
input, ok := params.(*CreateDBInstanceReadReplicaInput)
if !ok {
return nil, fmt.Errorf("expect *CreateDBInstanceReadReplicaInput type, got %T", params)
}
cpy := *input
return &cpy, nil
}
func getCreateDBInstanceReadReplicaPreSignedUrl(params interface{}) (string, bool, error) {
input, ok := params.(*CreateDBInstanceReadReplicaInput)
if !ok {
return ``, false, fmt.Errorf("expect *CreateDBInstanceReadReplicaInput type, got %T", params)
}
if input.PreSignedUrl == nil || len(*input.PreSignedUrl) == 0 {
return ``, false, nil
}
return *input.PreSignedUrl, true, nil
}
func getCreateDBInstanceReadReplicaSourceRegion(params interface{}) (string, bool, error) {
input, ok := params.(*CreateDBInstanceReadReplicaInput)
if !ok {
return ``, false, fmt.Errorf("expect *CreateDBInstanceReadReplicaInput type, got %T", params)
}
if input.SourceRegion == nil || len(*input.SourceRegion) == 0 {
return ``, false, nil
}
return *input.SourceRegion, true, nil
}
func setCreateDBInstanceReadReplicaPreSignedUrl(params interface{}, value string) error {
input, ok := params.(*CreateDBInstanceReadReplicaInput)
if !ok {
return fmt.Errorf("expect *CreateDBInstanceReadReplicaInput type, got %T", params)
}
input.PreSignedUrl = &value
return nil
}
func setCreateDBInstanceReadReplicadestinationRegion(params interface{}, value string) error {
input, ok := params.(*CreateDBInstanceReadReplicaInput)
if !ok {
return fmt.Errorf("expect *CreateDBInstanceReadReplicaInput type, got %T", params)
}
input.destinationRegion = &value
return nil
}
func addCreateDBInstanceReadReplicaPresignURLMiddleware(stack *middleware.Stack, options Options) error {
return presignedurlcust.AddMiddleware(stack, presignedurlcust.Options{
Accessor: presignedurlcust.ParameterAccessor{
GetPresignedURL: getCreateDBInstanceReadReplicaPreSignedUrl,
GetSourceRegion: getCreateDBInstanceReadReplicaSourceRegion,
CopyInput: copyCreateDBInstanceReadReplicaInputForPresign,
SetDestinationRegion: setCreateDBInstanceReadReplicadestinationRegion,
SetPresignedURL: setCreateDBInstanceReadReplicaPreSignedUrl,
},
Presigner: &presignAutoFillCreateDBInstanceReadReplicaClient{client: NewPresignClient(New(options))},
})
}
type presignAutoFillCreateDBInstanceReadReplicaClient struct {
client *PresignClient
}
// PresignURL is a middleware accessor that satisfies URLPresigner interface.
func (c *presignAutoFillCreateDBInstanceReadReplicaClient) PresignURL(ctx context.Context, srcRegion string, params interface{}) (*v4.PresignedHTTPRequest, error) {
input, ok := params.(*CreateDBInstanceReadReplicaInput)
if !ok {
return nil, fmt.Errorf("expect *CreateDBInstanceReadReplicaInput type, got %T", params)
}
optFn := func(o *Options) {
o.Region = srcRegion
o.APIOptions = append(o.APIOptions, presignedurlcust.RemoveMiddleware)
}
presignOptFn := WithPresignClientFromClientOptions(optFn)
return c.client.PresignCreateDBInstanceReadReplica(ctx, input, presignOptFn)
}
func newServiceMetadataMiddleware_opCreateDBInstanceReadReplica(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBInstanceReadReplica",
}
}
// PresignCreateDBInstanceReadReplica is used to generate a presigned HTTP Request
// which contains presigned URL, signed headers and HTTP method used.
func (c *PresignClient) PresignCreateDBInstanceReadReplica(ctx context.Context, params *CreateDBInstanceReadReplicaInput, optFns ...func(*PresignOptions)) (*v4.PresignedHTTPRequest, error) {
if params == nil {
params = &CreateDBInstanceReadReplicaInput{}
}
options := c.options.copy()
for _, fn := range optFns {
fn(&options)
}
clientOptFns := append(options.ClientOptions, withNopHTTPClientAPIOption)
result, _, err := c.client.invokeOperation(ctx, "CreateDBInstanceReadReplica", params, clientOptFns,
c.client.addOperationCreateDBInstanceReadReplicaMiddlewares,
presignConverter(options).convertToPresignMiddleware,
)
if err != nil {
return nil, err
}
out := result.(*v4.PresignedHTTPRequest)
return out, nil
}
| 630 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/internal/awstesting/unit"
presignedurlcust "github.com/aws/aws-sdk-go-v2/service/internal/presigned-url"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"net/http"
"strings"
"testing"
)
func TestClientCreateDBInstanceReadReplica_presignURLCustomization(t *testing.T) {
cases := map[string]struct {
Input *CreateDBInstanceReadReplicaInput
ClientRegion string
ExpectPresignedURL string
ExpectPresignedURLDestinationRegion string
ExpectRequestURL string
ExpectErr string
}{
"have presigned URL no auto fill": {
Input: &CreateDBInstanceReadReplicaInput{
PreSignedUrl: aws.String("https://example.aws/signed-url"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://example.aws/signed-url",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"no source region no auto fill": {
Input: &CreateDBInstanceReadReplicaInput{},
ClientRegion: "mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"auto fill presign URL matching region": {
Input: &CreateDBInstanceReadReplicaInput{
SourceRegion: aws.String("mock-region"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://service.mock-region.amazonaws.com/",
ExpectPresignedURLDestinationRegion: "DestinationRegion=mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
"auto fill presign URL different region": {
Input: &CreateDBInstanceReadReplicaInput{
SourceRegion: aws.String("mock-other-region"),
},
ClientRegion: "mock-region",
ExpectPresignedURL: "https://service.mock-other-region.amazonaws.com/",
ExpectPresignedURLDestinationRegion: "DestinationRegion=mock-region",
ExpectRequestURL: "https://service.mock-region.amazonaws.com/",
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
client := New(Options{
Region: c.ClientRegion,
Credentials: unit.StubCredentialsProvider{},
HTTPClient: smithyhttp.ClientDoFunc(func(r *http.Request) (*http.Response, error) {
if e, a := c.ExpectRequestURL, r.URL.String(); !strings.HasPrefix(a, e) {
t.Errorf("expect presigned URL to contain %v, got %v", e, a)
}
return smithyhttp.NopClient{}.Do(r)
}),
EndpointResolver: EndpointResolverFunc(
func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
return aws.Endpoint{
URL: "https://service." + region + ".amazonaws.com",
SigningRegion: c.ClientRegion,
}, nil
}),
})
_, err := client.CreateDBInstanceReadReplica(context.Background(), c.Input,
func(o *Options) {
o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) (err error) {
_, err = stack.Initialize.Remove("OperationInputValidation")
if err != nil {
return err
}
return stack.Serialize.Add(middleware.SerializeMiddlewareFunc(t.Name(),
func(
ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
) (
out middleware.SerializeOutput, metadata middleware.Metadata, err error,
) {
input, ok := in.Parameters.(*CreateDBInstanceReadReplicaInput)
if !ok {
t.Fatalf("expect CreateDBInstanceReadReplicaInput, got %T", in.Parameters)
}
// Switch based on if presign flow or not
if presignedurlcust.GetIsPresigning(ctx) {
// Presign Flow
if v := input.PreSignedUrl; v != nil {
t.Errorf("expect no presigned URL, got %v", *v)
}
if input.destinationRegion == nil {
t.Fatalf("expect destination region to be set")
}
if e, a := c.ClientRegion, *input.destinationRegion; e != a {
t.Errorf("expect %v destination region, got %v", e, a)
}
} else {
// Operation flow
if v := input.destinationRegion; v != nil {
t.Errorf("expect no destination region, got %v", *v)
}
if len(c.ExpectPresignedURL) != 0 {
if input.PreSignedUrl == nil {
t.Fatalf("expect presigned URL, got none")
}
if e, a := c.ExpectPresignedURL, *input.PreSignedUrl; !strings.HasPrefix(a, e) {
t.Errorf("expect presigned URL to contain %v, got %v", e, a)
}
if e, a := c.ExpectPresignedURLDestinationRegion, *input.PreSignedUrl; !strings.Contains(a, e) {
t.Errorf("expect presigned URL destination region to contain %v, got %v", e, a)
}
return next.HandleSerialize(ctx, in)
}
if v := input.PreSignedUrl; v != nil {
t.Errorf("expect no presigned url, got %v", *v)
}
}
return next.HandleSerialize(ctx, in)
},
), middleware.After)
})
},
)
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)
}
return
}
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
})
}
}
| 160 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new DB parameter group. A DB parameter group is initially created
// with the default parameters for the database engine used by the DB instance. To
// provide custom values for any of the parameters, you must modify the group after
// creating it using ModifyDBParameterGroup . Once you've created a DB parameter
// group, you need to associate it with your DB instance using ModifyDBInstance .
// When you associate a new DB parameter group with a running DB instance, you need
// to reboot the DB instance without failover for the new DB parameter group and
// associated settings to take effect. This command doesn't apply to RDS Custom.
// After you create a DB parameter group, you should wait at least 5 minutes before
// creating your first DB instance that uses that DB parameter group as the default
// parameter group. This allows Amazon RDS to fully complete the create action
// before the parameter group is used as the default for a new DB instance. This is
// especially important for parameters that are critical when creating the default
// database for a DB instance, such as the character set for the default database
// defined by the character_set_database parameter. You can use the Parameter
// Groups option of the Amazon RDS console (https://console.aws.amazon.com/rds/)
// or the DescribeDBParameters command to verify that your DB parameter group has
// been created or modified.
func (c *Client) CreateDBParameterGroup(ctx context.Context, params *CreateDBParameterGroupInput, optFns ...func(*Options)) (*CreateDBParameterGroupOutput, error) {
if params == nil {
params = &CreateDBParameterGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBParameterGroup", params, optFns, c.addOperationCreateDBParameterGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBParameterGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBParameterGroupInput struct {
// The DB parameter group family name. A DB parameter group can be associated with
// one and only one DB parameter group family, and can be applied only to a DB
// instance running a database engine and engine version compatible with that DB
// parameter group family. To list all of the available parameter group families
// for a DB engine, use the following command: aws rds describe-db-engine-versions
// --query "DBEngineVersions[].DBParameterGroupFamily" --engine For example, to
// list all of the available parameter group families for the MySQL DB engine, use
// the following command: aws rds describe-db-engine-versions --query
// "DBEngineVersions[].DBParameterGroupFamily" --engine mysql The output contains
// duplicates. The following are the valid DB engine values:
// - aurora-mysql
// - aurora-postgresql
// - mariadb
// - mysql
// - oracle-ee
// - oracle-ee-cdb
// - oracle-se2
// - oracle-se2-cdb
// - postgres
// - sqlserver-ee
// - sqlserver-se
// - sqlserver-ex
// - sqlserver-web
//
// This member is required.
DBParameterGroupFamily *string
// The name of the DB parameter group. Constraints:
// - Must be 1 to 255 letters, numbers, or hyphens.
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// This value is stored as a lowercase string.
//
// This member is required.
DBParameterGroupName *string
// The description for the DB parameter group.
//
// This member is required.
Description *string
// Tags to assign to the DB parameter group.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateDBParameterGroupOutput struct {
// Contains the details of an Amazon RDS DB parameter group. This data type is
// used as a response element in the DescribeDBParameterGroups action.
DBParameterGroup *types.DBParameterGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBParameterGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBParameterGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBParameterGroup{}, 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 = addOpCreateDBParameterGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBParameterGroup(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_opCreateDBParameterGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBParameterGroup",
}
}
| 182 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new DB proxy.
func (c *Client) CreateDBProxy(ctx context.Context, params *CreateDBProxyInput, optFns ...func(*Options)) (*CreateDBProxyOutput, error) {
if params == nil {
params = &CreateDBProxyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBProxy", params, optFns, c.addOperationCreateDBProxyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBProxyOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBProxyInput struct {
// The authorization mechanism that the proxy uses.
//
// This member is required.
Auth []types.UserAuthConfig
// The identifier for the proxy. This name must be unique for all proxies owned by
// your Amazon Web Services account in the specified Amazon Web Services Region. An
// identifier must begin with a letter and must contain only ASCII letters, digits,
// and hyphens; it can't end with a hyphen or contain two consecutive hyphens.
//
// This member is required.
DBProxyName *string
// The kinds of databases that the proxy can connect to. This value determines
// which database network protocol the proxy recognizes when it interprets network
// traffic to and from the database. For Aurora MySQL, RDS for MariaDB, and RDS for
// MySQL databases, specify MYSQL . For Aurora PostgreSQL and RDS for PostgreSQL
// databases, specify POSTGRESQL . For RDS for Microsoft SQL Server, specify
// SQLSERVER .
//
// This member is required.
EngineFamily types.EngineFamily
// The Amazon Resource Name (ARN) of the IAM role that the proxy uses to access
// secrets in Amazon Web Services Secrets Manager.
//
// This member is required.
RoleArn *string
// One or more VPC subnet IDs to associate with the new proxy.
//
// This member is required.
VpcSubnetIds []string
// Whether the proxy includes detailed information about SQL statements in its
// logs. This information helps you to debug issues involving SQL behavior or the
// performance and scalability of the proxy connections. The debug information
// includes the text of SQL statements that you submit through the proxy. Thus,
// only enable this setting when needed for debugging, and only when you have
// security measures in place to safeguard any sensitive information that appears
// in the logs.
DebugLogging bool
// The number of seconds that a connection to the proxy can be inactive before the
// proxy disconnects it. You can set this value higher or lower than the connection
// timeout limit for the associated database.
IdleClientTimeout *int32
// A Boolean parameter that specifies whether Transport Layer Security (TLS)
// encryption is required for connections to the proxy. By enabling this setting,
// you can enforce encrypted TLS connections to the proxy.
RequireTLS bool
// An optional set of key-value pairs to associate arbitrary data of your choosing
// with the proxy.
Tags []types.Tag
// One or more VPC security group IDs to associate with the new proxy.
VpcSecurityGroupIds []string
noSmithyDocumentSerde
}
type CreateDBProxyOutput struct {
// The DBProxy structure corresponding to the new proxy.
DBProxy *types.DBProxy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBProxyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBProxy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBProxy{}, 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 = addOpCreateDBProxyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBProxy(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_opCreateDBProxy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBProxy",
}
}
| 180 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a DBProxyEndpoint . Only applies to proxies that are associated with
// Aurora DB clusters. You can use DB proxy endpoints to specify read/write or
// read-only access to the DB cluster. You can also use DB proxy endpoints to
// access a DB proxy through a different VPC than the proxy's default VPC.
func (c *Client) CreateDBProxyEndpoint(ctx context.Context, params *CreateDBProxyEndpointInput, optFns ...func(*Options)) (*CreateDBProxyEndpointOutput, error) {
if params == nil {
params = &CreateDBProxyEndpointInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBProxyEndpoint", params, optFns, c.addOperationCreateDBProxyEndpointMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBProxyEndpointOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBProxyEndpointInput struct {
// The name of the DB proxy endpoint to create.
//
// This member is required.
DBProxyEndpointName *string
// The name of the DB proxy associated with the DB proxy endpoint that you create.
//
// This member is required.
DBProxyName *string
// The VPC subnet IDs for the DB proxy endpoint that you create. You can specify a
// different set of subnet IDs than for the original DB proxy.
//
// This member is required.
VpcSubnetIds []string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
// A value that indicates whether the DB proxy endpoint can be used for read/write
// or read-only operations. The default is READ_WRITE . The only role that proxies
// for RDS for Microsoft SQL Server support is READ_WRITE .
TargetRole types.DBProxyEndpointTargetRole
// The VPC security group IDs for the DB proxy endpoint that you create. You can
// specify a different set of security group IDs than for the original DB proxy.
// The default is the default security group for the VPC.
VpcSecurityGroupIds []string
noSmithyDocumentSerde
}
type CreateDBProxyEndpointOutput struct {
// The DBProxyEndpoint object that is created by the API operation. The DB proxy
// endpoint that you create might provide capabilities such as read/write or
// read-only operations, or using a different VPC than the proxy's default VPC.
DBProxyEndpoint *types.DBProxyEndpoint
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBProxyEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBProxyEndpoint{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBProxyEndpoint{}, 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 = addOpCreateDBProxyEndpointValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBProxyEndpoint(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_opCreateDBProxyEndpoint(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBProxyEndpoint",
}
}
| 155 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new DB security group. DB security groups control access to a DB
// instance. A DB security group controls access to EC2-Classic DB instances that
// are not in a VPC. EC2-Classic was retired on August 15, 2022. If you haven't
// migrated from EC2-Classic to a VPC, we recommend that you migrate as soon as
// possible. For more information, see Migrate from EC2-Classic to a VPC (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-migrate.html)
// in the Amazon EC2 User Guide, the blog EC2-Classic Networking is Retiring –
// Here’s How to Prepare (http://aws.amazon.com/blogs/aws/ec2-classic-is-retiring-heres-how-to-prepare/)
// , and Moving a DB instance not in a VPC into a VPC (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.Non-VPC2VPC.html)
// in the Amazon RDS User Guide.
func (c *Client) CreateDBSecurityGroup(ctx context.Context, params *CreateDBSecurityGroupInput, optFns ...func(*Options)) (*CreateDBSecurityGroupOutput, error) {
if params == nil {
params = &CreateDBSecurityGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBSecurityGroup", params, optFns, c.addOperationCreateDBSecurityGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBSecurityGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBSecurityGroupInput struct {
// The description for the DB security group.
//
// This member is required.
DBSecurityGroupDescription *string
// The name for the DB security group. This value is stored as a lowercase string.
// Constraints:
// - Must be 1 to 255 letters, numbers, or hyphens.
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// - Must not be "Default"
// Example: mysecuritygroup
//
// This member is required.
DBSecurityGroupName *string
// Tags to assign to the DB security group.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateDBSecurityGroupOutput struct {
// Contains the details for an Amazon RDS DB security group. This data type is
// used as a response element in the DescribeDBSecurityGroups action.
DBSecurityGroup *types.DBSecurityGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBSecurityGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBSecurityGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBSecurityGroup{}, 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 = addOpCreateDBSecurityGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBSecurityGroup(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_opCreateDBSecurityGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBSecurityGroup",
}
}
| 148 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a snapshot of a DB instance. The source DB instance must be in the
// available or storage-optimization state.
func (c *Client) CreateDBSnapshot(ctx context.Context, params *CreateDBSnapshotInput, optFns ...func(*Options)) (*CreateDBSnapshotOutput, error) {
if params == nil {
params = &CreateDBSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBSnapshot", params, optFns, c.addOperationCreateDBSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBSnapshotInput struct {
// The identifier of the DB instance that you want to create the snapshot of.
// Constraints:
// - Must match the identifier of an existing DBInstance.
//
// This member is required.
DBInstanceIdentifier *string
// The identifier for the DB snapshot. Constraints:
// - Can't be null, empty, or blank
// - Must contain from 1 to 255 letters, numbers, or hyphens
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// Example: my-snapshot-id
//
// This member is required.
DBSnapshotIdentifier *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateDBSnapshotOutput struct {
// Contains the details of an Amazon RDS DB snapshot. This data type is used as a
// response element in the DescribeDBSnapshots action.
DBSnapshot *types.DBSnapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBSnapshot{}, 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 = addOpCreateDBSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBSnapshot(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_opCreateDBSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBSnapshot",
}
}
| 143 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new DB subnet group. DB subnet groups must contain at least one
// subnet in at least two AZs in the Amazon Web Services Region.
func (c *Client) CreateDBSubnetGroup(ctx context.Context, params *CreateDBSubnetGroupInput, optFns ...func(*Options)) (*CreateDBSubnetGroupOutput, error) {
if params == nil {
params = &CreateDBSubnetGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateDBSubnetGroup", params, optFns, c.addOperationCreateDBSubnetGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateDBSubnetGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateDBSubnetGroupInput struct {
// The description for the DB subnet group.
//
// This member is required.
DBSubnetGroupDescription *string
// The name for the DB subnet group. This value is stored as a lowercase string.
// Constraints:
// - Must contain no more than 255 letters, numbers, periods, underscores,
// spaces, or hyphens.
// - Must not be default.
// - First character must be a letter.
// Example: mydbsubnetgroup
//
// This member is required.
DBSubnetGroupName *string
// The EC2 Subnet IDs for the DB subnet group.
//
// This member is required.
SubnetIds []string
// Tags to assign to the DB subnet group.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateDBSubnetGroupOutput struct {
// Contains the details of an Amazon RDS DB subnet group. This data type is used
// as a response element in the DescribeDBSubnetGroups action.
DBSubnetGroup *types.DBSubnetGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateDBSubnetGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateDBSubnetGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateDBSubnetGroup{}, 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 = addOpCreateDBSubnetGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDBSubnetGroup(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_opCreateDBSubnetGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateDBSubnetGroup",
}
}
| 146 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an RDS event notification subscription. This operation requires a topic
// Amazon Resource Name (ARN) created by either the RDS console, the SNS console,
// or the SNS API. To obtain an ARN with SNS, you must create a topic in Amazon SNS
// and subscribe to the topic. The ARN is displayed in the SNS console. You can
// specify the type of source ( SourceType ) that you want to be notified of and
// provide a list of RDS sources ( SourceIds ) that triggers the events. You can
// also provide a list of event categories ( EventCategories ) for events that you
// want to be notified of. For example, you can specify SourceType = db-instance ,
// SourceIds = mydbinstance1 , mydbinstance2 and EventCategories = Availability ,
// Backup . If you specify both the SourceType and SourceIds , such as SourceType
// = db-instance and SourceIds = myDBInstance1 , you are notified of all the
// db-instance events for the specified source. If you specify a SourceType but do
// not specify SourceIds , you receive notice of the events for that source type
// for all your RDS sources. If you don't specify either the SourceType or the
// SourceIds , you are notified of events generated from all RDS sources belonging
// to your customer account. For more information about subscribing to an event for
// RDS DB engines, see Subscribing to Amazon RDS event notification (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.Subscribing.html)
// in the Amazon RDS User Guide. For more information about subscribing to an event
// for Aurora DB engines, see Subscribing to Amazon RDS event notification (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_Events.Subscribing.html)
// in the Amazon Aurora User Guide.
func (c *Client) CreateEventSubscription(ctx context.Context, params *CreateEventSubscriptionInput, optFns ...func(*Options)) (*CreateEventSubscriptionOutput, error) {
if params == nil {
params = &CreateEventSubscriptionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateEventSubscription", params, optFns, c.addOperationCreateEventSubscriptionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateEventSubscriptionOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateEventSubscriptionInput struct {
// The Amazon Resource Name (ARN) of the SNS topic created for event notification.
// The ARN is created by Amazon SNS when you create a topic and subscribe to it.
//
// This member is required.
SnsTopicArn *string
// The name of the subscription. Constraints: The name must be less than 255
// characters.
//
// This member is required.
SubscriptionName *string
// A value that indicates whether to activate the subscription. If the event
// notification subscription isn't activated, the subscription is created but not
// active.
Enabled *bool
// A list of event categories for a particular source type ( SourceType ) that you
// want to subscribe to. You can see a list of the categories for a given source
// type in the "Amazon RDS event categories and event messages" section of the
// Amazon RDS User Guide (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.Messages.html)
// or the Amazon Aurora User Guide (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_Events.Messages.html)
// . You can also see this list by using the DescribeEventCategories operation.
EventCategories []string
// The list of identifiers of the event sources for which events are returned. If
// not specified, then all sources are included in the response. An identifier must
// begin with a letter and must contain only ASCII letters, digits, and hyphens. It
// can't end with a hyphen or contain two consecutive hyphens. Constraints:
// - If SourceIds are supplied, SourceType must also be provided.
// - If the source type is a DB instance, a DBInstanceIdentifier value must be
// supplied.
// - If the source type is a DB cluster, a DBClusterIdentifier value must be
// supplied.
// - If the source type is a DB parameter group, a DBParameterGroupName value
// must be supplied.
// - If the source type is a DB security group, a DBSecurityGroupName value must
// be supplied.
// - If the source type is a DB snapshot, a DBSnapshotIdentifier value must be
// supplied.
// - If the source type is a DB cluster snapshot, a DBClusterSnapshotIdentifier
// value must be supplied.
// - If the source type is an RDS Proxy, a DBProxyName value must be supplied.
SourceIds []string
// The type of source that is generating the events. For example, if you want to
// be notified of events generated by a DB instance, you set this parameter to
// db-instance . For RDS Proxy events, specify db-proxy . If this value isn't
// specified, all events are returned. Valid values: db-instance | db-cluster |
// db-parameter-group | db-security-group | db-snapshot | db-cluster-snapshot |
// db-proxy
SourceType *string
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateEventSubscriptionOutput struct {
// Contains the results of a successful invocation of the
// DescribeEventSubscriptions action.
EventSubscription *types.EventSubscription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateEventSubscriptionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateEventSubscription{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateEventSubscription{}, 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 = addOpCreateEventSubscriptionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateEventSubscription(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_opCreateEventSubscription(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateEventSubscription",
}
}
| 197 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates an Aurora global database spread across multiple Amazon Web Services
// Regions. The global database contains a single primary cluster with read-write
// capability, and a read-only secondary cluster that receives data from the
// primary cluster through high-speed replication performed by the Aurora storage
// subsystem. You can create a global database that is initially empty, and then
// add a primary cluster and a secondary cluster to it. Or you can specify an
// existing Aurora cluster during the create operation, and this cluster becomes
// the primary cluster of the global database. This action applies only to Aurora
// DB clusters.
func (c *Client) CreateGlobalCluster(ctx context.Context, params *CreateGlobalClusterInput, optFns ...func(*Options)) (*CreateGlobalClusterOutput, error) {
if params == nil {
params = &CreateGlobalClusterInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateGlobalCluster", params, optFns, c.addOperationCreateGlobalClusterMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateGlobalClusterOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateGlobalClusterInput struct {
// The name for your database of up to 64 alphanumeric characters. If you do not
// provide a name, Amazon Aurora will not create a database in the global database
// cluster you are creating.
DatabaseName *string
// The deletion protection setting for the new global database. The global
// database can't be deleted when deletion protection is enabled.
DeletionProtection *bool
// The name of the database engine to be used for this DB cluster.
Engine *string
// The engine version of the Aurora global database.
EngineVersion *string
// The cluster identifier of the new global database cluster. This parameter is
// stored as a lowercase string.
GlobalClusterIdentifier *string
// The Amazon Resource Name (ARN) to use as the primary cluster of the global
// database. This parameter is optional.
SourceDBClusterIdentifier *string
// The storage encryption setting for the new global database cluster.
StorageEncrypted *bool
noSmithyDocumentSerde
}
type CreateGlobalClusterOutput struct {
// A data type representing an Aurora global database.
GlobalCluster *types.GlobalCluster
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateGlobalClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateGlobalCluster{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateGlobalCluster{}, 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_opCreateGlobalCluster(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_opCreateGlobalCluster(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateGlobalCluster",
}
}
| 151 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Creates a new option group. You can create up to 20 option groups. This command
// doesn't apply to RDS Custom.
func (c *Client) CreateOptionGroup(ctx context.Context, params *CreateOptionGroupInput, optFns ...func(*Options)) (*CreateOptionGroupOutput, error) {
if params == nil {
params = &CreateOptionGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "CreateOptionGroup", params, optFns, c.addOperationCreateOptionGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*CreateOptionGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type CreateOptionGroupInput struct {
// Specifies the name of the engine that this option group should be associated
// with. Valid Values:
// - mariadb
// - mysql
// - oracle-ee
// - oracle-ee-cdb
// - oracle-se2
// - oracle-se2-cdb
// - postgres
// - sqlserver-ee
// - sqlserver-se
// - sqlserver-ex
// - sqlserver-web
//
// This member is required.
EngineName *string
// Specifies the major version of the engine that this option group should be
// associated with.
//
// This member is required.
MajorEngineVersion *string
// The description of the option group.
//
// This member is required.
OptionGroupDescription *string
// Specifies the name of the option group to be created. Constraints:
// - Must be 1 to 255 letters, numbers, or hyphens
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// Example: myoptiongroup
//
// This member is required.
OptionGroupName *string
// Tags to assign to the option group.
Tags []types.Tag
noSmithyDocumentSerde
}
type CreateOptionGroupOutput struct {
//
OptionGroup *types.OptionGroup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationCreateOptionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpCreateOptionGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpCreateOptionGroup{}, 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 = addOpCreateOptionGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateOptionGroup(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_opCreateOptionGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "CreateOptionGroup",
}
}
| 161 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a blue/green deployment. For more information, see Using Amazon RDS
// Blue/Green Deployments for database updates (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html)
// in the Amazon RDS User Guide and Using Amazon RDS Blue/Green Deployments for
// database updates (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html)
// in the Amazon Aurora User Guide.
func (c *Client) DeleteBlueGreenDeployment(ctx context.Context, params *DeleteBlueGreenDeploymentInput, optFns ...func(*Options)) (*DeleteBlueGreenDeploymentOutput, error) {
if params == nil {
params = &DeleteBlueGreenDeploymentInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteBlueGreenDeployment", params, optFns, c.addOperationDeleteBlueGreenDeploymentMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteBlueGreenDeploymentOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteBlueGreenDeploymentInput struct {
// The blue/green deployment identifier of the deployment to be deleted. This
// parameter isn't case-sensitive. Constraints:
// - Must match an existing blue/green deployment identifier.
//
// This member is required.
BlueGreenDeploymentIdentifier *string
// A value that indicates whether to delete the resources in the green
// environment. You can't specify this option if the blue/green deployment status (https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_BlueGreenDeployment.html)
// is SWITCHOVER_COMPLETED .
DeleteTarget *bool
noSmithyDocumentSerde
}
type DeleteBlueGreenDeploymentOutput struct {
// Contains the details about a blue/green deployment. For more information, see
// Using Amazon RDS Blue/Green Deployments for database updates (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html)
// in the Amazon RDS User Guide and Using Amazon RDS Blue/Green Deployments for
// database updates (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html)
// in the Amazon Aurora User Guide.
BlueGreenDeployment *types.BlueGreenDeployment
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteBlueGreenDeploymentMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteBlueGreenDeployment{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteBlueGreenDeployment{}, 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 = addOpDeleteBlueGreenDeploymentValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteBlueGreenDeployment(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_opDeleteBlueGreenDeployment(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteBlueGreenDeployment",
}
}
| 140 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
"time"
)
// Deletes a custom engine version. To run this command, make sure you meet the
// following prerequisites:
// - The CEV must not be the default for RDS Custom. If it is, change the
// default before running this command.
// - The CEV must not be associated with an RDS Custom DB instance, RDS Custom
// instance snapshot, or automated backup of your RDS Custom instance.
//
// Typically, deletion takes a few minutes. The MediaImport service that imports
// files from Amazon S3 to create CEVs isn't integrated with Amazon Web Services
// CloudTrail. If you turn on data logging for Amazon RDS in CloudTrail, calls to
// the DeleteCustomDbEngineVersion event aren't logged. However, you might see
// calls from the API gateway that accesses your Amazon S3 bucket. These calls
// originate from the MediaImport service for the DeleteCustomDbEngineVersion
// event. For more information, see Deleting a CEV (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-cev.html#custom-cev.delete)
// in the Amazon RDS User Guide.
func (c *Client) DeleteCustomDBEngineVersion(ctx context.Context, params *DeleteCustomDBEngineVersionInput, optFns ...func(*Options)) (*DeleteCustomDBEngineVersionOutput, error) {
if params == nil {
params = &DeleteCustomDBEngineVersionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteCustomDBEngineVersion", params, optFns, c.addOperationDeleteCustomDBEngineVersionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteCustomDBEngineVersionOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteCustomDBEngineVersionInput struct {
// The database engine. The only supported engines are custom-oracle-ee and
// custom-oracle-ee-cdb .
//
// This member is required.
Engine *string
// The custom engine version (CEV) for your DB instance. This option is required
// for RDS Custom, but optional for Amazon RDS. The combination of Engine and
// EngineVersion is unique per customer per Amazon Web Services Region.
//
// This member is required.
EngineVersion *string
noSmithyDocumentSerde
}
// This data type is used as a response element in the action
// DescribeDBEngineVersions .
type DeleteCustomDBEngineVersionOutput struct {
// The creation time of the DB engine version.
CreateTime *time.Time
// JSON string that lists the installation files and parameters that RDS Custom
// uses to create a custom engine version (CEV). RDS Custom applies the patches in
// the order in which they're listed in the manifest. You can set the Oracle home,
// Oracle base, and UNIX/Linux user and group using the installation parameters.
// For more information, see JSON fields in the CEV manifest (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/custom-cev.preparing.html#custom-cev.preparing.manifest.fields)
// in the Amazon RDS User Guide.
CustomDBEngineVersionManifest *string
// The description of the database engine.
DBEngineDescription *string
// A value that indicates the source media provider of the AMI based on the usage
// operation. Applicable for RDS Custom for SQL Server.
DBEngineMediaType *string
// The ARN of the custom engine version.
DBEngineVersionArn *string
// The description of the database engine version.
DBEngineVersionDescription *string
// The name of the DB parameter group family for the database engine.
DBParameterGroupFamily *string
// The name of the Amazon S3 bucket that contains your database installation files.
DatabaseInstallationFilesS3BucketName *string
// The Amazon S3 directory that contains the database installation files. If not
// specified, then no prefix is assumed.
DatabaseInstallationFilesS3Prefix *string
// The default character set for new instances of this engine version, if the
// CharacterSetName parameter of the CreateDBInstance API isn't specified.
DefaultCharacterSet *types.CharacterSet
// The name of the database engine.
Engine *string
// The version number of the database engine.
EngineVersion *string
// The types of logs that the database engine has available for export to
// CloudWatch Logs.
ExportableLogTypes []string
// The EC2 image
Image *types.CustomDBEngineVersionAMI
// The Amazon Web Services KMS key identifier for an encrypted CEV. This parameter
// is required for RDS Custom, but optional for Amazon RDS.
KMSKeyId *string
// The major engine version of the CEV.
MajorEngineVersion *string
// The status of the DB engine version, either available or deprecated .
Status *string
// A list of the supported CA certificate identifiers. For more information, see
// Using SSL/TLS to encrypt a connection to a DB instance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html)
// in the Amazon RDS User Guide and Using SSL/TLS to encrypt a connection to a DB
// cluster (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.SSL.html)
// in the Amazon Aurora User Guide.
SupportedCACertificateIdentifiers []string
// A list of the character sets supported by this engine for the CharacterSetName
// parameter of the CreateDBInstance operation.
SupportedCharacterSets []types.CharacterSet
// A list of the supported DB engine modes.
SupportedEngineModes []string
// A list of features supported by the DB engine. The supported features vary by
// DB engine and DB engine version. To determine the supported features for a
// specific DB engine and DB engine version using the CLI, use the following
// command: aws rds describe-db-engine-versions --engine --engine-version For
// example, to determine the supported features for RDS for PostgreSQL version 13.3
// using the CLI, use the following command: aws rds describe-db-engine-versions
// --engine postgres --engine-version 13.3 The supported features are listed under
// SupportedFeatureNames in the output.
SupportedFeatureNames []string
// A list of the character sets supported by the Oracle DB engine for the
// NcharCharacterSetName parameter of the CreateDBInstance operation.
SupportedNcharCharacterSets []types.CharacterSet
// A list of the time zones supported by this engine for the Timezone parameter of
// the CreateDBInstance action.
SupportedTimezones []types.Timezone
// A value that indicates whether the engine version supports Babelfish for Aurora
// PostgreSQL.
SupportsBabelfish bool
// A value that indicates whether the engine version supports rotating the server
// certificate without rebooting the DB instance.
SupportsCertificateRotationWithoutRestart *bool
// A value that indicates whether you can use Aurora global databases with a
// specific DB engine version.
SupportsGlobalDatabases bool
// A value that indicates whether the engine version supports exporting the log
// types specified by ExportableLogTypes to CloudWatch Logs.
SupportsLogExportsToCloudwatchLogs bool
// A value that indicates whether you can use Aurora parallel query with a
// specific DB engine version.
SupportsParallelQuery bool
// Indicates whether the database engine version supports read replicas.
SupportsReadReplica bool
// A list of tags. For more information, see Tagging Amazon RDS Resources (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Tagging.html)
// in the Amazon RDS User Guide.
TagList []types.Tag
// A list of engine versions that this database engine version can be upgraded to.
ValidUpgradeTarget []types.UpgradeTarget
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteCustomDBEngineVersionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteCustomDBEngineVersion{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteCustomDBEngineVersion{}, 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 = addOpDeleteCustomDBEngineVersionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteCustomDBEngineVersion(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_opDeleteCustomDBEngineVersion(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteCustomDBEngineVersion",
}
}
| 270 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// The DeleteDBCluster action deletes a previously provisioned DB cluster. When
// you delete a DB cluster, all automated backups for that DB cluster are deleted
// and can't be recovered. Manual DB cluster snapshots of the specified DB cluster
// are not deleted. If you're deleting a Multi-AZ DB cluster with read replicas,
// all cluster members are terminated and read replicas are promoted to standalone
// instances. For more information on Amazon Aurora, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) DeleteDBCluster(ctx context.Context, params *DeleteDBClusterInput, optFns ...func(*Options)) (*DeleteDBClusterOutput, error) {
if params == nil {
params = &DeleteDBClusterInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBCluster", params, optFns, c.addOperationDeleteDBClusterMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBClusterOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBClusterInput struct {
// The DB cluster identifier for the DB cluster to be deleted. This parameter
// isn't case-sensitive. Constraints:
// - Must match an existing DBClusterIdentifier.
//
// This member is required.
DBClusterIdentifier *string
// The DB cluster snapshot identifier of the new DB cluster snapshot created when
// SkipFinalSnapshot is disabled. Specifying this parameter and also skipping the
// creation of a final DB cluster snapshot with the SkipFinalShapshot parameter
// results in an error. Constraints:
// - Must be 1 to 255 letters, numbers, or hyphens.
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
FinalDBSnapshotIdentifier *string
// A value that indicates whether to skip the creation of a final DB cluster
// snapshot before the DB cluster is deleted. If skip is specified, no DB cluster
// snapshot is created. If skip isn't specified, a DB cluster snapshot is created
// before the DB cluster is deleted. By default, skip isn't specified, and the DB
// cluster snapshot is created. By default, this parameter is disabled. You must
// specify a FinalDBSnapshotIdentifier parameter if SkipFinalSnapshot is disabled.
SkipFinalSnapshot bool
noSmithyDocumentSerde
}
type DeleteDBClusterOutput struct {
// Contains the details of an Amazon Aurora DB cluster or Multi-AZ DB cluster. For
// an Amazon Aurora DB cluster, this data type is used as a response element in the
// operations CreateDBCluster , DeleteDBCluster , DescribeDBClusters ,
// FailoverDBCluster , ModifyDBCluster , PromoteReadReplicaDBCluster ,
// RestoreDBClusterFromS3 , RestoreDBClusterFromSnapshot ,
// RestoreDBClusterToPointInTime , StartDBCluster , and StopDBCluster . For a
// Multi-AZ DB cluster, this data type is used as a response element in the
// operations CreateDBCluster , DeleteDBCluster , DescribeDBClusters ,
// FailoverDBCluster , ModifyDBCluster , RebootDBCluster ,
// RestoreDBClusterFromSnapshot , and RestoreDBClusterToPointInTime . For more
// information on Amazon Aurora DB clusters, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ deployments with two readable standby DB instances (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
DBCluster *types.DBCluster
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBCluster{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBCluster{}, 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 = addOpDeleteDBClusterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBCluster(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_opDeleteDBCluster(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBCluster",
}
}
| 165 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a custom endpoint and removes it from an Amazon Aurora DB cluster. This
// action only applies to Aurora DB clusters.
func (c *Client) DeleteDBClusterEndpoint(ctx context.Context, params *DeleteDBClusterEndpointInput, optFns ...func(*Options)) (*DeleteDBClusterEndpointOutput, error) {
if params == nil {
params = &DeleteDBClusterEndpointInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBClusterEndpoint", params, optFns, c.addOperationDeleteDBClusterEndpointMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBClusterEndpointOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBClusterEndpointInput struct {
// The identifier associated with the custom endpoint. This parameter is stored as
// a lowercase string.
//
// This member is required.
DBClusterEndpointIdentifier *string
noSmithyDocumentSerde
}
// This data type represents the information you need to connect to an Amazon
// Aurora DB cluster. This data type is used as a response element in the following
// actions:
// - CreateDBClusterEndpoint
// - DescribeDBClusterEndpoints
// - ModifyDBClusterEndpoint
// - DeleteDBClusterEndpoint
//
// For the data structure that represents Amazon RDS DB instance endpoints, see
// Endpoint .
type DeleteDBClusterEndpointOutput struct {
// The type associated with a custom endpoint. One of: READER , WRITER , ANY .
CustomEndpointType *string
// The Amazon Resource Name (ARN) for the endpoint.
DBClusterEndpointArn *string
// The identifier associated with the endpoint. This parameter is stored as a
// lowercase string.
DBClusterEndpointIdentifier *string
// A unique system-generated identifier for an endpoint. It remains the same for
// the whole life of the endpoint.
DBClusterEndpointResourceIdentifier *string
// The DB cluster identifier of the DB cluster associated with the endpoint. This
// parameter is stored as a lowercase string.
DBClusterIdentifier *string
// The DNS address of the endpoint.
Endpoint *string
// The type of the endpoint. One of: READER , WRITER , CUSTOM .
EndpointType *string
// List of DB instance identifiers that aren't part of the custom endpoint group.
// All other eligible instances are reachable through the custom endpoint. Only
// relevant if the list of static members is empty.
ExcludedMembers []string
// List of DB instance identifiers that are part of the custom endpoint group.
StaticMembers []string
// The current status of the endpoint. One of: creating , available , deleting ,
// inactive , modifying . The inactive state applies to an endpoint that can't be
// used for a certain kind of cluster, such as a writer endpoint for a read-only
// secondary cluster in a global database.
Status *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBClusterEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBClusterEndpoint{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBClusterEndpoint{}, 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 = addOpDeleteDBClusterEndpointValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBClusterEndpoint(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_opDeleteDBClusterEndpoint(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBClusterEndpoint",
}
}
| 171 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a specified DB cluster parameter group. The DB cluster parameter group
// to be deleted can't be associated with any DB clusters. For more information on
// Amazon Aurora, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) DeleteDBClusterParameterGroup(ctx context.Context, params *DeleteDBClusterParameterGroupInput, optFns ...func(*Options)) (*DeleteDBClusterParameterGroupOutput, error) {
if params == nil {
params = &DeleteDBClusterParameterGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBClusterParameterGroup", params, optFns, c.addOperationDeleteDBClusterParameterGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBClusterParameterGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBClusterParameterGroupInput struct {
// The name of the DB cluster parameter group. Constraints:
// - Must be the name of an existing DB cluster parameter group.
// - You can't delete a default DB cluster parameter group.
// - Can't be associated with any DB clusters.
//
// This member is required.
DBClusterParameterGroupName *string
noSmithyDocumentSerde
}
type DeleteDBClusterParameterGroupOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBClusterParameterGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBClusterParameterGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBClusterParameterGroup{}, 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 = addOpDeleteDBClusterParameterGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBClusterParameterGroup(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_opDeleteDBClusterParameterGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBClusterParameterGroup",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a DB cluster snapshot. If the snapshot is being copied, the copy
// operation is terminated. The DB cluster snapshot must be in the available state
// to be deleted. For more information on Amazon Aurora, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) DeleteDBClusterSnapshot(ctx context.Context, params *DeleteDBClusterSnapshotInput, optFns ...func(*Options)) (*DeleteDBClusterSnapshotOutput, error) {
if params == nil {
params = &DeleteDBClusterSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBClusterSnapshot", params, optFns, c.addOperationDeleteDBClusterSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBClusterSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBClusterSnapshotInput struct {
// The identifier of the DB cluster snapshot to delete. Constraints: Must be the
// name of an existing DB cluster snapshot in the available state.
//
// This member is required.
DBClusterSnapshotIdentifier *string
noSmithyDocumentSerde
}
type DeleteDBClusterSnapshotOutput struct {
// Contains the details for an Amazon RDS DB cluster snapshot This data type is
// used as a response element in the DescribeDBClusterSnapshots action.
DBClusterSnapshot *types.DBClusterSnapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBClusterSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBClusterSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBClusterSnapshot{}, 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 = addOpDeleteDBClusterSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBClusterSnapshot(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_opDeleteDBClusterSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBClusterSnapshot",
}
}
| 132 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// The DeleteDBInstance action deletes a previously provisioned DB instance. When
// you delete a DB instance, all automated backups for that instance are deleted
// and can't be recovered. Manual DB snapshots of the DB instance to be deleted by
// DeleteDBInstance are not deleted. If you request a final DB snapshot the status
// of the Amazon RDS DB instance is deleting until the DB snapshot is created. The
// API action DescribeDBInstance is used to monitor the status of this operation.
// The action can't be canceled or reverted once submitted. When a DB instance is
// in a failure state and has a status of failed , incompatible-restore , or
// incompatible-network , you can only delete it when you skip creation of the
// final snapshot with the SkipFinalSnapshot parameter. If the specified DB
// instance is part of an Amazon Aurora DB cluster, you can't delete the DB
// instance if both of the following conditions are true:
// - The DB cluster is a read replica of another Amazon Aurora DB cluster.
// - The DB instance is the only instance in the DB cluster.
//
// To delete a DB instance in this case, first call the PromoteReadReplicaDBCluster
// API action to promote the DB cluster so it's no longer a read replica. After the
// promotion completes, then call the DeleteDBInstance API action to delete the
// final instance in the DB cluster.
func (c *Client) DeleteDBInstance(ctx context.Context, params *DeleteDBInstanceInput, optFns ...func(*Options)) (*DeleteDBInstanceOutput, error) {
if params == nil {
params = &DeleteDBInstanceInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBInstance", params, optFns, c.addOperationDeleteDBInstanceMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBInstanceOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBInstanceInput struct {
// The DB instance identifier for the DB instance to be deleted. This parameter
// isn't case-sensitive. Constraints:
// - Must match the name of an existing DB instance.
//
// This member is required.
DBInstanceIdentifier *string
// A value that indicates whether to remove automated backups immediately after
// the DB instance is deleted. This parameter isn't case-sensitive. The default is
// to remove automated backups immediately after the DB instance is deleted.
DeleteAutomatedBackups *bool
// The DBSnapshotIdentifier of the new DBSnapshot created when the
// SkipFinalSnapshot parameter is disabled. If you enable this parameter and also
// enable SkipFinalShapshot, the command results in an error. This setting doesn't
// apply to RDS Custom. Constraints:
// - Must be 1 to 255 letters or numbers.
// - First character must be a letter.
// - Can't end with a hyphen or contain two consecutive hyphens.
// - Can't be specified when deleting a read replica.
FinalDBSnapshotIdentifier *string
// A value that indicates whether to skip the creation of a final DB snapshot
// before deleting the instance. If you enable this parameter, RDS doesn't create a
// DB snapshot. If you don't enable this parameter, RDS creates a DB snapshot
// before the DB instance is deleted. By default, skip isn't enabled, and the DB
// snapshot is created. If you don't enable this parameter, you must specify the
// FinalDBSnapshotIdentifier parameter. When a DB instance is in a failure state
// and has a status of failed , incompatible-restore , or incompatible-network ,
// RDS can delete the instance only if you enable this parameter. If you delete a
// read replica or an RDS Custom instance, you must enable this setting. This
// setting is required for RDS Custom.
SkipFinalSnapshot bool
noSmithyDocumentSerde
}
type DeleteDBInstanceOutput struct {
// Contains the details of an Amazon RDS DB instance. This data type is used as a
// response element in the operations CreateDBInstance ,
// CreateDBInstanceReadReplica , DeleteDBInstance , DescribeDBInstances ,
// ModifyDBInstance , PromoteReadReplica , RebootDBInstance ,
// RestoreDBInstanceFromDBSnapshot , RestoreDBInstanceFromS3 ,
// RestoreDBInstanceToPointInTime , StartDBInstance , and StopDBInstance .
DBInstance *types.DBInstance
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBInstanceMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBInstance{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBInstance{}, 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 = addOpDeleteDBInstanceValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBInstance(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_opDeleteDBInstance(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBInstance",
}
}
| 177 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes automated backups using the DbiResourceId value of the source DB
// instance or the Amazon Resource Name (ARN) of the automated backups.
func (c *Client) DeleteDBInstanceAutomatedBackup(ctx context.Context, params *DeleteDBInstanceAutomatedBackupInput, optFns ...func(*Options)) (*DeleteDBInstanceAutomatedBackupOutput, error) {
if params == nil {
params = &DeleteDBInstanceAutomatedBackupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBInstanceAutomatedBackup", params, optFns, c.addOperationDeleteDBInstanceAutomatedBackupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBInstanceAutomatedBackupOutput)
out.ResultMetadata = metadata
return out, nil
}
// Parameter input for the DeleteDBInstanceAutomatedBackup operation.
type DeleteDBInstanceAutomatedBackupInput struct {
// The Amazon Resource Name (ARN) of the automated backups to delete, for example,
// arn:aws:rds:us-east-1:123456789012:auto-backup:ab-L2IJCEXJP7XQ7HOJ4SIEXAMPLE .
// This setting doesn't apply to RDS Custom.
DBInstanceAutomatedBackupsArn *string
// The identifier for the source DB instance, which can't be changed and which is
// unique to an Amazon Web Services Region.
DbiResourceId *string
noSmithyDocumentSerde
}
type DeleteDBInstanceAutomatedBackupOutput struct {
// An automated backup of a DB instance. It consists of system backups,
// transaction logs, and the database instance properties that existed at the time
// you deleted the source instance.
DBInstanceAutomatedBackup *types.DBInstanceAutomatedBackup
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBInstanceAutomatedBackupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBInstanceAutomatedBackup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBInstanceAutomatedBackup{}, 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_opDeleteDBInstanceAutomatedBackup(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_opDeleteDBInstanceAutomatedBackup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBInstanceAutomatedBackup",
}
}
| 130 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a specified DB parameter group. The DB parameter group to be deleted
// can't be associated with any DB instances.
func (c *Client) DeleteDBParameterGroup(ctx context.Context, params *DeleteDBParameterGroupInput, optFns ...func(*Options)) (*DeleteDBParameterGroupOutput, error) {
if params == nil {
params = &DeleteDBParameterGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBParameterGroup", params, optFns, c.addOperationDeleteDBParameterGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBParameterGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBParameterGroupInput struct {
// The name of the DB parameter group. Constraints:
// - Must be the name of an existing DB parameter group
// - You can't delete a default DB parameter group
// - Can't be associated with any DB instances
//
// This member is required.
DBParameterGroupName *string
noSmithyDocumentSerde
}
type DeleteDBParameterGroupOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBParameterGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBParameterGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBParameterGroup{}, 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 = addOpDeleteDBParameterGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBParameterGroup(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_opDeleteDBParameterGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBParameterGroup",
}
}
| 124 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an existing DB proxy.
func (c *Client) DeleteDBProxy(ctx context.Context, params *DeleteDBProxyInput, optFns ...func(*Options)) (*DeleteDBProxyOutput, error) {
if params == nil {
params = &DeleteDBProxyInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBProxy", params, optFns, c.addOperationDeleteDBProxyMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBProxyOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBProxyInput struct {
// The name of the DB proxy to delete.
//
// This member is required.
DBProxyName *string
noSmithyDocumentSerde
}
type DeleteDBProxyOutput struct {
// The data structure representing the details of the DB proxy that you delete.
DBProxy *types.DBProxy
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBProxyMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBProxy{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBProxy{}, 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 = addOpDeleteDBProxyValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBProxy(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_opDeleteDBProxy(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBProxy",
}
}
| 125 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a DBProxyEndpoint . Doing so removes the ability to access the DB proxy
// using the endpoint that you defined. The endpoint that you delete might have
// provided capabilities such as read/write or read-only operations, or using a
// different VPC than the DB proxy's default VPC.
func (c *Client) DeleteDBProxyEndpoint(ctx context.Context, params *DeleteDBProxyEndpointInput, optFns ...func(*Options)) (*DeleteDBProxyEndpointOutput, error) {
if params == nil {
params = &DeleteDBProxyEndpointInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBProxyEndpoint", params, optFns, c.addOperationDeleteDBProxyEndpointMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBProxyEndpointOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBProxyEndpointInput struct {
// The name of the DB proxy endpoint to delete.
//
// This member is required.
DBProxyEndpointName *string
noSmithyDocumentSerde
}
type DeleteDBProxyEndpointOutput struct {
// The data structure representing the details of the DB proxy endpoint that you
// delete.
DBProxyEndpoint *types.DBProxyEndpoint
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBProxyEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBProxyEndpoint{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBProxyEndpoint{}, 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 = addOpDeleteDBProxyEndpointValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBProxyEndpoint(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_opDeleteDBProxyEndpoint(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBProxyEndpoint",
}
}
| 129 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a DB security group. The specified DB security group must not be
// associated with any DB instances. EC2-Classic was retired on August 15, 2022. If
// you haven't migrated from EC2-Classic to a VPC, we recommend that you migrate as
// soon as possible. For more information, see Migrate from EC2-Classic to a VPC (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-migrate.html)
// in the Amazon EC2 User Guide, the blog EC2-Classic Networking is Retiring –
// Here’s How to Prepare (http://aws.amazon.com/blogs/aws/ec2-classic-is-retiring-heres-how-to-prepare/)
// , and Moving a DB instance not in a VPC into a VPC (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_VPC.Non-VPC2VPC.html)
// in the Amazon RDS User Guide.
func (c *Client) DeleteDBSecurityGroup(ctx context.Context, params *DeleteDBSecurityGroupInput, optFns ...func(*Options)) (*DeleteDBSecurityGroupOutput, error) {
if params == nil {
params = &DeleteDBSecurityGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBSecurityGroup", params, optFns, c.addOperationDeleteDBSecurityGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBSecurityGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBSecurityGroupInput struct {
// The name of the DB security group to delete. You can't delete the default DB
// security group. Constraints:
// - Must be 1 to 255 letters, numbers, or hyphens.
// - First character must be a letter
// - Can't end with a hyphen or contain two consecutive hyphens
// - Must not be "Default"
//
// This member is required.
DBSecurityGroupName *string
noSmithyDocumentSerde
}
type DeleteDBSecurityGroupOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBSecurityGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBSecurityGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBSecurityGroup{}, 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 = addOpDeleteDBSecurityGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBSecurityGroup(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_opDeleteDBSecurityGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBSecurityGroup",
}
}
| 132 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a DB snapshot. If the snapshot is being copied, the copy operation is
// terminated. The DB snapshot must be in the available state to be deleted.
func (c *Client) DeleteDBSnapshot(ctx context.Context, params *DeleteDBSnapshotInput, optFns ...func(*Options)) (*DeleteDBSnapshotOutput, error) {
if params == nil {
params = &DeleteDBSnapshotInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBSnapshot", params, optFns, c.addOperationDeleteDBSnapshotMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBSnapshotOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBSnapshotInput struct {
// The DB snapshot identifier. Constraints: Must be the name of an existing DB
// snapshot in the available state.
//
// This member is required.
DBSnapshotIdentifier *string
noSmithyDocumentSerde
}
type DeleteDBSnapshotOutput struct {
// Contains the details of an Amazon RDS DB snapshot. This data type is used as a
// response element in the DescribeDBSnapshots action.
DBSnapshot *types.DBSnapshot
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBSnapshotMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBSnapshot{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBSnapshot{}, 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 = addOpDeleteDBSnapshotValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBSnapshot(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_opDeleteDBSnapshot(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBSnapshot",
}
}
| 128 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a DB subnet group. The specified database subnet group must not be
// associated with any DB instances.
func (c *Client) DeleteDBSubnetGroup(ctx context.Context, params *DeleteDBSubnetGroupInput, optFns ...func(*Options)) (*DeleteDBSubnetGroupOutput, error) {
if params == nil {
params = &DeleteDBSubnetGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteDBSubnetGroup", params, optFns, c.addOperationDeleteDBSubnetGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteDBSubnetGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteDBSubnetGroupInput struct {
// The name of the database subnet group to delete. You can't delete the default
// subnet group. Constraints: Must match the name of an existing DBSubnetGroup.
// Must not be default. Example: mydbsubnetgroup
//
// This member is required.
DBSubnetGroupName *string
noSmithyDocumentSerde
}
type DeleteDBSubnetGroupOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteDBSubnetGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteDBSubnetGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteDBSubnetGroup{}, 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 = addOpDeleteDBSubnetGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDBSubnetGroup(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_opDeleteDBSubnetGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteDBSubnetGroup",
}
}
| 123 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an RDS event notification subscription.
func (c *Client) DeleteEventSubscription(ctx context.Context, params *DeleteEventSubscriptionInput, optFns ...func(*Options)) (*DeleteEventSubscriptionOutput, error) {
if params == nil {
params = &DeleteEventSubscriptionInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteEventSubscription", params, optFns, c.addOperationDeleteEventSubscriptionMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteEventSubscriptionOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteEventSubscriptionInput struct {
// The name of the RDS event notification subscription you want to delete.
//
// This member is required.
SubscriptionName *string
noSmithyDocumentSerde
}
type DeleteEventSubscriptionOutput struct {
// Contains the results of a successful invocation of the
// DescribeEventSubscriptions action.
EventSubscription *types.EventSubscription
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteEventSubscriptionMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteEventSubscription{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteEventSubscription{}, 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 = addOpDeleteEventSubscriptionValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteEventSubscription(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_opDeleteEventSubscription(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteEventSubscription",
}
}
| 126 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes a global database cluster. The primary and secondary clusters must
// already be detached or destroyed first. This action only applies to Aurora DB
// clusters.
func (c *Client) DeleteGlobalCluster(ctx context.Context, params *DeleteGlobalClusterInput, optFns ...func(*Options)) (*DeleteGlobalClusterOutput, error) {
if params == nil {
params = &DeleteGlobalClusterInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteGlobalCluster", params, optFns, c.addOperationDeleteGlobalClusterMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteGlobalClusterOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteGlobalClusterInput struct {
// The cluster identifier of the global database cluster being deleted.
//
// This member is required.
GlobalClusterIdentifier *string
noSmithyDocumentSerde
}
type DeleteGlobalClusterOutput struct {
// A data type representing an Aurora global database.
GlobalCluster *types.GlobalCluster
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteGlobalClusterMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteGlobalCluster{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteGlobalCluster{}, 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 = addOpDeleteGlobalClusterValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteGlobalCluster(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_opDeleteGlobalCluster(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteGlobalCluster",
}
}
| 127 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
import (
"context"
awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Deletes an existing option group.
func (c *Client) DeleteOptionGroup(ctx context.Context, params *DeleteOptionGroupInput, optFns ...func(*Options)) (*DeleteOptionGroupOutput, error) {
if params == nil {
params = &DeleteOptionGroupInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeleteOptionGroup", params, optFns, c.addOperationDeleteOptionGroupMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeleteOptionGroupOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeleteOptionGroupInput struct {
// The name of the option group to be deleted. You can't delete default option
// groups.
//
// This member is required.
OptionGroupName *string
noSmithyDocumentSerde
}
type DeleteOptionGroupOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeleteOptionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeleteOptionGroup{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeleteOptionGroup{}, 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 = addOpDeleteOptionGroupValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteOptionGroup(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_opDeleteOptionGroup(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeleteOptionGroup",
}
}
| 121 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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"
)
// Remove the association between one or more DBProxyTarget data structures and a
// DBProxyTargetGroup .
func (c *Client) DeregisterDBProxyTargets(ctx context.Context, params *DeregisterDBProxyTargetsInput, optFns ...func(*Options)) (*DeregisterDBProxyTargetsOutput, error) {
if params == nil {
params = &DeregisterDBProxyTargetsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DeregisterDBProxyTargets", params, optFns, c.addOperationDeregisterDBProxyTargetsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DeregisterDBProxyTargetsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DeregisterDBProxyTargetsInput struct {
// The identifier of the DBProxy that is associated with the DBProxyTargetGroup .
//
// This member is required.
DBProxyName *string
// One or more DB cluster identifiers.
DBClusterIdentifiers []string
// One or more DB instance identifiers.
DBInstanceIdentifiers []string
// The identifier of the DBProxyTargetGroup .
TargetGroupName *string
noSmithyDocumentSerde
}
type DeregisterDBProxyTargetsOutput struct {
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDeregisterDBProxyTargetsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDeregisterDBProxyTargets{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDeregisterDBProxyTargets{}, 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 = addOpDeregisterDBProxyTargetsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeregisterDBProxyTargets(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_opDeregisterDBProxyTargets(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DeregisterDBProxyTargets",
}
}
| 130 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists all of the attributes for a customer account. The attributes include
// Amazon RDS quotas for the account, such as the number of DB instances allowed.
// The description for a quota includes the quota name, current usage toward that
// quota, and the quota's maximum value. This command doesn't take any parameters.
func (c *Client) DescribeAccountAttributes(ctx context.Context, params *DescribeAccountAttributesInput, optFns ...func(*Options)) (*DescribeAccountAttributesOutput, error) {
if params == nil {
params = &DescribeAccountAttributesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeAccountAttributes", params, optFns, c.addOperationDescribeAccountAttributesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeAccountAttributesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeAccountAttributesInput struct {
noSmithyDocumentSerde
}
// Data returned by the DescribeAccountAttributes action.
type DescribeAccountAttributesOutput struct {
// A list of AccountQuota objects. Within this list, each quota has a name, a
// count of usage toward the quota maximum, and a maximum value for the quota.
AccountQuotas []types.AccountQuota
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeAccountAttributesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeAccountAttributes{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeAccountAttributes{}, 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_opDescribeAccountAttributes(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_opDescribeAccountAttributes(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DescribeAccountAttributes",
}
}
| 121 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about blue/green deployments. For more information, see
// Using Amazon RDS Blue/Green Deployments for database updates (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/blue-green-deployments.html)
// in the Amazon RDS User Guide and Using Amazon RDS Blue/Green Deployments for
// database updates (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/blue-green-deployments.html)
// in the Amazon Aurora User Guide.
func (c *Client) DescribeBlueGreenDeployments(ctx context.Context, params *DescribeBlueGreenDeploymentsInput, optFns ...func(*Options)) (*DescribeBlueGreenDeploymentsOutput, error) {
if params == nil {
params = &DescribeBlueGreenDeploymentsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeBlueGreenDeployments", params, optFns, c.addOperationDescribeBlueGreenDeploymentsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeBlueGreenDeploymentsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeBlueGreenDeploymentsInput struct {
// The blue/green deployment identifier. If this parameter is specified,
// information from only the specific blue/green deployment is returned. This
// parameter isn't case-sensitive. Constraints:
// - If supplied, must match an existing blue/green deployment identifier.
BlueGreenDeploymentIdentifier *string
// A filter that specifies one or more blue/green deployments to describe.
// Supported filters:
// - blue-green-deployment-identifier - Accepts system-generated identifiers for
// blue/green deployments. The results list only includes information about the
// blue/green deployments with the specified identifiers.
// - blue-green-deployment-name - Accepts user-supplied names for blue/green
// deployments. The results list only includes information about the blue/green
// deployments with the specified names.
// - source - Accepts source databases for a blue/green deployment. The results
// list only includes information about the blue/green deployments with the
// specified source databases.
// - target - Accepts target databases for a blue/green deployment. The results
// list only includes information about the blue/green deployments with the
// specified target databases.
Filters []types.Filter
// An optional pagination token provided by a previous DescribeBlueGreenDeployments
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by MaxRecords .
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeBlueGreenDeploymentsOutput struct {
// Contains a list of blue/green deployments for the user.
BlueGreenDeployments []types.BlueGreenDeployment
// A pagination token that can be used in a later DescribeBlueGreenDeployments
// request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeBlueGreenDeploymentsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeBlueGreenDeployments{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeBlueGreenDeployments{}, 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 = addOpDescribeBlueGreenDeploymentsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeBlueGreenDeployments(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
}
// DescribeBlueGreenDeploymentsAPIClient is a client that implements the
// DescribeBlueGreenDeployments operation.
type DescribeBlueGreenDeploymentsAPIClient interface {
DescribeBlueGreenDeployments(context.Context, *DescribeBlueGreenDeploymentsInput, ...func(*Options)) (*DescribeBlueGreenDeploymentsOutput, error)
}
var _ DescribeBlueGreenDeploymentsAPIClient = (*Client)(nil)
// DescribeBlueGreenDeploymentsPaginatorOptions is the paginator options for
// DescribeBlueGreenDeployments
type DescribeBlueGreenDeploymentsPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeBlueGreenDeploymentsPaginator is a paginator for
// DescribeBlueGreenDeployments
type DescribeBlueGreenDeploymentsPaginator struct {
options DescribeBlueGreenDeploymentsPaginatorOptions
client DescribeBlueGreenDeploymentsAPIClient
params *DescribeBlueGreenDeploymentsInput
nextToken *string
firstPage bool
}
// NewDescribeBlueGreenDeploymentsPaginator returns a new
// DescribeBlueGreenDeploymentsPaginator
func NewDescribeBlueGreenDeploymentsPaginator(client DescribeBlueGreenDeploymentsAPIClient, params *DescribeBlueGreenDeploymentsInput, optFns ...func(*DescribeBlueGreenDeploymentsPaginatorOptions)) *DescribeBlueGreenDeploymentsPaginator {
if params == nil {
params = &DescribeBlueGreenDeploymentsInput{}
}
options := DescribeBlueGreenDeploymentsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeBlueGreenDeploymentsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeBlueGreenDeploymentsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeBlueGreenDeployments page.
func (p *DescribeBlueGreenDeploymentsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeBlueGreenDeploymentsOutput, 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.MaxRecords = limit
result, err := p.client.DescribeBlueGreenDeployments(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_opDescribeBlueGreenDeployments(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DescribeBlueGreenDeployments",
}
}
| 258 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Lists the set of CA certificates provided by Amazon RDS for this Amazon Web
// Services account. For more information, see Using SSL/TLS to encrypt a
// connection to a DB instance (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html)
// in the Amazon RDS User Guide and Using SSL/TLS to encrypt a connection to a DB
// cluster (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.SSL.html)
// in the Amazon Aurora User Guide.
func (c *Client) DescribeCertificates(ctx context.Context, params *DescribeCertificatesInput, optFns ...func(*Options)) (*DescribeCertificatesOutput, error) {
if params == nil {
params = &DescribeCertificatesInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeCertificates", params, optFns, c.addOperationDescribeCertificatesMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeCertificatesOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeCertificatesInput struct {
// The user-supplied certificate identifier. If this parameter is specified,
// information for only the identified certificate is returned. This parameter
// isn't case-sensitive. Constraints:
// - Must match an existing CertificateIdentifier.
CertificateIdentifier *string
// This parameter isn't currently supported.
Filters []types.Filter
// An optional pagination token provided by a previous DescribeCertificates
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by MaxRecords .
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
MaxRecords *int32
noSmithyDocumentSerde
}
// Data returned by the DescribeCertificates action.
type DescribeCertificatesOutput struct {
// The list of Certificate objects for the Amazon Web Services account.
Certificates []types.Certificate
// An optional pagination token provided by a previous DescribeCertificates
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by MaxRecords .
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeCertificatesMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeCertificates{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeCertificates{}, 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 = addOpDescribeCertificatesValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeCertificates(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
}
// DescribeCertificatesAPIClient is a client that implements the
// DescribeCertificates operation.
type DescribeCertificatesAPIClient interface {
DescribeCertificates(context.Context, *DescribeCertificatesInput, ...func(*Options)) (*DescribeCertificatesOutput, error)
}
var _ DescribeCertificatesAPIClient = (*Client)(nil)
// DescribeCertificatesPaginatorOptions is the paginator options for
// DescribeCertificates
type DescribeCertificatesPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeCertificatesPaginator is a paginator for DescribeCertificates
type DescribeCertificatesPaginator struct {
options DescribeCertificatesPaginatorOptions
client DescribeCertificatesAPIClient
params *DescribeCertificatesInput
nextToken *string
firstPage bool
}
// NewDescribeCertificatesPaginator returns a new DescribeCertificatesPaginator
func NewDescribeCertificatesPaginator(client DescribeCertificatesAPIClient, params *DescribeCertificatesInput, optFns ...func(*DescribeCertificatesPaginatorOptions)) *DescribeCertificatesPaginator {
if params == nil {
params = &DescribeCertificatesInput{}
}
options := DescribeCertificatesPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeCertificatesPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeCertificatesPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeCertificates page.
func (p *DescribeCertificatesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeCertificatesOutput, 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.MaxRecords = limit
result, err := p.client.DescribeCertificates(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_opDescribeCertificates(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DescribeCertificates",
}
}
| 246 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about backtracks for a DB cluster. For more information on
// Amazon Aurora, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. This action only applies to Aurora MySQL DB
// clusters.
func (c *Client) DescribeDBClusterBacktracks(ctx context.Context, params *DescribeDBClusterBacktracksInput, optFns ...func(*Options)) (*DescribeDBClusterBacktracksOutput, error) {
if params == nil {
params = &DescribeDBClusterBacktracksInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDBClusterBacktracks", params, optFns, c.addOperationDescribeDBClusterBacktracksMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDBClusterBacktracksOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDBClusterBacktracksInput struct {
// The DB cluster identifier of the DB cluster to be described. This parameter is
// stored as a lowercase string. Constraints:
// - Must contain from 1 to 63 alphanumeric characters or hyphens.
// - First character must be a letter.
// - Can't end with a hyphen or contain two consecutive hyphens.
// Example: my-cluster1
//
// This member is required.
DBClusterIdentifier *string
// If specified, this value is the backtrack identifier of the backtrack to be
// described. Constraints:
// - Must contain a valid universally unique identifier (UUID). For more
// information about UUIDs, see Universally unique identifier (https://en.wikipedia.org/wiki/Universally_unique_identifier)
// .
// Example: 123e4567-e89b-12d3-a456-426655440000
BacktrackIdentifier *string
// A filter that specifies one or more DB clusters to describe. Supported filters
// include the following:
// - db-cluster-backtrack-id - Accepts backtrack identifiers. The results list
// includes information about only the backtracks identified by these identifiers.
// - db-cluster-backtrack-status - Accepts any of the following backtrack status
// values:
// - applying
// - completed
// - failed
// - pending The results list includes information about only the backtracks
// identified by these values.
Filters []types.Filter
// An optional pagination token provided by a previous DescribeDBClusterBacktracks
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by MaxRecords .
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
MaxRecords *int32
noSmithyDocumentSerde
}
// Contains the result of a successful invocation of the
// DescribeDBClusterBacktracks action.
type DescribeDBClusterBacktracksOutput struct {
// Contains a list of backtracks for the user.
DBClusterBacktracks []types.DBClusterBacktrack
// A pagination token that can be used in a later DescribeDBClusterBacktracks
// request.
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDBClusterBacktracksMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDBClusterBacktracks{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDBClusterBacktracks{}, 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 = addOpDescribeDBClusterBacktracksValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDBClusterBacktracks(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
}
// DescribeDBClusterBacktracksAPIClient is a client that implements the
// DescribeDBClusterBacktracks operation.
type DescribeDBClusterBacktracksAPIClient interface {
DescribeDBClusterBacktracks(context.Context, *DescribeDBClusterBacktracksInput, ...func(*Options)) (*DescribeDBClusterBacktracksOutput, error)
}
var _ DescribeDBClusterBacktracksAPIClient = (*Client)(nil)
// DescribeDBClusterBacktracksPaginatorOptions is the paginator options for
// DescribeDBClusterBacktracks
type DescribeDBClusterBacktracksPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDBClusterBacktracksPaginator is a paginator for
// DescribeDBClusterBacktracks
type DescribeDBClusterBacktracksPaginator struct {
options DescribeDBClusterBacktracksPaginatorOptions
client DescribeDBClusterBacktracksAPIClient
params *DescribeDBClusterBacktracksInput
nextToken *string
firstPage bool
}
// NewDescribeDBClusterBacktracksPaginator returns a new
// DescribeDBClusterBacktracksPaginator
func NewDescribeDBClusterBacktracksPaginator(client DescribeDBClusterBacktracksAPIClient, params *DescribeDBClusterBacktracksInput, optFns ...func(*DescribeDBClusterBacktracksPaginatorOptions)) *DescribeDBClusterBacktracksPaginator {
if params == nil {
params = &DescribeDBClusterBacktracksInput{}
}
options := DescribeDBClusterBacktracksPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDBClusterBacktracksPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDBClusterBacktracksPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDBClusterBacktracks page.
func (p *DescribeDBClusterBacktracksPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDBClusterBacktracksOutput, 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.MaxRecords = limit
result, err := p.client.DescribeDBClusterBacktracks(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_opDescribeDBClusterBacktracks(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DescribeDBClusterBacktracks",
}
}
| 268 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns information about endpoints for an Amazon Aurora DB cluster. This
// action only applies to Aurora DB clusters.
func (c *Client) DescribeDBClusterEndpoints(ctx context.Context, params *DescribeDBClusterEndpointsInput, optFns ...func(*Options)) (*DescribeDBClusterEndpointsOutput, error) {
if params == nil {
params = &DescribeDBClusterEndpointsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDBClusterEndpoints", params, optFns, c.addOperationDescribeDBClusterEndpointsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDBClusterEndpointsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDBClusterEndpointsInput struct {
// The identifier of the endpoint to describe. This parameter is stored as a
// lowercase string.
DBClusterEndpointIdentifier *string
// The DB cluster identifier of the DB cluster associated with the endpoint. This
// parameter is stored as a lowercase string.
DBClusterIdentifier *string
// A set of name-value pairs that define which endpoints to include in the output.
// The filters are specified as name-value pairs, in the format
// Name=endpoint_type,Values=endpoint_type1,endpoint_type2,... . Name can be one
// of: db-cluster-endpoint-type , db-cluster-endpoint-custom-type ,
// db-cluster-endpoint-id , db-cluster-endpoint-status . Values for the
// db-cluster-endpoint-type filter can be one or more of: reader , writer , custom
// . Values for the db-cluster-endpoint-custom-type filter can be one or more of:
// reader , any . Values for the db-cluster-endpoint-status filter can be one or
// more of: available , creating , deleting , inactive , modifying .
Filters []types.Filter
// An optional pagination token provided by a previous DescribeDBClusterEndpoints
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by MaxRecords .
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeDBClusterEndpointsOutput struct {
// Contains the details of the endpoints associated with the cluster and matching
// any filter conditions.
DBClusterEndpoints []types.DBClusterEndpoint
// An optional pagination token provided by a previous DescribeDBClusterEndpoints
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by MaxRecords .
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDBClusterEndpointsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDBClusterEndpoints{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDBClusterEndpoints{}, 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 = addOpDescribeDBClusterEndpointsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDBClusterEndpoints(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
}
// DescribeDBClusterEndpointsAPIClient is a client that implements the
// DescribeDBClusterEndpoints operation.
type DescribeDBClusterEndpointsAPIClient interface {
DescribeDBClusterEndpoints(context.Context, *DescribeDBClusterEndpointsInput, ...func(*Options)) (*DescribeDBClusterEndpointsOutput, error)
}
var _ DescribeDBClusterEndpointsAPIClient = (*Client)(nil)
// DescribeDBClusterEndpointsPaginatorOptions is the paginator options for
// DescribeDBClusterEndpoints
type DescribeDBClusterEndpointsPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDBClusterEndpointsPaginator is a paginator for
// DescribeDBClusterEndpoints
type DescribeDBClusterEndpointsPaginator struct {
options DescribeDBClusterEndpointsPaginatorOptions
client DescribeDBClusterEndpointsAPIClient
params *DescribeDBClusterEndpointsInput
nextToken *string
firstPage bool
}
// NewDescribeDBClusterEndpointsPaginator returns a new
// DescribeDBClusterEndpointsPaginator
func NewDescribeDBClusterEndpointsPaginator(client DescribeDBClusterEndpointsAPIClient, params *DescribeDBClusterEndpointsInput, optFns ...func(*DescribeDBClusterEndpointsPaginatorOptions)) *DescribeDBClusterEndpointsPaginator {
if params == nil {
params = &DescribeDBClusterEndpointsInput{}
}
options := DescribeDBClusterEndpointsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDBClusterEndpointsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDBClusterEndpointsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDBClusterEndpoints page.
func (p *DescribeDBClusterEndpointsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDBClusterEndpointsOutput, 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.MaxRecords = limit
result, err := p.client.DescribeDBClusterEndpoints(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_opDescribeDBClusterEndpoints(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DescribeDBClusterEndpoints",
}
}
| 254 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns a list of DBClusterParameterGroup descriptions. If a
// DBClusterParameterGroupName parameter is specified, the list will contain only
// the description of the specified DB cluster parameter group. For more
// information on Amazon Aurora, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) DescribeDBClusterParameterGroups(ctx context.Context, params *DescribeDBClusterParameterGroupsInput, optFns ...func(*Options)) (*DescribeDBClusterParameterGroupsOutput, error) {
if params == nil {
params = &DescribeDBClusterParameterGroupsInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDBClusterParameterGroups", params, optFns, c.addOperationDescribeDBClusterParameterGroupsMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDBClusterParameterGroupsOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDBClusterParameterGroupsInput struct {
// The name of a specific DB cluster parameter group to return details for.
// Constraints:
// - If supplied, must match the name of an existing DBClusterParameterGroup.
DBClusterParameterGroupName *string
// This parameter isn't currently supported.
Filters []types.Filter
// An optional pagination token provided by a previous
// DescribeDBClusterParameterGroups request. If this parameter is specified, the
// response includes only records beyond the marker, up to the value specified by
// MaxRecords .
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
MaxRecords *int32
noSmithyDocumentSerde
}
type DescribeDBClusterParameterGroupsOutput struct {
// A list of DB cluster parameter groups.
DBClusterParameterGroups []types.DBClusterParameterGroup
// An optional pagination token provided by a previous
// DescribeDBClusterParameterGroups request. If this parameter is specified, the
// response includes only records beyond the marker, up to the value specified by
// MaxRecords .
Marker *string
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDBClusterParameterGroupsMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDBClusterParameterGroups{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDBClusterParameterGroups{}, 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 = addOpDescribeDBClusterParameterGroupsValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDBClusterParameterGroups(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
}
// DescribeDBClusterParameterGroupsAPIClient is a client that implements the
// DescribeDBClusterParameterGroups operation.
type DescribeDBClusterParameterGroupsAPIClient interface {
DescribeDBClusterParameterGroups(context.Context, *DescribeDBClusterParameterGroupsInput, ...func(*Options)) (*DescribeDBClusterParameterGroupsOutput, error)
}
var _ DescribeDBClusterParameterGroupsAPIClient = (*Client)(nil)
// DescribeDBClusterParameterGroupsPaginatorOptions is the paginator options for
// DescribeDBClusterParameterGroups
type DescribeDBClusterParameterGroupsPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDBClusterParameterGroupsPaginator is a paginator for
// DescribeDBClusterParameterGroups
type DescribeDBClusterParameterGroupsPaginator struct {
options DescribeDBClusterParameterGroupsPaginatorOptions
client DescribeDBClusterParameterGroupsAPIClient
params *DescribeDBClusterParameterGroupsInput
nextToken *string
firstPage bool
}
// NewDescribeDBClusterParameterGroupsPaginator returns a new
// DescribeDBClusterParameterGroupsPaginator
func NewDescribeDBClusterParameterGroupsPaginator(client DescribeDBClusterParameterGroupsAPIClient, params *DescribeDBClusterParameterGroupsInput, optFns ...func(*DescribeDBClusterParameterGroupsPaginatorOptions)) *DescribeDBClusterParameterGroupsPaginator {
if params == nil {
params = &DescribeDBClusterParameterGroupsInput{}
}
options := DescribeDBClusterParameterGroupsPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDBClusterParameterGroupsPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDBClusterParameterGroupsPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDBClusterParameterGroups page.
func (p *DescribeDBClusterParameterGroupsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDBClusterParameterGroupsOutput, 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.MaxRecords = limit
result, err := p.client.DescribeDBClusterParameterGroups(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_opDescribeDBClusterParameterGroups(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DescribeDBClusterParameterGroups",
}
}
| 249 |
aws-sdk-go-v2 | aws | Go | // Code generated by smithy-go-codegen DO NOT EDIT.
package rds
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/rds/types"
"github.com/aws/smithy-go/middleware"
smithyhttp "github.com/aws/smithy-go/transport/http"
)
// Returns the detailed parameter list for a particular DB cluster parameter
// group. For more information on Amazon Aurora, see What is Amazon Aurora? (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html)
// in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters,
// see Multi-AZ DB cluster deployments (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html)
// in the Amazon RDS User Guide.
func (c *Client) DescribeDBClusterParameters(ctx context.Context, params *DescribeDBClusterParametersInput, optFns ...func(*Options)) (*DescribeDBClusterParametersOutput, error) {
if params == nil {
params = &DescribeDBClusterParametersInput{}
}
result, metadata, err := c.invokeOperation(ctx, "DescribeDBClusterParameters", params, optFns, c.addOperationDescribeDBClusterParametersMiddlewares)
if err != nil {
return nil, err
}
out := result.(*DescribeDBClusterParametersOutput)
out.ResultMetadata = metadata
return out, nil
}
type DescribeDBClusterParametersInput struct {
// The name of a specific DB cluster parameter group to return parameter details
// for. Constraints:
// - If supplied, must match the name of an existing DBClusterParameterGroup.
//
// This member is required.
DBClusterParameterGroupName *string
// This parameter isn't currently supported.
Filters []types.Filter
// An optional pagination token provided by a previous DescribeDBClusterParameters
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by MaxRecords .
Marker *string
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
MaxRecords *int32
// A value that indicates to return only parameters for a specific source.
// Parameter sources can be engine , service , or customer .
Source *string
noSmithyDocumentSerde
}
// Provides details about a DB cluster parameter group including the parameters in
// the DB cluster parameter group.
type DescribeDBClusterParametersOutput struct {
// An optional pagination token provided by a previous DescribeDBClusterParameters
// request. If this parameter is specified, the response includes only records
// beyond the marker, up to the value specified by MaxRecords .
Marker *string
// Provides a list of parameters for the DB cluster parameter group.
Parameters []types.Parameter
// Metadata pertaining to the operation's result.
ResultMetadata middleware.Metadata
noSmithyDocumentSerde
}
func (c *Client) addOperationDescribeDBClusterParametersMiddlewares(stack *middleware.Stack, options Options) (err error) {
err = stack.Serialize.Add(&awsAwsquery_serializeOpDescribeDBClusterParameters{}, middleware.After)
if err != nil {
return err
}
err = stack.Deserialize.Add(&awsAwsquery_deserializeOpDescribeDBClusterParameters{}, 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 = addOpDescribeDBClusterParametersValidationMiddleware(stack); err != nil {
return err
}
if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeDBClusterParameters(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
}
// DescribeDBClusterParametersAPIClient is a client that implements the
// DescribeDBClusterParameters operation.
type DescribeDBClusterParametersAPIClient interface {
DescribeDBClusterParameters(context.Context, *DescribeDBClusterParametersInput, ...func(*Options)) (*DescribeDBClusterParametersOutput, error)
}
var _ DescribeDBClusterParametersAPIClient = (*Client)(nil)
// DescribeDBClusterParametersPaginatorOptions is the paginator options for
// DescribeDBClusterParameters
type DescribeDBClusterParametersPaginatorOptions struct {
// The maximum number of records to include in the response. If more records exist
// than the specified MaxRecords value, a pagination token called a marker is
// included in the response so you can retrieve the remaining results. Default: 100
// Constraints: Minimum 20, maximum 100.
Limit int32
// Set to true if pagination should stop if the service returns a pagination token
// that matches the most recent token provided to the service.
StopOnDuplicateToken bool
}
// DescribeDBClusterParametersPaginator is a paginator for
// DescribeDBClusterParameters
type DescribeDBClusterParametersPaginator struct {
options DescribeDBClusterParametersPaginatorOptions
client DescribeDBClusterParametersAPIClient
params *DescribeDBClusterParametersInput
nextToken *string
firstPage bool
}
// NewDescribeDBClusterParametersPaginator returns a new
// DescribeDBClusterParametersPaginator
func NewDescribeDBClusterParametersPaginator(client DescribeDBClusterParametersAPIClient, params *DescribeDBClusterParametersInput, optFns ...func(*DescribeDBClusterParametersPaginatorOptions)) *DescribeDBClusterParametersPaginator {
if params == nil {
params = &DescribeDBClusterParametersInput{}
}
options := DescribeDBClusterParametersPaginatorOptions{}
if params.MaxRecords != nil {
options.Limit = *params.MaxRecords
}
for _, fn := range optFns {
fn(&options)
}
return &DescribeDBClusterParametersPaginator{
options: options,
client: client,
params: params,
firstPage: true,
nextToken: params.Marker,
}
}
// HasMorePages returns a boolean indicating whether more pages are available
func (p *DescribeDBClusterParametersPaginator) HasMorePages() bool {
return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0)
}
// NextPage retrieves the next DescribeDBClusterParameters page.
func (p *DescribeDBClusterParametersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*DescribeDBClusterParametersOutput, 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.MaxRecords = limit
result, err := p.client.DescribeDBClusterParameters(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_opDescribeDBClusterParameters(region string) *awsmiddleware.RegisterServiceMetadata {
return &awsmiddleware.RegisterServiceMetadata{
Region: region,
ServiceID: ServiceID,
SigningName: "rds",
OperationName: "DescribeDBClusterParameters",
}
}
| 253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.