From c1816d141d09116d5297d0fd1149642caad92b58 Mon Sep 17 00:00:00 2001 From: AWS SDK for Go v2 automation user Date: Wed, 15 Jun 2022 19:35:05 +0000 Subject: [PATCH] Regenerated Clients --- .../5be92db7bc7d4de2a2916a226bc620e8.json | 8 + .../82dd0dcdad944857ad7259b075ead66d.json | 8 + .../851324adb925497a942e0c12cdd53d4b.json | 8 + .../a121b85e792f437c9d971d95cb153d82.json | 8 + .../api_op_AssociateUserToPermissionGroup.go | 169 +++ ..._op_DisassociateUserFromPermissionGroup.go | 168 +++ .../finspacedata/api_op_GetPermissionGroup.go | 124 ++ service/finspacedata/api_op_GetUser.go | 2 +- .../api_op_ListPermissionGroupsByUser.go | 136 +++ .../api_op_ListUsersByPermissionGroup.go | 135 ++ service/finspacedata/api_op_UpdateUser.go | 2 +- service/finspacedata/deserializers.go | 1088 ++++++++++++++++- service/finspacedata/generated.json | 5 + service/finspacedata/serializers.go | 351 ++++++ service/finspacedata/types/enums.go | 21 + service/finspacedata/types/types.go | 107 +- service/finspacedata/validators.go | 201 +++ .../api_op_AcceptAdministratorInvitation.go | 129 ++ service/guardduty/api_op_AcceptInvitation.go | 3 + ...op_DisassociateFromAdministratorAccount.go | 117 ++ .../api_op_DisassociateFromMasterAccount.go | 3 + .../guardduty/api_op_DisassociateMembers.go | 5 +- .../api_op_GetAdministratorAccount.go | 124 ++ service/guardduty/api_op_GetMasterAccount.go | 2 + .../api_op_GetRemainingFreeTrialDays.go | 130 ++ .../guardduty/api_op_GetUsageStatistics.go | 8 +- service/guardduty/deserializers.go | 1075 ++++++++++++++-- service/guardduty/doc.go | 30 +- service/guardduty/generated.json | 4 + service/guardduty/serializers.go | 285 +++++ service/guardduty/types/types.go | 103 ++ service/guardduty/validators.go | 162 +++ ...pi_op_ListAttributeGroupsForApplication.go | 223 ++++ .../api_op_UpdateApplication.go | 5 +- .../api_op_UpdateAttributeGroup.go | 5 +- .../deserializers.go | 275 +++++ .../servicecatalogappregistry/generated.json | 1 + .../servicecatalogappregistry/serializers.go | 66 + .../servicecatalogappregistry/types/types.go | 15 + .../servicecatalogappregistry/validators.go | 39 + .../workspaces/api_op_ImportWorkspaceImage.go | 14 +- service/workspaces/deserializers.go | 9 + service/workspaces/types/errors.go | 2 + service/workspaces/types/types.go | 40 +- 44 files changed, 5198 insertions(+), 217 deletions(-) create mode 100644 .changelog/5be92db7bc7d4de2a2916a226bc620e8.json create mode 100644 .changelog/82dd0dcdad944857ad7259b075ead66d.json create mode 100644 .changelog/851324adb925497a942e0c12cdd53d4b.json create mode 100644 .changelog/a121b85e792f437c9d971d95cb153d82.json create mode 100644 service/finspacedata/api_op_AssociateUserToPermissionGroup.go create mode 100644 service/finspacedata/api_op_DisassociateUserFromPermissionGroup.go create mode 100644 service/finspacedata/api_op_GetPermissionGroup.go create mode 100644 service/finspacedata/api_op_ListPermissionGroupsByUser.go create mode 100644 service/finspacedata/api_op_ListUsersByPermissionGroup.go create mode 100644 service/guardduty/api_op_AcceptAdministratorInvitation.go create mode 100644 service/guardduty/api_op_DisassociateFromAdministratorAccount.go create mode 100644 service/guardduty/api_op_GetAdministratorAccount.go create mode 100644 service/guardduty/api_op_GetRemainingFreeTrialDays.go create mode 100644 service/servicecatalogappregistry/api_op_ListAttributeGroupsForApplication.go diff --git a/.changelog/5be92db7bc7d4de2a2916a226bc620e8.json b/.changelog/5be92db7bc7d4de2a2916a226bc620e8.json new file mode 100644 index 00000000000..3a12ca01ab5 --- /dev/null +++ b/.changelog/5be92db7bc7d4de2a2916a226bc620e8.json @@ -0,0 +1,8 @@ +{ + "id": "5be92db7-bc7d-4de2-a291-6a226bc620e8", + "type": "feature", + "description": "Adds finding fields available from GuardDuty Console. Adds FreeTrial related operations. Deprecates the use of various APIs related to Master Accounts and Replace them with Administrator Accounts.", + "modules": [ + "service/guardduty" + ] +} \ No newline at end of file diff --git a/.changelog/82dd0dcdad944857ad7259b075ead66d.json b/.changelog/82dd0dcdad944857ad7259b075ead66d.json new file mode 100644 index 00000000000..0814e464001 --- /dev/null +++ b/.changelog/82dd0dcdad944857ad7259b075ead66d.json @@ -0,0 +1,8 @@ +{ + "id": "82dd0dcd-ad94-4857-ad72-59b075ead66d", + "type": "feature", + "description": "This release adds a new set of APIs, GetPermissionGroup, DisassociateUserFromPermissionGroup, AssociateUserToPermissionGroup, ListPermissionGroupsByUser, ListUsersByPermissionGroup.", + "modules": [ + "service/finspacedata" + ] +} \ No newline at end of file diff --git a/.changelog/851324adb925497a942e0c12cdd53d4b.json b/.changelog/851324adb925497a942e0c12cdd53d4b.json new file mode 100644 index 00000000000..714bfd5cea0 --- /dev/null +++ b/.changelog/851324adb925497a942e0c12cdd53d4b.json @@ -0,0 +1,8 @@ +{ + "id": "851324ad-b925-497a-942e-0c12cdd53d4b", + "type": "feature", + "description": "Added new field \"reason\" to OperationNotSupportedException. Receiving this exception in the DeregisterWorkspaceDirectory API will now return a reason giving more context on the failure.", + "modules": [ + "service/workspaces" + ] +} \ No newline at end of file diff --git a/.changelog/a121b85e792f437c9d971d95cb153d82.json b/.changelog/a121b85e792f437c9d971d95cb153d82.json new file mode 100644 index 00000000000..726b6fb64d4 --- /dev/null +++ b/.changelog/a121b85e792f437c9d971d95cb153d82.json @@ -0,0 +1,8 @@ +{ + "id": "a121b85e-792f-437c-9d97-1d95cb153d82", + "type": "feature", + "description": "This release adds a new API ListAttributeGroupsForApplication that returns associated attribute groups of an application. In addition, the UpdateApplication and UpdateAttributeGroup APIs will not allow users to update the 'Name' attribute.", + "modules": [ + "service/servicecatalogappregistry" + ] +} \ No newline at end of file diff --git a/service/finspacedata/api_op_AssociateUserToPermissionGroup.go b/service/finspacedata/api_op_AssociateUserToPermissionGroup.go new file mode 100644 index 00000000000..25379afd575 --- /dev/null +++ b/service/finspacedata/api_op_AssociateUserToPermissionGroup.go @@ -0,0 +1,169 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package finspacedata + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Adds a user account to a permission group to grant permissions for actions a +// user can perform in FinSpace. +func (c *Client) AssociateUserToPermissionGroup(ctx context.Context, params *AssociateUserToPermissionGroupInput, optFns ...func(*Options)) (*AssociateUserToPermissionGroupOutput, error) { + if params == nil { + params = &AssociateUserToPermissionGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "AssociateUserToPermissionGroup", params, optFns, c.addOperationAssociateUserToPermissionGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*AssociateUserToPermissionGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +type AssociateUserToPermissionGroupInput struct { + + // The unique identifier for the permission group. + // + // This member is required. + PermissionGroupId *string + + // The unique identifier for the user. + // + // This member is required. + UserId *string + + // A token that ensures idempotency. This token expires in 10 minutes. + ClientToken *string + + noSmithyDocumentSerde +} + +type AssociateUserToPermissionGroupOutput struct { + + // The returned status code of the response. + StatusCode int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationAssociateUserToPermissionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpAssociateUserToPermissionGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAssociateUserToPermissionGroup{}, 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 = addRestJsonContentTypeCustomization(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opAssociateUserToPermissionGroupMiddleware(stack, options); err != nil { + return err + } + if err = addOpAssociateUserToPermissionGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAssociateUserToPermissionGroup(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpAssociateUserToPermissionGroup struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpAssociateUserToPermissionGroup) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpAssociateUserToPermissionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.tokenProvider == nil { + return next.HandleInitialize(ctx, in) + } + + input, ok := in.Parameters.(*AssociateUserToPermissionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *AssociateUserToPermissionGroupInput ") + } + + if input.ClientToken == nil { + t, err := m.tokenProvider.GetIdempotencyToken() + if err != nil { + return out, metadata, err + } + input.ClientToken = &t + } + return next.HandleInitialize(ctx, in) +} +func addIdempotencyToken_opAssociateUserToPermissionGroupMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpAssociateUserToPermissionGroup{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opAssociateUserToPermissionGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "finspace-api", + OperationName: "AssociateUserToPermissionGroup", + } +} diff --git a/service/finspacedata/api_op_DisassociateUserFromPermissionGroup.go b/service/finspacedata/api_op_DisassociateUserFromPermissionGroup.go new file mode 100644 index 00000000000..f22385b504e --- /dev/null +++ b/service/finspacedata/api_op_DisassociateUserFromPermissionGroup.go @@ -0,0 +1,168 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package finspacedata + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes a user account from a permission group. +func (c *Client) DisassociateUserFromPermissionGroup(ctx context.Context, params *DisassociateUserFromPermissionGroupInput, optFns ...func(*Options)) (*DisassociateUserFromPermissionGroupOutput, error) { + if params == nil { + params = &DisassociateUserFromPermissionGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisassociateUserFromPermissionGroup", params, optFns, c.addOperationDisassociateUserFromPermissionGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisassociateUserFromPermissionGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisassociateUserFromPermissionGroupInput struct { + + // The unique identifier for the permission group. + // + // This member is required. + PermissionGroupId *string + + // The unique identifier for the user. + // + // This member is required. + UserId *string + + // A token that ensures idempotency. This token expires in 10 minutes. + ClientToken *string + + noSmithyDocumentSerde +} + +type DisassociateUserFromPermissionGroupOutput struct { + + // The returned status code of the response. + StatusCode int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisassociateUserFromPermissionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisassociateUserFromPermissionGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisassociateUserFromPermissionGroup{}, 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 = addRestJsonContentTypeCustomization(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opDisassociateUserFromPermissionGroupMiddleware(stack, options); err != nil { + return err + } + if err = addOpDisassociateUserFromPermissionGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateUserFromPermissionGroup(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpDisassociateUserFromPermissionGroup struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpDisassociateUserFromPermissionGroup) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpDisassociateUserFromPermissionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.tokenProvider == nil { + return next.HandleInitialize(ctx, in) + } + + input, ok := in.Parameters.(*DisassociateUserFromPermissionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *DisassociateUserFromPermissionGroupInput ") + } + + if input.ClientToken == nil { + t, err := m.tokenProvider.GetIdempotencyToken() + if err != nil { + return out, metadata, err + } + input.ClientToken = &t + } + return next.HandleInitialize(ctx, in) +} +func addIdempotencyToken_opDisassociateUserFromPermissionGroupMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpDisassociateUserFromPermissionGroup{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opDisassociateUserFromPermissionGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "finspace-api", + OperationName: "DisassociateUserFromPermissionGroup", + } +} diff --git a/service/finspacedata/api_op_GetPermissionGroup.go b/service/finspacedata/api_op_GetPermissionGroup.go new file mode 100644 index 00000000000..120eabc5cb3 --- /dev/null +++ b/service/finspacedata/api_op_GetPermissionGroup.go @@ -0,0 +1,124 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package finspacedata + +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/finspacedata/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves the details of a specific permission group. +func (c *Client) GetPermissionGroup(ctx context.Context, params *GetPermissionGroupInput, optFns ...func(*Options)) (*GetPermissionGroupOutput, error) { + if params == nil { + params = &GetPermissionGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetPermissionGroup", params, optFns, c.addOperationGetPermissionGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetPermissionGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetPermissionGroupInput struct { + + // The unique identifier for the permission group. + // + // This member is required. + PermissionGroupId *string + + noSmithyDocumentSerde +} + +type GetPermissionGroupOutput struct { + + // The structure for a permission group. + PermissionGroup *types.PermissionGroup + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetPermissionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetPermissionGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetPermissionGroup{}, 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 = addRestJsonContentTypeCustomization(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 = addOpGetPermissionGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPermissionGroup(options.Region), middleware.Before); 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_opGetPermissionGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "finspace-api", + OperationName: "GetPermissionGroup", + } +} diff --git a/service/finspacedata/api_op_GetUser.go b/service/finspacedata/api_op_GetUser.go index 503d86ad7b5..5161187b0b9 100644 --- a/service/finspacedata/api_op_GetUser.go +++ b/service/finspacedata/api_op_GetUser.go @@ -101,7 +101,7 @@ type GetUserOutput struct { // // * APP_USER – A user with specific // permissions in FinSpace. The users are assigned permissions by adding them to a - // permissions group. + // permission group. Type types.UserType // The unique identifier for the user account that is retrieved. diff --git a/service/finspacedata/api_op_ListPermissionGroupsByUser.go b/service/finspacedata/api_op_ListPermissionGroupsByUser.go new file mode 100644 index 00000000000..b516489f038 --- /dev/null +++ b/service/finspacedata/api_op_ListPermissionGroupsByUser.go @@ -0,0 +1,136 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package finspacedata + +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/finspacedata/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists all the permission groups that are associated with a specific user +// account. +func (c *Client) ListPermissionGroupsByUser(ctx context.Context, params *ListPermissionGroupsByUserInput, optFns ...func(*Options)) (*ListPermissionGroupsByUserOutput, error) { + if params == nil { + params = &ListPermissionGroupsByUserInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListPermissionGroupsByUser", params, optFns, c.addOperationListPermissionGroupsByUserMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListPermissionGroupsByUserOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListPermissionGroupsByUserInput struct { + + // The maximum number of results per page. + // + // This member is required. + MaxResults int32 + + // The unique identifier for the user. + // + // This member is required. + UserId *string + + // A token that indicates where a results page should begin. + NextToken *string + + noSmithyDocumentSerde +} + +type ListPermissionGroupsByUserOutput struct { + + // A token that indicates where a results page should begin. + NextToken *string + + // A list of returned permission groups. + PermissionGroups []types.PermissionGroupByUser + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListPermissionGroupsByUserMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListPermissionGroupsByUser{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListPermissionGroupsByUser{}, 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 = addRestJsonContentTypeCustomization(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 = addOpListPermissionGroupsByUserValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListPermissionGroupsByUser(options.Region), middleware.Before); 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_opListPermissionGroupsByUser(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "finspace-api", + OperationName: "ListPermissionGroupsByUser", + } +} diff --git a/service/finspacedata/api_op_ListUsersByPermissionGroup.go b/service/finspacedata/api_op_ListUsersByPermissionGroup.go new file mode 100644 index 00000000000..88f18e73b8c --- /dev/null +++ b/service/finspacedata/api_op_ListUsersByPermissionGroup.go @@ -0,0 +1,135 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package finspacedata + +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/finspacedata/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists details of all the users in a specific permission group. +func (c *Client) ListUsersByPermissionGroup(ctx context.Context, params *ListUsersByPermissionGroupInput, optFns ...func(*Options)) (*ListUsersByPermissionGroupOutput, error) { + if params == nil { + params = &ListUsersByPermissionGroupInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListUsersByPermissionGroup", params, optFns, c.addOperationListUsersByPermissionGroupMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListUsersByPermissionGroupOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListUsersByPermissionGroupInput struct { + + // The maximum number of results per page. + // + // This member is required. + MaxResults int32 + + // The unique identifier for the permission group. + // + // This member is required. + PermissionGroupId *string + + // A token that indicates where a results page should begin. + NextToken *string + + noSmithyDocumentSerde +} + +type ListUsersByPermissionGroupOutput struct { + + // A token that indicates where a results page should begin. + NextToken *string + + // Lists details of all users in a specific permission group. + Users []types.UserByPermissionGroup + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListUsersByPermissionGroupMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListUsersByPermissionGroup{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListUsersByPermissionGroup{}, 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 = addRestJsonContentTypeCustomization(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 = addOpListUsersByPermissionGroupValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListUsersByPermissionGroup(options.Region), middleware.Before); 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_opListUsersByPermissionGroup(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "finspace-api", + OperationName: "ListUsersByPermissionGroup", + } +} diff --git a/service/finspacedata/api_op_UpdateUser.go b/service/finspacedata/api_op_UpdateUser.go index 3a6c4a5cd94..f5a98a37363 100644 --- a/service/finspacedata/api_op_UpdateUser.go +++ b/service/finspacedata/api_op_UpdateUser.go @@ -68,7 +68,7 @@ type UpdateUserInput struct { // // * APP_USER – A user with // specific permissions in FinSpace. The users are assigned permissions by adding - // them to a permissions group. + // them to a permission group. Type types.UserType noSmithyDocumentSerde diff --git a/service/finspacedata/deserializers.go b/service/finspacedata/deserializers.go index c4ea28117df..aee5844c9d3 100644 --- a/service/finspacedata/deserializers.go +++ b/service/finspacedata/deserializers.go @@ -18,6 +18,119 @@ import ( "strings" ) +type awsRestjson1_deserializeOpAssociateUserToPermissionGroup struct { +} + +func (*awsRestjson1_deserializeOpAssociateUserToPermissionGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpAssociateUserToPermissionGroup) 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_deserializeOpErrorAssociateUserToPermissionGroup(response, &metadata) + } + output := &AssociateUserToPermissionGroupOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsAssociateUserToPermissionGroupOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorAssociateUserToPermissionGroup(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsAssociateUserToPermissionGroupOutput(v *AssociateUserToPermissionGroupOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + v.StatusCode = int32(response.StatusCode) + + return nil +} + type awsRestjson1_deserializeOpCreateChangeset struct { } @@ -1376,6 +1489,119 @@ func awsRestjson1_deserializeOpDocumentDisableUserOutput(v **DisableUserOutput, return nil } +type awsRestjson1_deserializeOpDisassociateUserFromPermissionGroup struct { +} + +func (*awsRestjson1_deserializeOpDisassociateUserFromPermissionGroup) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisassociateUserFromPermissionGroup) 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_deserializeOpErrorDisassociateUserFromPermissionGroup(response, &metadata) + } + output := &DisassociateUserFromPermissionGroupOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsDisassociateUserFromPermissionGroupOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDisassociateUserFromPermissionGroup(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsDisassociateUserFromPermissionGroupOutput(v *DisassociateUserFromPermissionGroupOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + v.StatusCode = int32(response.StatusCode) + + return nil +} + type awsRestjson1_deserializeOpEnableUser struct { } @@ -2328,14 +2554,14 @@ func awsRestjson1_deserializeOpDocumentGetDataViewOutput(v **GetDataViewOutput, return nil } -type awsRestjson1_deserializeOpGetProgrammaticAccessCredentials struct { +type awsRestjson1_deserializeOpGetPermissionGroup struct { } -func (*awsRestjson1_deserializeOpGetProgrammaticAccessCredentials) ID() string { +func (*awsRestjson1_deserializeOpGetPermissionGroup) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetProgrammaticAccessCredentials) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetPermissionGroup) 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) @@ -2349,9 +2575,9 @@ func (m *awsRestjson1_deserializeOpGetProgrammaticAccessCredentials) HandleDeser } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetProgrammaticAccessCredentials(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetPermissionGroup(response, &metadata) } - output := &GetProgrammaticAccessCredentialsOutput{} + output := &GetPermissionGroupOutput{} out.Result = output var buff [1024]byte @@ -2372,7 +2598,7 @@ func (m *awsRestjson1_deserializeOpGetProgrammaticAccessCredentials) HandleDeser return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetProgrammaticAccessCredentialsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetPermissionGroupOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -2385,7 +2611,7 @@ func (m *awsRestjson1_deserializeOpGetProgrammaticAccessCredentials) HandleDeser return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetProgrammaticAccessCredentials(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetPermissionGroup(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)} @@ -2432,6 +2658,9 @@ func awsRestjson1_deserializeOpErrorGetProgrammaticAccessCredentials(response *s case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -2448,7 +2677,7 @@ func awsRestjson1_deserializeOpErrorGetProgrammaticAccessCredentials(response *s } } -func awsRestjson1_deserializeOpDocumentGetProgrammaticAccessCredentialsOutput(v **GetProgrammaticAccessCredentialsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentGetPermissionGroupOutput(v **GetPermissionGroupOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -2461,33 +2690,20 @@ func awsRestjson1_deserializeOpDocumentGetProgrammaticAccessCredentialsOutput(v return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetProgrammaticAccessCredentialsOutput + var sv *GetPermissionGroupOutput if *v == nil { - sv = &GetProgrammaticAccessCredentialsOutput{} + sv = &GetPermissionGroupOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "credentials": - if err := awsRestjson1_deserializeDocumentCredentials(&sv.Credentials, value); err != nil { + case "permissionGroup": + if err := awsRestjson1_deserializeDocumentPermissionGroup(&sv.PermissionGroup, value); err != nil { return err } - case "durationInMinutes": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected SessionDuration to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.DurationInMinutes = i64 - } - default: _, _ = key, value @@ -2497,14 +2713,14 @@ func awsRestjson1_deserializeOpDocumentGetProgrammaticAccessCredentialsOutput(v return nil } -type awsRestjson1_deserializeOpGetUser struct { +type awsRestjson1_deserializeOpGetProgrammaticAccessCredentials struct { } -func (*awsRestjson1_deserializeOpGetUser) ID() string { +func (*awsRestjson1_deserializeOpGetProgrammaticAccessCredentials) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetUser) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetProgrammaticAccessCredentials) 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) @@ -2518,9 +2734,9 @@ func (m *awsRestjson1_deserializeOpGetUser) HandleDeserialize(ctx context.Contex } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetUser(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetProgrammaticAccessCredentials(response, &metadata) } - output := &GetUserOutput{} + output := &GetProgrammaticAccessCredentialsOutput{} out.Result = output var buff [1024]byte @@ -2541,7 +2757,7 @@ func (m *awsRestjson1_deserializeOpGetUser) HandleDeserialize(ctx context.Contex return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetUserOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetProgrammaticAccessCredentialsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -2554,7 +2770,7 @@ func (m *awsRestjson1_deserializeOpGetUser) HandleDeserialize(ctx context.Contex return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetUser(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetProgrammaticAccessCredentials(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)} @@ -2601,9 +2817,6 @@ func awsRestjson1_deserializeOpErrorGetUser(response *smithyhttp.Response, metad case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -2620,7 +2833,7 @@ func awsRestjson1_deserializeOpErrorGetUser(response *smithyhttp.Response, metad } } -func awsRestjson1_deserializeOpDocumentGetUserOutput(v **GetUserOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentGetProgrammaticAccessCredentialsOutput(v **GetProgrammaticAccessCredentialsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -2633,16 +2846,188 @@ func awsRestjson1_deserializeOpDocumentGetUserOutput(v **GetUserOutput, value in return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetUserOutput + var sv *GetProgrammaticAccessCredentialsOutput if *v == nil { - sv = &GetUserOutput{} + sv = &GetProgrammaticAccessCredentialsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "apiAccess": + case "credentials": + if err := awsRestjson1_deserializeDocumentCredentials(&sv.Credentials, value); err != nil { + return err + } + + case "durationInMinutes": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected SessionDuration to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.DurationInMinutes = i64 + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetUser struct { +} + +func (*awsRestjson1_deserializeOpGetUser) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetUser) 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_deserializeOpErrorGetUser(response, &metadata) + } + output := &GetUserOutput{} + 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_deserializeOpDocumentGetUserOutput(&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_deserializeOpErrorGetUser(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetUserOutput(v **GetUserOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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 *GetUserOutput + if *v == nil { + sv = &GetUserOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "apiAccess": if value != nil { jtv, ok := value.(string) if !ok { @@ -3480,7 +3865,340 @@ func (*awsRestjson1_deserializeOpListPermissionGroups) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListPermissionGroups) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListPermissionGroups) 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_deserializeOpErrorListPermissionGroups(response, &metadata) + } + output := &ListPermissionGroupsOutput{} + 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_deserializeOpDocumentListPermissionGroupsOutput(&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_deserializeOpErrorListPermissionGroups(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListPermissionGroupsOutput(v **ListPermissionGroupsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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 *ListPermissionGroupsOutput + if *v == nil { + sv = &ListPermissionGroupsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "permissionGroups": + if err := awsRestjson1_deserializeDocumentPermissionGroupList(&sv.PermissionGroups, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListPermissionGroupsByUser struct { +} + +func (*awsRestjson1_deserializeOpListPermissionGroupsByUser) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListPermissionGroupsByUser) 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_deserializeOpErrorListPermissionGroupsByUser(response, &metadata) + } + output := &ListPermissionGroupsByUserOutput{} + 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_deserializeOpDocumentListPermissionGroupsByUserOutput(&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_deserializeOpErrorListPermissionGroupsByUser(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListPermissionGroupsByUserOutput(v **ListPermissionGroupsByUserOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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 *ListPermissionGroupsByUserOutput + if *v == nil { + sv = &ListPermissionGroupsByUserOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "permissionGroups": + if err := awsRestjson1_deserializeDocumentPermissionGroupByUserList(&sv.PermissionGroups, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListUsers struct { +} + +func (*awsRestjson1_deserializeOpListUsers) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListUsers) 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) @@ -3494,9 +4212,9 @@ func (m *awsRestjson1_deserializeOpListPermissionGroups) HandleDeserialize(ctx c } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListPermissionGroups(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListUsers(response, &metadata) } - output := &ListPermissionGroupsOutput{} + output := &ListUsersOutput{} out.Result = output var buff [1024]byte @@ -3517,7 +4235,7 @@ func (m *awsRestjson1_deserializeOpListPermissionGroups) HandleDeserialize(ctx c return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListPermissionGroupsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListUsersOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -3530,7 +4248,7 @@ func (m *awsRestjson1_deserializeOpListPermissionGroups) HandleDeserialize(ctx c return out, metadata, err } -func awsRestjson1_deserializeOpErrorListPermissionGroups(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListUsers(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)} @@ -3593,7 +4311,7 @@ func awsRestjson1_deserializeOpErrorListPermissionGroups(response *smithyhttp.Re } } -func awsRestjson1_deserializeOpDocumentListPermissionGroupsOutput(v **ListPermissionGroupsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -3606,9 +4324,9 @@ func awsRestjson1_deserializeOpDocumentListPermissionGroupsOutput(v **ListPermis return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListPermissionGroupsOutput + var sv *ListUsersOutput if *v == nil { - sv = &ListPermissionGroupsOutput{} + sv = &ListUsersOutput{} } else { sv = *v } @@ -3624,8 +4342,8 @@ func awsRestjson1_deserializeOpDocumentListPermissionGroupsOutput(v **ListPermis sv.NextToken = ptr.String(jtv) } - case "permissionGroups": - if err := awsRestjson1_deserializeDocumentPermissionGroupList(&sv.PermissionGroups, value); err != nil { + case "users": + if err := awsRestjson1_deserializeDocumentUserList(&sv.Users, value); err != nil { return err } @@ -3638,14 +4356,14 @@ func awsRestjson1_deserializeOpDocumentListPermissionGroupsOutput(v **ListPermis return nil } -type awsRestjson1_deserializeOpListUsers struct { +type awsRestjson1_deserializeOpListUsersByPermissionGroup struct { } -func (*awsRestjson1_deserializeOpListUsers) ID() string { +func (*awsRestjson1_deserializeOpListUsersByPermissionGroup) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListUsersByPermissionGroup) 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) @@ -3659,9 +4377,9 @@ func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Cont } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorListUsers(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListUsersByPermissionGroup(response, &metadata) } - output := &ListUsersOutput{} + output := &ListUsersByPermissionGroupOutput{} out.Result = output var buff [1024]byte @@ -3682,7 +4400,7 @@ func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Cont return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentListUsersOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListUsersByPermissionGroupOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -3695,7 +4413,7 @@ func (m *awsRestjson1_deserializeOpListUsers) HandleDeserialize(ctx context.Cont return out, metadata, err } -func awsRestjson1_deserializeOpErrorListUsers(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListUsersByPermissionGroup(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)} @@ -3742,6 +4460,9 @@ func awsRestjson1_deserializeOpErrorListUsers(response *smithyhttp.Response, met case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) @@ -3758,7 +4479,7 @@ func awsRestjson1_deserializeOpErrorListUsers(response *smithyhttp.Response, met } } -func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListUsersByPermissionGroupOutput(v **ListUsersByPermissionGroupOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -3771,9 +4492,9 @@ func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, valu return fmt.Errorf("unexpected JSON type %v", value) } - var sv *ListUsersOutput + var sv *ListUsersByPermissionGroupOutput if *v == nil { - sv = &ListUsersOutput{} + sv = &ListUsersByPermissionGroupOutput{} } else { sv = *v } @@ -3790,7 +4511,7 @@ func awsRestjson1_deserializeOpDocumentListUsersOutput(v **ListUsersOutput, valu } case "users": - if err := awsRestjson1_deserializeDocumentUserList(&sv.Users, value); err != nil { + if err := awsRestjson1_deserializeDocumentUserByPermissionGroupList(&sv.Users, value); err != nil { return err } @@ -6113,6 +6834,73 @@ func awsRestjson1_deserializeDocumentPermissionGroup(v **types.PermissionGroup, sv.LastModifiedTime = i64 } + case "membershipStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PermissionGroupMembershipStatus to be of type string, got %T instead", value) + } + sv.MembershipStatus = types.PermissionGroupMembershipStatus(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PermissionGroupName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "permissionGroupId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PermissionGroupId to be of type string, got %T instead", value) + } + sv.PermissionGroupId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPermissionGroupByUser(v **types.PermissionGroupByUser, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.PermissionGroupByUser + if *v == nil { + sv = &types.PermissionGroupByUser{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "membershipStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PermissionGroupMembershipStatus to be of type string, got %T instead", value) + } + sv.MembershipStatus = types.PermissionGroupMembershipStatus(jtv) + } + case "name": if value != nil { jtv, ok := value.(string) @@ -6140,6 +6928,40 @@ func awsRestjson1_deserializeDocumentPermissionGroup(v **types.PermissionGroup, return nil } +func awsRestjson1_deserializeDocumentPermissionGroupByUserList(v *[]types.PermissionGroupByUser, 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.PermissionGroupByUser + if *v == nil { + cv = []types.PermissionGroupByUser{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.PermissionGroupByUser + destAddr := &col + if err := awsRestjson1_deserializeDocumentPermissionGroupByUser(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentPermissionGroupList(v *[]types.PermissionGroup, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -6607,6 +7429,152 @@ func awsRestjson1_deserializeDocumentUser(v **types.User, value interface{}) err return nil } +func awsRestjson1_deserializeDocumentUserByPermissionGroup(v **types.UserByPermissionGroup, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.UserByPermissionGroup + if *v == nil { + sv = &types.UserByPermissionGroup{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "apiAccess": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApiAccess to be of type string, got %T instead", value) + } + sv.ApiAccess = types.ApiAccess(jtv) + } + + case "apiAccessPrincipalArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) + } + sv.ApiAccessPrincipalArn = ptr.String(jtv) + } + + case "emailAddress": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Email to be of type string, got %T instead", value) + } + sv.EmailAddress = ptr.String(jtv) + } + + case "firstName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FirstName to be of type string, got %T instead", value) + } + sv.FirstName = ptr.String(jtv) + } + + case "lastName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LastName to be of type string, got %T instead", value) + } + sv.LastName = ptr.String(jtv) + } + + case "membershipStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PermissionGroupMembershipStatus to be of type string, got %T instead", value) + } + sv.MembershipStatus = types.PermissionGroupMembershipStatus(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UserStatus to be of type string, got %T instead", value) + } + sv.Status = types.UserStatus(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UserType to be of type string, got %T instead", value) + } + sv.Type = types.UserType(jtv) + } + + case "userId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected UserId to be of type string, got %T instead", value) + } + sv.UserId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentUserByPermissionGroupList(v *[]types.UserByPermissionGroup, 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.UserByPermissionGroup + if *v == nil { + cv = []types.UserByPermissionGroup{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.UserByPermissionGroup + destAddr := &col + if err := awsRestjson1_deserializeDocumentUserByPermissionGroup(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentUserList(v *[]types.User, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/finspacedata/generated.json b/service/finspacedata/generated.json index 2e4749de211..a629030b879 100644 --- a/service/finspacedata/generated.json +++ b/service/finspacedata/generated.json @@ -8,6 +8,7 @@ "files": [ "api_client.go", "api_client_test.go", + "api_op_AssociateUserToPermissionGroup.go", "api_op_CreateChangeset.go", "api_op_CreateDataView.go", "api_op_CreateDataset.go", @@ -16,10 +17,12 @@ "api_op_DeleteDataset.go", "api_op_DeletePermissionGroup.go", "api_op_DisableUser.go", + "api_op_DisassociateUserFromPermissionGroup.go", "api_op_EnableUser.go", "api_op_GetChangeset.go", "api_op_GetDataView.go", "api_op_GetDataset.go", + "api_op_GetPermissionGroup.go", "api_op_GetProgrammaticAccessCredentials.go", "api_op_GetUser.go", "api_op_GetWorkingLocation.go", @@ -27,7 +30,9 @@ "api_op_ListDataViews.go", "api_op_ListDatasets.go", "api_op_ListPermissionGroups.go", + "api_op_ListPermissionGroupsByUser.go", "api_op_ListUsers.go", + "api_op_ListUsersByPermissionGroup.go", "api_op_ResetUserPassword.go", "api_op_UpdateChangeset.go", "api_op_UpdateDataset.go", diff --git a/service/finspacedata/serializers.go b/service/finspacedata/serializers.go index 8e3f0d66e20..c64905fbeeb 100644 --- a/service/finspacedata/serializers.go +++ b/service/finspacedata/serializers.go @@ -14,6 +14,96 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) +type awsRestjson1_serializeOpAssociateUserToPermissionGroup struct { +} + +func (*awsRestjson1_serializeOpAssociateUserToPermissionGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpAssociateUserToPermissionGroup) 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.(*AssociateUserToPermissionGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/permission-group/{permissionGroupId}/users/{userId}") + 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_serializeOpHttpBindingsAssociateUserToPermissionGroupInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentAssociateUserToPermissionGroupInput(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_serializeOpHttpBindingsAssociateUserToPermissionGroupInput(v *AssociateUserToPermissionGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.PermissionGroupId == nil || len(*v.PermissionGroupId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member permissionGroupId must not be empty")} + } + if v.PermissionGroupId != nil { + if err := encoder.SetURI("permissionGroupId").String(*v.PermissionGroupId); err != nil { + return err + } + } + + if v.UserId == nil || len(*v.UserId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member userId must not be empty")} + } + if v.UserId != nil { + if err := encoder.SetURI("userId").String(*v.UserId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentAssociateUserToPermissionGroupInput(v *AssociateUserToPermissionGroupInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + return nil +} + type awsRestjson1_serializeOpCreateChangeset struct { } @@ -723,6 +813,77 @@ func awsRestjson1_serializeOpDocumentDisableUserInput(v *DisableUserInput, value return nil } +type awsRestjson1_serializeOpDisassociateUserFromPermissionGroup struct { +} + +func (*awsRestjson1_serializeOpDisassociateUserFromPermissionGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisassociateUserFromPermissionGroup) 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.(*DisassociateUserFromPermissionGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/permission-group/{permissionGroupId}/users/{userId}") + 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_serializeOpHttpBindingsDisassociateUserFromPermissionGroupInput(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_serializeOpHttpBindingsDisassociateUserFromPermissionGroupInput(v *DisassociateUserFromPermissionGroupInput, 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.PermissionGroupId == nil || len(*v.PermissionGroupId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member permissionGroupId must not be empty")} + } + if v.PermissionGroupId != nil { + if err := encoder.SetURI("permissionGroupId").String(*v.PermissionGroupId); err != nil { + return err + } + } + + if v.UserId == nil || len(*v.UserId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member userId must not be empty")} + } + if v.UserId != nil { + if err := encoder.SetURI("userId").String(*v.UserId); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpEnableUser struct { } @@ -996,6 +1157,64 @@ func awsRestjson1_serializeOpHttpBindingsGetDataViewInput(v *GetDataViewInput, e return nil } +type awsRestjson1_serializeOpGetPermissionGroup struct { +} + +func (*awsRestjson1_serializeOpGetPermissionGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetPermissionGroup) 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.(*GetPermissionGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/permission-group/{permissionGroupId}") + 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_serializeOpHttpBindingsGetPermissionGroupInput(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_serializeOpHttpBindingsGetPermissionGroupInput(v *GetPermissionGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.PermissionGroupId == nil || len(*v.PermissionGroupId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member permissionGroupId must not be empty")} + } + if v.PermissionGroupId != nil { + if err := encoder.SetURI("permissionGroupId").String(*v.PermissionGroupId); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpGetProgrammaticAccessCredentials struct { } @@ -1425,6 +1644,72 @@ func awsRestjson1_serializeOpHttpBindingsListPermissionGroupsInput(v *ListPermis return nil } +type awsRestjson1_serializeOpListPermissionGroupsByUser struct { +} + +func (*awsRestjson1_serializeOpListPermissionGroupsByUser) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListPermissionGroupsByUser) 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.(*ListPermissionGroupsByUserInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/user/{userId}/permission-groups") + 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_serializeOpHttpBindingsListPermissionGroupsByUserInput(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_serializeOpHttpBindingsListPermissionGroupsByUserInput(v *ListPermissionGroupsByUserInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + { + encoder.SetQuery("maxResults").Integer(v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.UserId == nil || len(*v.UserId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member userId must not be empty")} + } + if v.UserId != nil { + if err := encoder.SetURI("userId").String(*v.UserId); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpListUsers struct { } @@ -1482,6 +1767,72 @@ func awsRestjson1_serializeOpHttpBindingsListUsersInput(v *ListUsersInput, encod return nil } +type awsRestjson1_serializeOpListUsersByPermissionGroup struct { +} + +func (*awsRestjson1_serializeOpListUsersByPermissionGroup) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListUsersByPermissionGroup) 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.(*ListUsersByPermissionGroupInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/permission-group/{permissionGroupId}/users") + 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_serializeOpHttpBindingsListUsersByPermissionGroupInput(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_serializeOpHttpBindingsListUsersByPermissionGroupInput(v *ListUsersByPermissionGroupInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + { + encoder.SetQuery("maxResults").Integer(v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.PermissionGroupId == nil || len(*v.PermissionGroupId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member permissionGroupId must not be empty")} + } + if v.PermissionGroupId != nil { + if err := encoder.SetURI("permissionGroupId").String(*v.PermissionGroupId); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpResetUserPassword struct { } diff --git a/service/finspacedata/types/enums.go b/service/finspacedata/types/enums.go index fc757d14fd6..3374fe637c3 100644 --- a/service/finspacedata/types/enums.go +++ b/service/finspacedata/types/enums.go @@ -266,6 +266,27 @@ func (LocationType) Values() []LocationType { } } +type PermissionGroupMembershipStatus string + +// Enum values for PermissionGroupMembershipStatus +const ( + PermissionGroupMembershipStatusAdditionInProgress PermissionGroupMembershipStatus = "ADDITION_IN_PROGRESS" + PermissionGroupMembershipStatusAdditionSuccess PermissionGroupMembershipStatus = "ADDITION_SUCCESS" + PermissionGroupMembershipStatusRemovalInProgress PermissionGroupMembershipStatus = "REMOVAL_IN_PROGRESS" +) + +// Values returns all known values for PermissionGroupMembershipStatus. 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 (PermissionGroupMembershipStatus) Values() []PermissionGroupMembershipStatus { + return []PermissionGroupMembershipStatus{ + "ADDITION_IN_PROGRESS", + "ADDITION_SUCCESS", + "REMOVAL_IN_PROGRESS", + } +} + type UserStatus string // Enum values for UserStatus diff --git a/service/finspacedata/types/types.go b/service/finspacedata/types/types.go index aa429abd09b..64e75449661 100644 --- a/service/finspacedata/types/types.go +++ b/service/finspacedata/types/types.go @@ -226,7 +226,7 @@ type DataViewDestinationTypeParams struct { // This member is required. DestinationType *string - // Data view export file format. + // Dataview export file format. // // * PARQUET – Parquet export file format. // @@ -385,6 +385,44 @@ type PermissionGroup struct { // determined as epoch time in milliseconds. LastModifiedTime int64 + // Indicates the status of the user account within a permission group. + // + // * + // ADDITION_IN_PROGRESS – The user account is currently being added to the + // permission group. + // + // * ADDITION_SUCCESS – The user account is successfully added + // to the permission group. + // + // * REMOVAL_IN_PROGRESS – The user is currently being + // removed from the permission group. + MembershipStatus PermissionGroupMembershipStatus + + // The name of the permission group. + Name *string + + // The unique identifier for the permission group. + PermissionGroupId *string + + noSmithyDocumentSerde +} + +// The structure of a permission group associated with a user account. +type PermissionGroupByUser struct { + + // Indicates the status of the user account within a permission group. + // + // * + // ADDITION_IN_PROGRESS – The user account is currently being added to the + // permission group. + // + // * ADDITION_SUCCESS – The user account is successfully added + // to the permission group. + // + // * REMOVAL_IN_PROGRESS – The user is currently being + // removed from the permission group. + MembershipStatus PermissionGroupMembershipStatus + // The name of the permission group. Name *string @@ -528,7 +566,72 @@ type User struct { // // * APP_USER – A user with specific // permissions in FinSpace. The users are assigned permissions by adding them to a - // permissions group. + // permission group. + Type UserType + + // The unique identifier for the user. + UserId *string + + noSmithyDocumentSerde +} + +// The structure of a user account associated with a permission group. +type UserByPermissionGroup struct { + + // Indicates whether the user can access FinSpace API operations. + // + // * ENABLED – The + // user has permissions to use the API operations. + // + // * DISABLED – The user does not + // have permissions to use any API operations. + ApiAccess ApiAccess + + // The IAM ARN identifier that is attached to FinSpace API calls. + ApiAccessPrincipalArn *string + + // The email address of the user. The email address serves as a unique identifier + // for each user and cannot be changed after it's created. + EmailAddress *string + + // The first name of the user. + FirstName *string + + // The last name of the user. + LastName *string + + // Indicates the status of the user account within a permission group. + // + // * + // ADDITION_IN_PROGRESS – The user account is currently being added to the + // permission group. + // + // * ADDITION_SUCCESS – The user account is successfully added + // to the permission group. + // + // * REMOVAL_IN_PROGRESS – The user is currently being + // removed from the permission group. + MembershipStatus PermissionGroupMembershipStatus + + // The current status of the user account. + // + // * CREATING – The user account creation + // is in progress. + // + // * ENABLED – The user account is created and is currently + // active. + // + // * DISABLED – The user account is currently inactive. + Status UserStatus + + // Indicates the type of user. + // + // * SUPER_USER – A user with permission to all the + // functionality and data in FinSpace. + // + // * APP_USER – A user with specific + // permissions in FinSpace. The users are assigned permissions by adding them to a + // permission group. Type UserType // The unique identifier for the user. diff --git a/service/finspacedata/validators.go b/service/finspacedata/validators.go index 875b43c815e..ee1ccb3db79 100644 --- a/service/finspacedata/validators.go +++ b/service/finspacedata/validators.go @@ -10,6 +10,26 @@ import ( "github.com/aws/smithy-go/middleware" ) +type validateOpAssociateUserToPermissionGroup struct { +} + +func (*validateOpAssociateUserToPermissionGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpAssociateUserToPermissionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*AssociateUserToPermissionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpAssociateUserToPermissionGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpCreateChangeset struct { } @@ -170,6 +190,26 @@ func (m *validateOpDisableUser) HandleInitialize(ctx context.Context, in middlew return next.HandleInitialize(ctx, in) } +type validateOpDisassociateUserFromPermissionGroup struct { +} + +func (*validateOpDisassociateUserFromPermissionGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisassociateUserFromPermissionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisassociateUserFromPermissionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisassociateUserFromPermissionGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpEnableUser struct { } @@ -250,6 +290,26 @@ func (m *validateOpGetDataView) HandleInitialize(ctx context.Context, in middlew return next.HandleInitialize(ctx, in) } +type validateOpGetPermissionGroup struct { +} + +func (*validateOpGetPermissionGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetPermissionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetPermissionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetPermissionGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetProgrammaticAccessCredentials struct { } @@ -330,6 +390,26 @@ func (m *validateOpListDataViews) HandleInitialize(ctx context.Context, in middl return next.HandleInitialize(ctx, in) } +type validateOpListPermissionGroupsByUser struct { +} + +func (*validateOpListPermissionGroupsByUser) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListPermissionGroupsByUser) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListPermissionGroupsByUserInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListPermissionGroupsByUserInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpListPermissionGroups struct { } @@ -350,6 +430,26 @@ func (m *validateOpListPermissionGroups) HandleInitialize(ctx context.Context, i return next.HandleInitialize(ctx, in) } +type validateOpListUsersByPermissionGroup struct { +} + +func (*validateOpListUsersByPermissionGroup) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListUsersByPermissionGroup) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListUsersByPermissionGroupInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListUsersByPermissionGroupInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpListUsers struct { } @@ -470,6 +570,10 @@ func (m *validateOpUpdateUser) HandleInitialize(ctx context.Context, in middlewa return next.HandleInitialize(ctx, in) } +func addOpAssociateUserToPermissionGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpAssociateUserToPermissionGroup{}, middleware.After) +} + func addOpCreateChangesetValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpCreateChangeset{}, middleware.After) } @@ -502,6 +606,10 @@ func addOpDisableUserValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDisableUser{}, middleware.After) } +func addOpDisassociateUserFromPermissionGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisassociateUserFromPermissionGroup{}, middleware.After) +} + func addOpEnableUserValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpEnableUser{}, middleware.After) } @@ -518,6 +626,10 @@ func addOpGetDataViewValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetDataView{}, middleware.After) } +func addOpGetPermissionGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetPermissionGroup{}, middleware.After) +} + func addOpGetProgrammaticAccessCredentialsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetProgrammaticAccessCredentials{}, middleware.After) } @@ -534,10 +646,18 @@ func addOpListDataViewsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListDataViews{}, middleware.After) } +func addOpListPermissionGroupsByUserValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListPermissionGroupsByUser{}, middleware.After) +} + func addOpListPermissionGroupsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListPermissionGroups{}, middleware.After) } +func addOpListUsersByPermissionGroupValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListUsersByPermissionGroup{}, middleware.After) +} + func addOpListUsersValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListUsers{}, middleware.After) } @@ -577,6 +697,24 @@ func validateDataViewDestinationTypeParams(v *types.DataViewDestinationTypeParam } } +func validateOpAssociateUserToPermissionGroupInput(v *AssociateUserToPermissionGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AssociateUserToPermissionGroupInput"} + if v.PermissionGroupId == nil { + invalidParams.Add(smithy.NewErrParamRequired("PermissionGroupId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpCreateChangesetInput(v *CreateChangesetInput) error { if v == nil { return nil @@ -725,6 +863,24 @@ func validateOpDisableUserInput(v *DisableUserInput) error { } } +func validateOpDisassociateUserFromPermissionGroupInput(v *DisassociateUserFromPermissionGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisassociateUserFromPermissionGroupInput"} + if v.PermissionGroupId == nil { + invalidParams.Add(smithy.NewErrParamRequired("PermissionGroupId")) + } + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpEnableUserInput(v *EnableUserInput) error { if v == nil { return nil @@ -791,6 +947,21 @@ func validateOpGetDataViewInput(v *GetDataViewInput) error { } } +func validateOpGetPermissionGroupInput(v *GetPermissionGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetPermissionGroupInput"} + if v.PermissionGroupId == nil { + invalidParams.Add(smithy.NewErrParamRequired("PermissionGroupId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetProgrammaticAccessCredentialsInput(v *GetProgrammaticAccessCredentialsInput) error { if v == nil { return nil @@ -851,6 +1022,21 @@ func validateOpListDataViewsInput(v *ListDataViewsInput) error { } } +func validateOpListPermissionGroupsByUserInput(v *ListPermissionGroupsByUserInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListPermissionGroupsByUserInput"} + if v.UserId == nil { + invalidParams.Add(smithy.NewErrParamRequired("UserId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpListPermissionGroupsInput(v *ListPermissionGroupsInput) error { if v == nil { return nil @@ -863,6 +1049,21 @@ func validateOpListPermissionGroupsInput(v *ListPermissionGroupsInput) error { } } +func validateOpListUsersByPermissionGroupInput(v *ListUsersByPermissionGroupInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListUsersByPermissionGroupInput"} + if v.PermissionGroupId == nil { + invalidParams.Add(smithy.NewErrParamRequired("PermissionGroupId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpListUsersInput(v *ListUsersInput) error { if v == nil { return nil diff --git a/service/guardduty/api_op_AcceptAdministratorInvitation.go b/service/guardduty/api_op_AcceptAdministratorInvitation.go new file mode 100644 index 00000000000..02a9d9bd7fb --- /dev/null +++ b/service/guardduty/api_op_AcceptAdministratorInvitation.go @@ -0,0 +1,129 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package guardduty + +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" +) + +// Accepts the invitation to be a member account and get monitored by a GuardDuty +// administrator account that sent the invitation. +func (c *Client) AcceptAdministratorInvitation(ctx context.Context, params *AcceptAdministratorInvitationInput, optFns ...func(*Options)) (*AcceptAdministratorInvitationOutput, error) { + if params == nil { + params = &AcceptAdministratorInvitationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "AcceptAdministratorInvitation", params, optFns, c.addOperationAcceptAdministratorInvitationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*AcceptAdministratorInvitationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type AcceptAdministratorInvitationInput struct { + + // The account ID of the GuardDuty administrator account whose invitation you're + // accepting. + // + // This member is required. + AdministratorId *string + + // The unique ID of the detector of the GuardDuty member account. + // + // This member is required. + DetectorId *string + + // The value that is used to validate the administrator account to the member + // account. + // + // This member is required. + InvitationId *string + + noSmithyDocumentSerde +} + +type AcceptAdministratorInvitationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationAcceptAdministratorInvitationMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpAcceptAdministratorInvitation{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpAcceptAdministratorInvitation{}, 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 = addOpAcceptAdministratorInvitationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAcceptAdministratorInvitation(options.Region), middleware.Before); 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_opAcceptAdministratorInvitation(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "guardduty", + OperationName: "AcceptAdministratorInvitation", + } +} diff --git a/service/guardduty/api_op_AcceptInvitation.go b/service/guardduty/api_op_AcceptInvitation.go index 7479629dd98..21a9fc127c0 100644 --- a/service/guardduty/api_op_AcceptInvitation.go +++ b/service/guardduty/api_op_AcceptInvitation.go @@ -11,6 +11,9 @@ import ( ) // Accepts the invitation to be monitored by a GuardDuty administrator account. +// +// Deprecated: This operation is deprecated, use AcceptAdministratorInvitation +// instead func (c *Client) AcceptInvitation(ctx context.Context, params *AcceptInvitationInput, optFns ...func(*Options)) (*AcceptInvitationOutput, error) { if params == nil { params = &AcceptInvitationInput{} diff --git a/service/guardduty/api_op_DisassociateFromAdministratorAccount.go b/service/guardduty/api_op_DisassociateFromAdministratorAccount.go new file mode 100644 index 00000000000..e38c21c758d --- /dev/null +++ b/service/guardduty/api_op_DisassociateFromAdministratorAccount.go @@ -0,0 +1,117 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package guardduty + +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" +) + +// Disassociates the current GuardDuty member account from its administrator +// account. +func (c *Client) DisassociateFromAdministratorAccount(ctx context.Context, params *DisassociateFromAdministratorAccountInput, optFns ...func(*Options)) (*DisassociateFromAdministratorAccountOutput, error) { + if params == nil { + params = &DisassociateFromAdministratorAccountInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisassociateFromAdministratorAccount", params, optFns, c.addOperationDisassociateFromAdministratorAccountMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisassociateFromAdministratorAccountOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisassociateFromAdministratorAccountInput struct { + + // The unique ID of the detector of the GuardDuty member account. + // + // This member is required. + DetectorId *string + + noSmithyDocumentSerde +} + +type DisassociateFromAdministratorAccountOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisassociateFromAdministratorAccountMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisassociateFromAdministratorAccount{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisassociateFromAdministratorAccount{}, 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 = addOpDisassociateFromAdministratorAccountValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisassociateFromAdministratorAccount(options.Region), middleware.Before); 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_opDisassociateFromAdministratorAccount(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "guardduty", + OperationName: "DisassociateFromAdministratorAccount", + } +} diff --git a/service/guardduty/api_op_DisassociateFromMasterAccount.go b/service/guardduty/api_op_DisassociateFromMasterAccount.go index 936761b1eb3..4a75a6e9958 100644 --- a/service/guardduty/api_op_DisassociateFromMasterAccount.go +++ b/service/guardduty/api_op_DisassociateFromMasterAccount.go @@ -12,6 +12,9 @@ import ( // Disassociates the current GuardDuty member account from its administrator // account. +// +// Deprecated: This operation is deprecated, use +// DisassociateFromAdministratorAccount instead func (c *Client) DisassociateFromMasterAccount(ctx context.Context, params *DisassociateFromMasterAccountInput, optFns ...func(*Options)) (*DisassociateFromMasterAccountOutput, error) { if params == nil { params = &DisassociateFromMasterAccountInput{} diff --git a/service/guardduty/api_op_DisassociateMembers.go b/service/guardduty/api_op_DisassociateMembers.go index bc32fa46875..8f735f8e288 100644 --- a/service/guardduty/api_op_DisassociateMembers.go +++ b/service/guardduty/api_op_DisassociateMembers.go @@ -12,10 +12,7 @@ import ( ) // Disassociates GuardDuty member accounts (to the current GuardDuty administrator -// account) specified by the account IDs. Member accounts added through Invitation -// (https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_invitations.html) get -// deleted from the current GuardDuty administrator account after 30 days of -// disassociation. +// account) specified by the account IDs. func (c *Client) DisassociateMembers(ctx context.Context, params *DisassociateMembersInput, optFns ...func(*Options)) (*DisassociateMembersOutput, error) { if params == nil { params = &DisassociateMembersInput{} diff --git a/service/guardduty/api_op_GetAdministratorAccount.go b/service/guardduty/api_op_GetAdministratorAccount.go new file mode 100644 index 00000000000..1553130e0d1 --- /dev/null +++ b/service/guardduty/api_op_GetAdministratorAccount.go @@ -0,0 +1,124 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package guardduty + +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/guardduty/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Provides the details for the GuardDuty administrator account associated with the +// current GuardDuty member account. +func (c *Client) GetAdministratorAccount(ctx context.Context, params *GetAdministratorAccountInput, optFns ...func(*Options)) (*GetAdministratorAccountOutput, error) { + if params == nil { + params = &GetAdministratorAccountInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetAdministratorAccount", params, optFns, c.addOperationGetAdministratorAccountMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetAdministratorAccountOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetAdministratorAccountInput struct { + + // The unique ID of the detector of the GuardDuty member account. + // + // This member is required. + DetectorId *string + + noSmithyDocumentSerde +} + +type GetAdministratorAccountOutput struct { + + // The administrator account details. + // + // This member is required. + Administrator *types.Administrator + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetAdministratorAccountMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetAdministratorAccount{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetAdministratorAccount{}, 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 = addOpGetAdministratorAccountValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAdministratorAccount(options.Region), middleware.Before); 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_opGetAdministratorAccount(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "guardduty", + OperationName: "GetAdministratorAccount", + } +} diff --git a/service/guardduty/api_op_GetMasterAccount.go b/service/guardduty/api_op_GetMasterAccount.go index 64f912920b5..205ae3e5af6 100644 --- a/service/guardduty/api_op_GetMasterAccount.go +++ b/service/guardduty/api_op_GetMasterAccount.go @@ -13,6 +13,8 @@ import ( // Provides the details for the GuardDuty administrator account associated with the // current GuardDuty member account. +// +// Deprecated: This operation is deprecated, use GetAdministratorAccount instead func (c *Client) GetMasterAccount(ctx context.Context, params *GetMasterAccountInput, optFns ...func(*Options)) (*GetMasterAccountOutput, error) { if params == nil { params = &GetMasterAccountInput{} diff --git a/service/guardduty/api_op_GetRemainingFreeTrialDays.go b/service/guardduty/api_op_GetRemainingFreeTrialDays.go new file mode 100644 index 00000000000..ba39a87c9d7 --- /dev/null +++ b/service/guardduty/api_op_GetRemainingFreeTrialDays.go @@ -0,0 +1,130 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package guardduty + +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/guardduty/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Provides the number of days left for each data source used in the free trial +// period. +func (c *Client) GetRemainingFreeTrialDays(ctx context.Context, params *GetRemainingFreeTrialDaysInput, optFns ...func(*Options)) (*GetRemainingFreeTrialDaysOutput, error) { + if params == nil { + params = &GetRemainingFreeTrialDaysInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetRemainingFreeTrialDays", params, optFns, c.addOperationGetRemainingFreeTrialDaysMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetRemainingFreeTrialDaysOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetRemainingFreeTrialDaysInput struct { + + // The unique ID of the detector of the GuardDuty member account. + // + // This member is required. + DetectorId *string + + // A list of account identifiers of the GuardDuty member account. + AccountIds []string + + noSmithyDocumentSerde +} + +type GetRemainingFreeTrialDaysOutput struct { + + // The member accounts which were included in a request and were processed + // successfully. + Accounts []types.AccountFreeTrialInfo + + // The member account that was included in a request but for which the request + // could not be processed. + UnprocessedAccounts []types.UnprocessedAccount + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetRemainingFreeTrialDaysMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRemainingFreeTrialDays{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRemainingFreeTrialDays{}, 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 = addOpGetRemainingFreeTrialDaysValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRemainingFreeTrialDays(options.Region), middleware.Before); 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_opGetRemainingFreeTrialDays(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "guardduty", + OperationName: "GetRemainingFreeTrialDays", + } +} diff --git a/service/guardduty/api_op_GetUsageStatistics.go b/service/guardduty/api_op_GetUsageStatistics.go index fce472aa19b..22ae3151290 100644 --- a/service/guardduty/api_op_GetUsageStatistics.go +++ b/service/guardduty/api_op_GetUsageStatistics.go @@ -13,10 +13,10 @@ import ( ) // Lists Amazon GuardDuty usage statistics over the last 30 days for the specified -// detector ID. For newly enabled detectors or data sources the cost returned will -// include only the usage so far under 30 days, this may differ from the cost -// metrics in the console, which projects usage over 30 days to provide a monthly -// cost estimate. For more information see Understanding How Usage Costs are +// detector ID. For newly enabled detectors or data sources, the cost returned will +// include only the usage so far under 30 days. This may differ from the cost +// metrics in the console, which project usage over 30 days to provide a monthly +// cost estimate. For more information, see Understanding How Usage Costs are // Calculated // (https://docs.aws.amazon.com/guardduty/latest/ug/monitoring_costs.html#usage-calculations). func (c *Client) GetUsageStatistics(ctx context.Context, params *GetUsageStatisticsInput, optFns ...func(*Options)) (*GetUsageStatisticsOutput, error) { diff --git a/service/guardduty/deserializers.go b/service/guardduty/deserializers.go index 4b89f3cf597..389dc48de97 100644 --- a/service/guardduty/deserializers.go +++ b/service/guardduty/deserializers.go @@ -20,6 +20,92 @@ import ( "strings" ) +type awsRestjson1_deserializeOpAcceptAdministratorInvitation struct { +} + +func (*awsRestjson1_deserializeOpAcceptAdministratorInvitation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpAcceptAdministratorInvitation) 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_deserializeOpErrorAcceptAdministratorInvitation(response, &metadata) + } + output := &AcceptAdministratorInvitationOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorAcceptAdministratorInvitation(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("InternalServerErrorException", errorCode): + return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsRestjson1_deserializeOpAcceptInvitation struct { } @@ -2522,6 +2608,92 @@ func awsRestjson1_deserializeOpErrorDisableOrganizationAdminAccount(response *sm } } +type awsRestjson1_deserializeOpDisassociateFromAdministratorAccount struct { +} + +func (*awsRestjson1_deserializeOpDisassociateFromAdministratorAccount) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisassociateFromAdministratorAccount) 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_deserializeOpErrorDisassociateFromAdministratorAccount(response, &metadata) + } + output := &DisassociateFromAdministratorAccountOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDisassociateFromAdministratorAccount(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("InternalServerErrorException", errorCode): + return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsRestjson1_deserializeOpDisassociateFromMasterAccount struct { } @@ -2844,6 +3016,156 @@ func awsRestjson1_deserializeOpErrorEnableOrganizationAdminAccount(response *smi } } +type awsRestjson1_deserializeOpGetAdministratorAccount struct { +} + +func (*awsRestjson1_deserializeOpGetAdministratorAccount) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAdministratorAccount) 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_deserializeOpErrorGetAdministratorAccount(response, &metadata) + } + output := &GetAdministratorAccountOutput{} + 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_deserializeOpDocumentGetAdministratorAccountOutput(&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_deserializeOpErrorGetAdministratorAccount(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("InternalServerErrorException", errorCode): + return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetAdministratorAccountOutput(v **GetAdministratorAccountOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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 *GetAdministratorAccountOutput + if *v == nil { + sv = &GetAdministratorAccountOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "administrator": + if err := awsRestjson1_deserializeDocumentAdministrator(&sv.Administrator, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpGetDetector struct { } @@ -3833,44 +4155,194 @@ func awsRestjson1_deserializeOpDocumentGetIPSetOutput(v **GetIPSetOutput, value for key, value := range shape { switch key { - case "format": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected IpSetFormat to be of type string, got %T instead", value) - } - sv.Format = types.IpSetFormat(jtv) - } - - case "location": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Location to be of type string, got %T instead", value) - } - sv.Location = ptr.String(jtv) - } - - case "name": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected Name to be of type string, got %T instead", value) - } - sv.Name = ptr.String(jtv) - } - - case "status": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected IpSetStatus to be of type string, got %T instead", value) - } - sv.Status = types.IpSetStatus(jtv) - } - - case "tags": - if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { + case "format": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IpSetFormat to be of type string, got %T instead", value) + } + sv.Format = types.IpSetFormat(jtv) + } + + case "location": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Location to be of type string, got %T instead", value) + } + sv.Location = ptr.String(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IpSetStatus to be of type string, got %T instead", value) + } + sv.Status = types.IpSetStatus(jtv) + } + + case "tags": + if err := awsRestjson1_deserializeDocumentTagMap(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetMasterAccount struct { +} + +func (*awsRestjson1_deserializeOpGetMasterAccount) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetMasterAccount) 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_deserializeOpErrorGetMasterAccount(response, &metadata) + } + output := &GetMasterAccountOutput{} + 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_deserializeOpDocumentGetMasterAccountOutput(&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_deserializeOpErrorGetMasterAccount(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("InternalServerErrorException", errorCode): + return awsRestjson1_deserializeErrorInternalServerErrorException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetMasterAccountOutput(v **GetMasterAccountOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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 *GetMasterAccountOutput + if *v == nil { + sv = &GetMasterAccountOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "master": + if err := awsRestjson1_deserializeDocumentMaster(&sv.Master, value); err != nil { return err } @@ -3883,14 +4355,14 @@ func awsRestjson1_deserializeOpDocumentGetIPSetOutput(v **GetIPSetOutput, value return nil } -type awsRestjson1_deserializeOpGetMasterAccount struct { +type awsRestjson1_deserializeOpGetMemberDetectors struct { } -func (*awsRestjson1_deserializeOpGetMasterAccount) ID() string { +func (*awsRestjson1_deserializeOpGetMemberDetectors) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetMasterAccount) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetMemberDetectors) 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) @@ -3904,9 +4376,9 @@ func (m *awsRestjson1_deserializeOpGetMasterAccount) HandleDeserialize(ctx conte } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetMasterAccount(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetMemberDetectors(response, &metadata) } - output := &GetMasterAccountOutput{} + output := &GetMemberDetectorsOutput{} out.Result = output var buff [1024]byte @@ -3927,7 +4399,7 @@ func (m *awsRestjson1_deserializeOpGetMasterAccount) HandleDeserialize(ctx conte return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetMasterAccountOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetMemberDetectorsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -3940,7 +4412,7 @@ func (m *awsRestjson1_deserializeOpGetMasterAccount) HandleDeserialize(ctx conte return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetMasterAccount(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetMemberDetectors(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)} @@ -3997,7 +4469,7 @@ func awsRestjson1_deserializeOpErrorGetMasterAccount(response *smithyhttp.Respon } } -func awsRestjson1_deserializeOpDocumentGetMasterAccountOutput(v **GetMasterAccountOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentGetMemberDetectorsOutput(v **GetMemberDetectorsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -4010,17 +4482,22 @@ func awsRestjson1_deserializeOpDocumentGetMasterAccountOutput(v **GetMasterAccou return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetMasterAccountOutput + var sv *GetMemberDetectorsOutput if *v == nil { - sv = &GetMasterAccountOutput{} + sv = &GetMemberDetectorsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "master": - if err := awsRestjson1_deserializeDocumentMaster(&sv.Master, value); err != nil { + case "members": + if err := awsRestjson1_deserializeDocumentMemberDataSourceConfigurations(&sv.MemberDataSourceConfigurations, value); err != nil { + return err + } + + case "unprocessedAccounts": + if err := awsRestjson1_deserializeDocumentUnprocessedAccounts(&sv.UnprocessedAccounts, value); err != nil { return err } @@ -4033,14 +4510,14 @@ func awsRestjson1_deserializeOpDocumentGetMasterAccountOutput(v **GetMasterAccou return nil } -type awsRestjson1_deserializeOpGetMemberDetectors struct { +type awsRestjson1_deserializeOpGetMembers struct { } -func (*awsRestjson1_deserializeOpGetMemberDetectors) ID() string { +func (*awsRestjson1_deserializeOpGetMembers) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetMemberDetectors) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetMembers) 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) @@ -4054,9 +4531,9 @@ func (m *awsRestjson1_deserializeOpGetMemberDetectors) HandleDeserialize(ctx con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetMemberDetectors(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetMembers(response, &metadata) } - output := &GetMemberDetectorsOutput{} + output := &GetMembersOutput{} out.Result = output var buff [1024]byte @@ -4077,7 +4554,7 @@ func (m *awsRestjson1_deserializeOpGetMemberDetectors) HandleDeserialize(ctx con return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetMemberDetectorsOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetMembersOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -4090,7 +4567,7 @@ func (m *awsRestjson1_deserializeOpGetMemberDetectors) HandleDeserialize(ctx con return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetMemberDetectors(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetMembers(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)} @@ -4147,7 +4624,7 @@ func awsRestjson1_deserializeOpErrorGetMemberDetectors(response *smithyhttp.Resp } } -func awsRestjson1_deserializeOpDocumentGetMemberDetectorsOutput(v **GetMemberDetectorsOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentGetMembersOutput(v **GetMembersOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -4160,9 +4637,9 @@ func awsRestjson1_deserializeOpDocumentGetMemberDetectorsOutput(v **GetMemberDet return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetMemberDetectorsOutput + var sv *GetMembersOutput if *v == nil { - sv = &GetMemberDetectorsOutput{} + sv = &GetMembersOutput{} } else { sv = *v } @@ -4170,7 +4647,7 @@ func awsRestjson1_deserializeOpDocumentGetMemberDetectorsOutput(v **GetMemberDet for key, value := range shape { switch key { case "members": - if err := awsRestjson1_deserializeDocumentMemberDataSourceConfigurations(&sv.MemberDataSourceConfigurations, value); err != nil { + if err := awsRestjson1_deserializeDocumentMembers(&sv.Members, value); err != nil { return err } @@ -4188,14 +4665,14 @@ func awsRestjson1_deserializeOpDocumentGetMemberDetectorsOutput(v **GetMemberDet return nil } -type awsRestjson1_deserializeOpGetMembers struct { +type awsRestjson1_deserializeOpGetRemainingFreeTrialDays struct { } -func (*awsRestjson1_deserializeOpGetMembers) ID() string { +func (*awsRestjson1_deserializeOpGetRemainingFreeTrialDays) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetMembers) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetRemainingFreeTrialDays) 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) @@ -4209,9 +4686,9 @@ func (m *awsRestjson1_deserializeOpGetMembers) HandleDeserialize(ctx context.Con } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetMembers(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetRemainingFreeTrialDays(response, &metadata) } - output := &GetMembersOutput{} + output := &GetRemainingFreeTrialDaysOutput{} out.Result = output var buff [1024]byte @@ -4232,7 +4709,7 @@ func (m *awsRestjson1_deserializeOpGetMembers) HandleDeserialize(ctx context.Con return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetMembersOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetRemainingFreeTrialDaysOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -4245,7 +4722,7 @@ func (m *awsRestjson1_deserializeOpGetMembers) HandleDeserialize(ctx context.Con return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetMembers(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetRemainingFreeTrialDays(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)} @@ -4302,7 +4779,7 @@ func awsRestjson1_deserializeOpErrorGetMembers(response *smithyhttp.Response, me } } -func awsRestjson1_deserializeOpDocumentGetMembersOutput(v **GetMembersOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentGetRemainingFreeTrialDaysOutput(v **GetRemainingFreeTrialDaysOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -4315,17 +4792,17 @@ func awsRestjson1_deserializeOpDocumentGetMembersOutput(v **GetMembersOutput, va return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetMembersOutput + var sv *GetRemainingFreeTrialDaysOutput if *v == nil { - sv = &GetMembersOutput{} + sv = &GetRemainingFreeTrialDaysOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "members": - if err := awsRestjson1_deserializeDocumentMembers(&sv.Members, value); err != nil { + case "accounts": + if err := awsRestjson1_deserializeDocumentAccountFreeTrialInfos(&sv.Accounts, value); err != nil { return err } @@ -7985,6 +8462,85 @@ func awsRestjson1_deserializeDocumentAccessKeyDetails(v **types.AccessKeyDetails return nil } +func awsRestjson1_deserializeDocumentAccountFreeTrialInfo(v **types.AccountFreeTrialInfo, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.AccountFreeTrialInfo + if *v == nil { + sv = &types.AccountFreeTrialInfo{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "accountId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AccountId = ptr.String(jtv) + } + + case "dataSources": + if err := awsRestjson1_deserializeDocumentDataSourcesFreeTrial(&sv.DataSources, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAccountFreeTrialInfos(v *[]types.AccountFreeTrialInfo, 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.AccountFreeTrialInfo + if *v == nil { + cv = []types.AccountFreeTrialInfo{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AccountFreeTrialInfo + destAddr := &col + if err := awsRestjson1_deserializeDocumentAccountFreeTrialInfo(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentAccountLevelPermissions(v **types.AccountLevelPermissions, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -8082,11 +8638,94 @@ func awsRestjson1_deserializeDocumentAction(v **types.Action, value interface{}) } } - *v = sv + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAdminAccount(v **types.AdminAccount, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.AdminAccount + if *v == nil { + sv = &types.AdminAccount{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "adminAccountId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AdminAccountId = ptr.String(jtv) + } + + case "adminStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AdminStatus to be of type string, got %T instead", value) + } + sv.AdminStatus = types.AdminStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAdminAccounts(v *[]types.AdminAccount, 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.AdminAccount + if *v == nil { + cv = []types.AdminAccount{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AdminAccount + destAddr := &col + if err := awsRestjson1_deserializeDocumentAdminAccount(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv return nil } -func awsRestjson1_deserializeDocumentAdminAccount(v **types.AdminAccount, value interface{}) error { +func awsRestjson1_deserializeDocumentAdministrator(v **types.Administrator, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -8099,31 +8738,49 @@ func awsRestjson1_deserializeDocumentAdminAccount(v **types.AdminAccount, value return fmt.Errorf("unexpected JSON type %v", value) } - var sv *types.AdminAccount + var sv *types.Administrator if *v == nil { - sv = &types.AdminAccount{} + sv = &types.Administrator{} } else { sv = *v } for key, value := range shape { switch key { - case "adminAccountId": + case "accountId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) + } + sv.AccountId = ptr.String(jtv) + } + + case "invitationId": if value != nil { jtv, ok := value.(string) if !ok { return fmt.Errorf("expected String to be of type string, got %T instead", value) } - sv.AdminAccountId = ptr.String(jtv) + sv.InvitationId = ptr.String(jtv) } - case "adminStatus": + case "invitedAt": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected AdminStatus to be of type string, got %T instead", value) + return fmt.Errorf("expected String to be of type string, got %T instead", value) } - sv.AdminStatus = types.AdminStatus(jtv) + sv.InvitedAt = ptr.String(jtv) + } + + case "relationshipStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.RelationshipStatus = ptr.String(jtv) } default: @@ -8135,7 +8792,7 @@ func awsRestjson1_deserializeDocumentAdminAccount(v **types.AdminAccount, value return nil } -func awsRestjson1_deserializeDocumentAdminAccounts(v *[]types.AdminAccount, value interface{}) error { +func awsRestjson1_deserializeDocumentAffectedResources(v *map[string]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -8143,29 +8800,31 @@ func awsRestjson1_deserializeDocumentAdminAccounts(v *[]types.AdminAccount, valu return nil } - shape, ok := value.([]interface{}) + shape, ok := value.(map[string]interface{}) if !ok { return fmt.Errorf("unexpected JSON type %v", value) } - var cv []types.AdminAccount + var mv map[string]string if *v == nil { - cv = []types.AdminAccount{} + mv = map[string]string{} } else { - cv = *v + mv = *v } - for _, value := range shape { - var col types.AdminAccount - destAddr := &col - if err := awsRestjson1_deserializeDocumentAdminAccount(&destAddr, value); err != nil { - return err + for key, value := range shape { + var parsedVal string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + parsedVal = jtv } - col = *destAddr - cv = append(cv, col) + mv[key] = parsedVal } - *v = cv + *v = mv return nil } @@ -8191,6 +8850,11 @@ func awsRestjson1_deserializeDocumentAwsApiCallAction(v **types.AwsApiCallAction for key, value := range shape { switch key { + case "affectedResources": + if err := awsRestjson1_deserializeDocumentAffectedResources(&sv.AffectedResources, value); err != nil { + return err + } + case "api": if value != nil { jtv, ok := value.(string) @@ -9006,6 +9670,106 @@ func awsRestjson1_deserializeDocumentDataSourceConfigurationsResult(v **types.Da return nil } +func awsRestjson1_deserializeDocumentDataSourceFreeTrial(v **types.DataSourceFreeTrial, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.DataSourceFreeTrial + if *v == nil { + sv = &types.DataSourceFreeTrial{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "freeTrialDaysRemaining": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Integer to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.FreeTrialDaysRemaining = int32(i64) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDataSourcesFreeTrial(v **types.DataSourcesFreeTrial, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.DataSourcesFreeTrial + if *v == nil { + sv = &types.DataSourcesFreeTrial{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "cloudTrail": + if err := awsRestjson1_deserializeDocumentDataSourceFreeTrial(&sv.CloudTrail, value); err != nil { + return err + } + + case "dnsLogs": + if err := awsRestjson1_deserializeDocumentDataSourceFreeTrial(&sv.DnsLogs, value); err != nil { + return err + } + + case "flowLogs": + if err := awsRestjson1_deserializeDocumentDataSourceFreeTrial(&sv.FlowLogs, value); err != nil { + return err + } + + case "kubernetes": + if err := awsRestjson1_deserializeDocumentKubernetesDataSourceFreeTrial(&sv.Kubernetes, value); err != nil { + return err + } + + case "s3Logs": + if err := awsRestjson1_deserializeDocumentDataSourceFreeTrial(&sv.S3Logs, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentDefaultServerSideEncryption(v **types.DefaultServerSideEncryption, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -9294,6 +10058,15 @@ func awsRestjson1_deserializeDocumentDnsRequestAction(v **types.DnsRequestAction for key, value := range shape { switch key { + case "blocked": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Blocked = jtv + } + case "domain": if value != nil { jtv, ok := value.(string) @@ -9303,6 +10076,15 @@ func awsRestjson1_deserializeDocumentDnsRequestAction(v **types.DnsRequestAction sv.Domain = ptr.String(jtv) } + case "protocol": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Protocol = ptr.String(jtv) + } + default: _, _ = key, value @@ -10718,6 +11500,42 @@ func awsRestjson1_deserializeDocumentKubernetesConfigurationResult(v **types.Kub return nil } +func awsRestjson1_deserializeDocumentKubernetesDataSourceFreeTrial(v **types.KubernetesDataSourceFreeTrial, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.KubernetesDataSourceFreeTrial + if *v == nil { + sv = &types.KubernetesDataSourceFreeTrial{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "auditLogs": + if err := awsRestjson1_deserializeDocumentDataSourceFreeTrial(&sv.AuditLogs, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentKubernetesDetails(v **types.KubernetesDetails, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -11090,6 +11908,15 @@ func awsRestjson1_deserializeDocumentMember(v **types.Member, value interface{}) sv.AccountId = ptr.String(jtv) } + case "administratorId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AdministratorId = ptr.String(jtv) + } + case "detectorId": if value != nil { jtv, ok := value.(string) @@ -12094,7 +12921,7 @@ func awsRestjson1_deserializeDocumentProductCode(v **types.ProductCode, value in for key, value := range shape { switch key { - case "code": + case "productCodeId": if value != nil { jtv, ok := value.(string) if !ok { @@ -12103,7 +12930,7 @@ func awsRestjson1_deserializeDocumentProductCode(v **types.ProductCode, value in sv.Code = ptr.String(jtv) } - case "productType": + case "productCodeType": if value != nil { jtv, ok := value.(string) if !ok { @@ -12745,6 +13572,11 @@ func awsRestjson1_deserializeDocumentService(v **types.Service, value interface{ return err } + case "additionalInfo": + if err := awsRestjson1_deserializeDocumentServiceAdditionalInfo(&sv.AdditionalInfo, value); err != nil { + return err + } + case "archived": if value != nil { jtv, ok := value.(bool) @@ -12835,6 +13667,55 @@ func awsRestjson1_deserializeDocumentService(v **types.Service, value interface{ return nil } +func awsRestjson1_deserializeDocumentServiceAdditionalInfo(v **types.ServiceAdditionalInfo, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.ServiceAdditionalInfo + if *v == nil { + sv = &types.ServiceAdditionalInfo{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + 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) + } + + case "value": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Value = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentSourceIps(v *[]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/guardduty/doc.go b/service/guardduty/doc.go index 363ad87c436..749a745dfd3 100644 --- a/service/guardduty/doc.go +++ b/service/guardduty/doc.go @@ -4,20 +4,20 @@ // Amazon GuardDuty. // // Amazon GuardDuty is a continuous security monitoring service that analyzes and -// processes the following data sources: VPC Flow Logs, Amazon Web Services -// CloudTrail event logs, and DNS logs. It uses threat intelligence feeds (such as -// lists of malicious IPs and domains) and machine learning to identify unexpected, -// potentially unauthorized, and malicious activity within your Amazon Web Services -// environment. This can include issues like escalations of privileges, uses of -// exposed credentials, or communication with malicious IPs, URLs, or domains. For -// example, GuardDuty can detect compromised EC2 instances that serve malware or -// mine bitcoin. GuardDuty also monitors Amazon Web Services account access -// behavior for signs of compromise. Some examples of this are unauthorized -// infrastructure deployments such as EC2 instances deployed in a Region that has -// never been used, or unusual API calls like a password policy change to reduce -// password strength. GuardDuty informs you of the status of your Amazon Web -// Services environment by producing security findings that you can view in the -// GuardDuty console or through Amazon CloudWatch events. For more information, see -// the Amazon GuardDuty User Guide +// processes the following data sources: VPC Flow Logs, AWS CloudTrail management +// event logs, CloudTrail S3 data event logs, EKS audit logs, and DNS logs. It uses +// threat intelligence feeds (such as lists of malicious IPs and domains) and +// machine learning to identify unexpected, potentially unauthorized, and malicious +// activity within your Amazon Web Services environment. This can include issues +// like escalations of privileges, uses of exposed credentials, or communication +// with malicious IPs, URLs, or domains. For example, GuardDuty can detect +// compromised EC2 instances that serve malware or mine bitcoin. GuardDuty also +// monitors Amazon Web Services account access behavior for signs of compromise. +// Some examples of this are unauthorized infrastructure deployments such as EC2 +// instances deployed in a Region that has never been used, or unusual API calls +// like a password policy change to reduce password strength. GuardDuty informs you +// of the status of your Amazon Web Services environment by producing security +// findings that you can view in the GuardDuty console or through Amazon CloudWatch +// events. For more information, see the Amazon GuardDuty User Guide // (https://docs.aws.amazon.com/guardduty/latest/ug/what-is-guardduty.html) . package guardduty diff --git a/service/guardduty/generated.json b/service/guardduty/generated.json index 3f5abb7bee0..7893d146eee 100644 --- a/service/guardduty/generated.json +++ b/service/guardduty/generated.json @@ -8,6 +8,7 @@ "files": [ "api_client.go", "api_client_test.go", + "api_op_AcceptAdministratorInvitation.go", "api_op_AcceptInvitation.go", "api_op_ArchiveFindings.go", "api_op_CreateDetector.go", @@ -28,9 +29,11 @@ "api_op_DescribeOrganizationConfiguration.go", "api_op_DescribePublishingDestination.go", "api_op_DisableOrganizationAdminAccount.go", + "api_op_DisassociateFromAdministratorAccount.go", "api_op_DisassociateFromMasterAccount.go", "api_op_DisassociateMembers.go", "api_op_EnableOrganizationAdminAccount.go", + "api_op_GetAdministratorAccount.go", "api_op_GetDetector.go", "api_op_GetFilter.go", "api_op_GetFindings.go", @@ -40,6 +43,7 @@ "api_op_GetMasterAccount.go", "api_op_GetMemberDetectors.go", "api_op_GetMembers.go", + "api_op_GetRemainingFreeTrialDays.go", "api_op_GetThreatIntelSet.go", "api_op_GetUsageStatistics.go", "api_op_InviteMembers.go", diff --git a/service/guardduty/serializers.go b/service/guardduty/serializers.go index a0243dafcef..eb8c33f373a 100644 --- a/service/guardduty/serializers.go +++ b/service/guardduty/serializers.go @@ -14,6 +14,92 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) +type awsRestjson1_serializeOpAcceptAdministratorInvitation struct { +} + +func (*awsRestjson1_serializeOpAcceptAdministratorInvitation) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpAcceptAdministratorInvitation) 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.(*AcceptAdministratorInvitationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/detector/{DetectorId}/administrator") + 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_serializeOpHttpBindingsAcceptAdministratorInvitationInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentAcceptAdministratorInvitationInput(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_serializeOpHttpBindingsAcceptAdministratorInvitationInput(v *AcceptAdministratorInvitationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DetectorId == nil || len(*v.DetectorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DetectorId must not be empty")} + } + if v.DetectorId != nil { + if err := encoder.SetURI("DetectorId").String(*v.DetectorId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentAcceptAdministratorInvitationInput(v *AcceptAdministratorInvitationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AdministratorId != nil { + ok := object.Key("administratorId") + ok.String(*v.AdministratorId) + } + + if v.InvitationId != nil { + ok := object.Key("invitationId") + ok.String(*v.InvitationId) + } + + return nil +} + type awsRestjson1_serializeOpAcceptInvitation struct { } @@ -1607,6 +1693,64 @@ func awsRestjson1_serializeOpDocumentDisableOrganizationAdminAccountInput(v *Dis return nil } +type awsRestjson1_serializeOpDisassociateFromAdministratorAccount struct { +} + +func (*awsRestjson1_serializeOpDisassociateFromAdministratorAccount) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisassociateFromAdministratorAccount) 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.(*DisassociateFromAdministratorAccountInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/detector/{DetectorId}/administrator/disassociate") + 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_serializeOpHttpBindingsDisassociateFromAdministratorAccountInput(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_serializeOpHttpBindingsDisassociateFromAdministratorAccountInput(v *DisassociateFromAdministratorAccountInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DetectorId == nil || len(*v.DetectorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DetectorId must not be empty")} + } + if v.DetectorId != nil { + if err := encoder.SetURI("DetectorId").String(*v.DetectorId); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpDisassociateFromMasterAccount struct { } @@ -1816,6 +1960,64 @@ func awsRestjson1_serializeOpDocumentEnableOrganizationAdminAccountInput(v *Enab return nil } +type awsRestjson1_serializeOpGetAdministratorAccount struct { +} + +func (*awsRestjson1_serializeOpGetAdministratorAccount) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetAdministratorAccount) 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.(*GetAdministratorAccountInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/detector/{DetectorId}/administrator") + 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_serializeOpHttpBindingsGetAdministratorAccountInput(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_serializeOpHttpBindingsGetAdministratorAccountInput(v *GetAdministratorAccountInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DetectorId == nil || len(*v.DetectorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DetectorId must not be empty")} + } + if v.DetectorId != nil { + if err := encoder.SetURI("DetectorId").String(*v.DetectorId); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpGetDetector struct { } @@ -2457,6 +2659,89 @@ func awsRestjson1_serializeOpDocumentGetMembersInput(v *GetMembersInput, value s return nil } +type awsRestjson1_serializeOpGetRemainingFreeTrialDays struct { +} + +func (*awsRestjson1_serializeOpGetRemainingFreeTrialDays) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetRemainingFreeTrialDays) 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.(*GetRemainingFreeTrialDaysInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/detector/{DetectorId}/freeTrial/daysRemaining") + 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_serializeOpHttpBindingsGetRemainingFreeTrialDaysInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentGetRemainingFreeTrialDaysInput(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_serializeOpHttpBindingsGetRemainingFreeTrialDaysInput(v *GetRemainingFreeTrialDaysInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DetectorId == nil || len(*v.DetectorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DetectorId must not be empty")} + } + if v.DetectorId != nil { + if err := encoder.SetURI("DetectorId").String(*v.DetectorId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentGetRemainingFreeTrialDaysInput(v *GetRemainingFreeTrialDaysInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccountIds != nil { + ok := object.Key("accountIds") + if err := awsRestjson1_serializeDocumentAccountIds(v.AccountIds, ok); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpGetThreatIntelSet struct { } diff --git a/service/guardduty/types/types.go b/service/guardduty/types/types.go index 10f107d46d6..927a7825406 100644 --- a/service/guardduty/types/types.go +++ b/service/guardduty/types/types.go @@ -55,6 +55,18 @@ type AccountDetail struct { noSmithyDocumentSerde } +// Provides details of the GuardDuty member account that uses a free trial service. +type AccountFreeTrialInfo struct { + + // The account identifier of the GuardDuty member account. + AccountId *string + + // Describes the data source enabled for the GuardDuty member account. + DataSources *DataSourcesFreeTrial + + noSmithyDocumentSerde +} + // Contains information about the account level permissions on the S3 bucket. type AccountLevelPermissions struct { @@ -101,9 +113,32 @@ type AdminAccount struct { noSmithyDocumentSerde } +// Contains information about the administrator account and invitation. +type Administrator struct { + + // The ID of the account used as the administrator account. + AccountId *string + + // The value that is used to validate the administrator account to the member + // account. + InvitationId *string + + // The timestamp when the invitation was sent. + InvitedAt *string + + // The status of the relationship between the administrator and member accounts. + RelationshipStatus *string + + noSmithyDocumentSerde +} + // Contains information about the API action. type AwsApiCallAction struct { + // The details of the Amazon Web Services account that made the API call. This + // field identifies the resources that were affected by this API call. + AffectedResources map[string]string + // The Amazon Web Services API name. Api *string @@ -358,6 +393,39 @@ type DataSourceConfigurationsResult struct { noSmithyDocumentSerde } +// Contains information about which data sources are enabled for the GuardDuty +// member account. +type DataSourceFreeTrial struct { + + // A value that specifies the number of days left to use each enabled data source. + FreeTrialDaysRemaining int32 + + noSmithyDocumentSerde +} + +// Contains information about which data sources are enabled for the GuardDuty +// member account. +type DataSourcesFreeTrial struct { + + // Describes whether any AWS CloudTrail management event logs are enabled as data + // sources. + CloudTrail *DataSourceFreeTrial + + // Describes whether any DNS logs are enabled as data sources. + DnsLogs *DataSourceFreeTrial + + // Describes whether any VPC Flow logs are enabled as data sources. + FlowLogs *DataSourceFreeTrial + + // Describes whether any Kubernetes logs are enabled as data sources. + Kubernetes *KubernetesDataSourceFreeTrial + + // Describes whether any S3 data event logs are enabled as data sources. + S3Logs *DataSourceFreeTrial + + noSmithyDocumentSerde +} + // Contains information on the server side encryption method used in the S3 bucket. // See S3 Server-Side Encryption // (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) for @@ -425,9 +493,16 @@ type DNSLogsConfigurationResult struct { // Contains information about the DNS_REQUEST action described in this finding. type DnsRequestAction struct { + // Indicates whether the targeted port is blocked. + Blocked bool + // The domain information for the API request. Domain *string + // The network connection protocol observed in the activity that prompted GuardDuty + // to generate the finding. + Protocol *string + noSmithyDocumentSerde } @@ -748,6 +823,16 @@ type KubernetesConfigurationResult struct { noSmithyDocumentSerde } +// Provides details about the Kubernetes resources when it is enabled as a data +// source. +type KubernetesDataSourceFreeTrial struct { + + // Describes whether Kubernetes audit logs are enabled as a data source. + AuditLogs *DataSourceFreeTrial + + noSmithyDocumentSerde +} + // Details about Kubernetes resources such as a Kubernetes user or workload // resource involved in a Kubernetes finding. type KubernetesDetails struct { @@ -870,6 +955,9 @@ type Member struct { // This member is required. UpdatedAt *string + // The administrator account ID. + AdministratorId *string + // The detector ID of the member account. DetectorId *string @@ -1327,6 +1415,9 @@ type Service struct { // Information about the activity that is described in a finding. Action *Action + // Contains additional information about the generated finding. + AdditionalInfo *ServiceAdditionalInfo + // Indicates whether this finding is archived. Archived bool @@ -1360,6 +1451,18 @@ type Service struct { noSmithyDocumentSerde } +// Additional information about the generated finding. +type ServiceAdditionalInfo struct { + + // Describes the type of the additional information. + Type *string + + // This field specifies the value of the additional information. + Value *string + + noSmithyDocumentSerde +} + // Contains information about the criteria used for sorting findings. type SortCriteria struct { diff --git a/service/guardduty/validators.go b/service/guardduty/validators.go index c05e4b20cbf..04cfcfaa56a 100644 --- a/service/guardduty/validators.go +++ b/service/guardduty/validators.go @@ -10,6 +10,26 @@ import ( "github.com/aws/smithy-go/middleware" ) +type validateOpAcceptAdministratorInvitation struct { +} + +func (*validateOpAcceptAdministratorInvitation) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpAcceptAdministratorInvitation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*AcceptAdministratorInvitationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpAcceptAdministratorInvitationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpAcceptInvitation struct { } @@ -410,6 +430,26 @@ func (m *validateOpDisableOrganizationAdminAccount) HandleInitialize(ctx context return next.HandleInitialize(ctx, in) } +type validateOpDisassociateFromAdministratorAccount struct { +} + +func (*validateOpDisassociateFromAdministratorAccount) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisassociateFromAdministratorAccount) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisassociateFromAdministratorAccountInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisassociateFromAdministratorAccountInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpDisassociateFromMasterAccount struct { } @@ -470,6 +510,26 @@ func (m *validateOpEnableOrganizationAdminAccount) HandleInitialize(ctx context. return next.HandleInitialize(ctx, in) } +type validateOpGetAdministratorAccount struct { +} + +func (*validateOpGetAdministratorAccount) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetAdministratorAccount) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetAdministratorAccountInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetAdministratorAccountInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetDetector struct { } @@ -630,6 +690,26 @@ func (m *validateOpGetMembers) HandleInitialize(ctx context.Context, in middlewa return next.HandleInitialize(ctx, in) } +type validateOpGetRemainingFreeTrialDays struct { +} + +func (*validateOpGetRemainingFreeTrialDays) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetRemainingFreeTrialDays) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetRemainingFreeTrialDaysInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetRemainingFreeTrialDaysInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetThreatIntelSet struct { } @@ -1090,6 +1170,10 @@ func (m *validateOpUpdateThreatIntelSet) HandleInitialize(ctx context.Context, i return next.HandleInitialize(ctx, in) } +func addOpAcceptAdministratorInvitationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpAcceptAdministratorInvitation{}, middleware.After) +} + func addOpAcceptInvitationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpAcceptInvitation{}, middleware.After) } @@ -1170,6 +1254,10 @@ func addOpDisableOrganizationAdminAccountValidationMiddleware(stack *middleware. return stack.Initialize.Add(&validateOpDisableOrganizationAdminAccount{}, middleware.After) } +func addOpDisassociateFromAdministratorAccountValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisassociateFromAdministratorAccount{}, middleware.After) +} + func addOpDisassociateFromMasterAccountValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDisassociateFromMasterAccount{}, middleware.After) } @@ -1182,6 +1270,10 @@ func addOpEnableOrganizationAdminAccountValidationMiddleware(stack *middleware.S return stack.Initialize.Add(&validateOpEnableOrganizationAdminAccount{}, middleware.After) } +func addOpGetAdministratorAccountValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetAdministratorAccount{}, middleware.After) +} + func addOpGetDetectorValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetDetector{}, middleware.After) } @@ -1214,6 +1306,10 @@ func addOpGetMembersValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetMembers{}, middleware.After) } +func addOpGetRemainingFreeTrialDaysValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetRemainingFreeTrialDays{}, middleware.After) +} + func addOpGetThreatIntelSetValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetThreatIntelSet{}, middleware.After) } @@ -1486,6 +1582,27 @@ func validateUsageCriteria(v *types.UsageCriteria) error { } } +func validateOpAcceptAdministratorInvitationInput(v *AcceptAdministratorInvitationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "AcceptAdministratorInvitationInput"} + if v.DetectorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DetectorId")) + } + if v.AdministratorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AdministratorId")) + } + if v.InvitationId == nil { + invalidParams.Add(smithy.NewErrParamRequired("InvitationId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpAcceptInvitationInput(v *AcceptInvitationInput) error { if v == nil { return nil @@ -1852,6 +1969,21 @@ func validateOpDisableOrganizationAdminAccountInput(v *DisableOrganizationAdminA } } +func validateOpDisassociateFromAdministratorAccountInput(v *DisassociateFromAdministratorAccountInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisassociateFromAdministratorAccountInput"} + if v.DetectorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DetectorId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpDisassociateFromMasterAccountInput(v *DisassociateFromMasterAccountInput) error { if v == nil { return nil @@ -1900,6 +2032,21 @@ func validateOpEnableOrganizationAdminAccountInput(v *EnableOrganizationAdminAcc } } +func validateOpGetAdministratorAccountInput(v *GetAdministratorAccountInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetAdministratorAccountInput"} + if v.DetectorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DetectorId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetDetectorInput(v *GetDetectorInput) error { if v == nil { return nil @@ -2038,6 +2185,21 @@ func validateOpGetMembersInput(v *GetMembersInput) error { } } +func validateOpGetRemainingFreeTrialDaysInput(v *GetRemainingFreeTrialDaysInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetRemainingFreeTrialDaysInput"} + if v.DetectorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DetectorId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetThreatIntelSetInput(v *GetThreatIntelSetInput) error { if v == nil { return nil diff --git a/service/servicecatalogappregistry/api_op_ListAttributeGroupsForApplication.go b/service/servicecatalogappregistry/api_op_ListAttributeGroupsForApplication.go new file mode 100644 index 00000000000..11a79593cff --- /dev/null +++ b/service/servicecatalogappregistry/api_op_ListAttributeGroupsForApplication.go @@ -0,0 +1,223 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package servicecatalogappregistry + +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/servicecatalogappregistry/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the details of all attribute groups associated with a specific +// application. The results display in pages. +func (c *Client) ListAttributeGroupsForApplication(ctx context.Context, params *ListAttributeGroupsForApplicationInput, optFns ...func(*Options)) (*ListAttributeGroupsForApplicationOutput, error) { + if params == nil { + params = &ListAttributeGroupsForApplicationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListAttributeGroupsForApplication", params, optFns, c.addOperationListAttributeGroupsForApplicationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListAttributeGroupsForApplicationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListAttributeGroupsForApplicationInput struct { + + // The name or ID of the application. + // + // This member is required. + Application *string + + // The upper bound of the number of results to return. The value cannot exceed 25. + // If you omit this parameter, it defaults to 25. This value is optional. + MaxResults int32 + + // This token retrieves the next page of results after a previous API call. + NextToken *string + + noSmithyDocumentSerde +} + +type ListAttributeGroupsForApplicationOutput struct { + + // The details related to a specific AttributeGroup. + AttributeGroupsDetails []types.AttributeGroupDetails + + // The token to use to get the next page of results after a previous API call. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListAttributeGroupsForApplicationMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListAttributeGroupsForApplication{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListAttributeGroupsForApplication{}, 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 = addOpListAttributeGroupsForApplicationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAttributeGroupsForApplication(options.Region), middleware.Before); 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 +} + +// ListAttributeGroupsForApplicationAPIClient is a client that implements the +// ListAttributeGroupsForApplication operation. +type ListAttributeGroupsForApplicationAPIClient interface { + ListAttributeGroupsForApplication(context.Context, *ListAttributeGroupsForApplicationInput, ...func(*Options)) (*ListAttributeGroupsForApplicationOutput, error) +} + +var _ ListAttributeGroupsForApplicationAPIClient = (*Client)(nil) + +// ListAttributeGroupsForApplicationPaginatorOptions is the paginator options for +// ListAttributeGroupsForApplication +type ListAttributeGroupsForApplicationPaginatorOptions struct { + // The upper bound of the number of results to return. The value cannot exceed 25. + // If you omit this parameter, it defaults to 25. This value is optional. + 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 +} + +// ListAttributeGroupsForApplicationPaginator is a paginator for +// ListAttributeGroupsForApplication +type ListAttributeGroupsForApplicationPaginator struct { + options ListAttributeGroupsForApplicationPaginatorOptions + client ListAttributeGroupsForApplicationAPIClient + params *ListAttributeGroupsForApplicationInput + nextToken *string + firstPage bool +} + +// NewListAttributeGroupsForApplicationPaginator returns a new +// ListAttributeGroupsForApplicationPaginator +func NewListAttributeGroupsForApplicationPaginator(client ListAttributeGroupsForApplicationAPIClient, params *ListAttributeGroupsForApplicationInput, optFns ...func(*ListAttributeGroupsForApplicationPaginatorOptions)) *ListAttributeGroupsForApplicationPaginator { + if params == nil { + params = &ListAttributeGroupsForApplicationInput{} + } + + options := ListAttributeGroupsForApplicationPaginatorOptions{} + if params.MaxResults != 0 { + options.Limit = params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListAttributeGroupsForApplicationPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListAttributeGroupsForApplicationPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListAttributeGroupsForApplication page. +func (p *ListAttributeGroupsForApplicationPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAttributeGroupsForApplicationOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + params.MaxResults = p.options.Limit + + result, err := p.client.ListAttributeGroupsForApplication(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_opListAttributeGroupsForApplication(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "servicecatalog", + OperationName: "ListAttributeGroupsForApplication", + } +} diff --git a/service/servicecatalogappregistry/api_op_UpdateApplication.go b/service/servicecatalogappregistry/api_op_UpdateApplication.go index a82639c467c..099b4194fbd 100644 --- a/service/servicecatalogappregistry/api_op_UpdateApplication.go +++ b/service/servicecatalogappregistry/api_op_UpdateApplication.go @@ -37,8 +37,9 @@ type UpdateApplicationInput struct { // The new description of the application. Description *string - // The new name of the application. The name must be unique in the region in which - // you are updating the application. + // Deprecated: The new name of the application. The name must be unique in the + // region in which you are updating the application. Please do not use this field + // as we have stopped supporting name updates. // // Deprecated: Name update for application is deprecated. Name *string diff --git a/service/servicecatalogappregistry/api_op_UpdateAttributeGroup.go b/service/servicecatalogappregistry/api_op_UpdateAttributeGroup.go index 20808feb53c..85ac2193a7b 100644 --- a/service/servicecatalogappregistry/api_op_UpdateAttributeGroup.go +++ b/service/servicecatalogappregistry/api_op_UpdateAttributeGroup.go @@ -42,8 +42,9 @@ type UpdateAttributeGroupInput struct { // The description of the attribute group that the user provides. Description *string - // The new name of the attribute group. The name must be unique in the region in - // which you are updating the attribute group. + // Deprecated: The new name of the attribute group. The name must be unique in the + // region in which you are updating the attribute group. Please do not use this + // field as we have stopped supporting name updates. // // Deprecated: Name update for attribute group is deprecated. Name *string diff --git a/service/servicecatalogappregistry/deserializers.go b/service/servicecatalogappregistry/deserializers.go index fd034e98ba2..cc51d96a610 100644 --- a/service/servicecatalogappregistry/deserializers.go +++ b/service/servicecatalogappregistry/deserializers.go @@ -117,6 +117,9 @@ func awsRestjson1_deserializeOpErrorAssociateAttributeGroup(response *smithyhttp } switch { + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) @@ -298,6 +301,9 @@ func awsRestjson1_deserializeOpErrorAssociateResource(response *smithyhttp.Respo 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, @@ -464,6 +470,9 @@ func awsRestjson1_deserializeOpErrorCreateApplication(response *smithyhttp.Respo 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, @@ -1242,6 +1251,9 @@ func awsRestjson1_deserializeOpErrorDisassociateResource(response *smithyhttp.Re 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, @@ -1399,6 +1411,9 @@ func awsRestjson1_deserializeOpErrorGetApplication(response *smithyhttp.Response } switch { + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) @@ -1785,6 +1800,9 @@ func awsRestjson1_deserializeOpErrorGetAttributeGroup(response *smithyhttp.Respo } switch { + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) @@ -2553,6 +2571,168 @@ func awsRestjson1_deserializeOpDocumentListAttributeGroupsOutput(v **ListAttribu return nil } +type awsRestjson1_deserializeOpListAttributeGroupsForApplication struct { +} + +func (*awsRestjson1_deserializeOpListAttributeGroupsForApplication) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListAttributeGroupsForApplication) 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_deserializeOpErrorListAttributeGroupsForApplication(response, &metadata) + } + output := &ListAttributeGroupsForApplicationOutput{} + 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_deserializeOpDocumentListAttributeGroupsForApplicationOutput(&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_deserializeOpErrorListAttributeGroupsForApplication(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + 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_deserializeOpDocumentListAttributeGroupsForApplicationOutput(v **ListAttributeGroupsForApplicationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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 *ListAttributeGroupsForApplicationOutput + if *v == nil { + sv = &ListAttributeGroupsForApplicationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "attributeGroupsDetails": + if err := awsRestjson1_deserializeDocumentAttributeGroupDetailsList(&sv.AttributeGroupsDetails, value); err != nil { + return err + } + + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpListTagsForResource struct { } @@ -3166,6 +3346,9 @@ func awsRestjson1_deserializeOpErrorUpdateApplication(response *smithyhttp.Respo 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, @@ -3871,6 +4054,98 @@ func awsRestjson1_deserializeDocumentAttributeGroup(v **types.AttributeGroup, va return nil } +func awsRestjson1_deserializeDocumentAttributeGroupDetails(v **types.AttributeGroupDetails, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.AttributeGroupDetails + if *v == nil { + sv = &types.AttributeGroupDetails{} + } 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 AttributeGroupArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AttributeGroupId to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Name to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAttributeGroupDetailsList(v *[]types.AttributeGroupDetails, 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.AttributeGroupDetails + if *v == nil { + cv = []types.AttributeGroupDetails{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AttributeGroupDetails + destAddr := &col + if err := awsRestjson1_deserializeDocumentAttributeGroupDetails(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentAttributeGroupIds(v *[]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/servicecatalogappregistry/generated.json b/service/servicecatalogappregistry/generated.json index 989657d1954..0de30a056ae 100644 --- a/service/servicecatalogappregistry/generated.json +++ b/service/servicecatalogappregistry/generated.json @@ -23,6 +23,7 @@ "api_op_ListAssociatedAttributeGroups.go", "api_op_ListAssociatedResources.go", "api_op_ListAttributeGroups.go", + "api_op_ListAttributeGroupsForApplication.go", "api_op_ListTagsForResource.go", "api_op_SyncResource.go", "api_op_TagResource.go", diff --git a/service/servicecatalogappregistry/serializers.go b/service/servicecatalogappregistry/serializers.go index 32f03591343..1f4b03fcf93 100644 --- a/service/servicecatalogappregistry/serializers.go +++ b/service/servicecatalogappregistry/serializers.go @@ -1028,6 +1028,72 @@ func awsRestjson1_serializeOpHttpBindingsListAttributeGroupsInput(v *ListAttribu return nil } +type awsRestjson1_serializeOpListAttributeGroupsForApplication struct { +} + +func (*awsRestjson1_serializeOpListAttributeGroupsForApplication) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListAttributeGroupsForApplication) 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.(*ListAttributeGroupsForApplicationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/applications/{application}/attribute-group-details") + 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_serializeOpHttpBindingsListAttributeGroupsForApplicationInput(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_serializeOpHttpBindingsListAttributeGroupsForApplicationInput(v *ListAttributeGroupsForApplicationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Application == nil || len(*v.Application) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member application must not be empty")} + } + if v.Application != nil { + if err := encoder.SetURI("application").String(*v.Application); err != nil { + return err + } + } + + if v.MaxResults != 0 { + encoder.SetQuery("maxResults").Integer(v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + return nil +} + type awsRestjson1_serializeOpListTagsForResource struct { } diff --git a/service/servicecatalogappregistry/types/types.go b/service/servicecatalogappregistry/types/types.go index 733ad6b0059..e8e41d896a7 100644 --- a/service/servicecatalogappregistry/types/types.go +++ b/service/servicecatalogappregistry/types/types.go @@ -94,6 +94,21 @@ type AttributeGroup struct { noSmithyDocumentSerde } +// The details related to a specific AttributeGroup. +type AttributeGroupDetails struct { + + // The Amazon resource name (ARN) that specifies the attribute group. + Arn *string + + // The unique identifier of the attribute group. + Id *string + + // The name of the attribute group. + Name *string + + noSmithyDocumentSerde +} + // Summary of a Amazon Web Services Service Catalog AppRegistry attribute group. type AttributeGroupSummary struct { diff --git a/service/servicecatalogappregistry/validators.go b/service/servicecatalogappregistry/validators.go index b172f691beb..eb5cb2eb6b2 100644 --- a/service/servicecatalogappregistry/validators.go +++ b/service/servicecatalogappregistry/validators.go @@ -269,6 +269,26 @@ func (m *validateOpListAssociatedResources) HandleInitialize(ctx context.Context return next.HandleInitialize(ctx, in) } +type validateOpListAttributeGroupsForApplication struct { +} + +func (*validateOpListAttributeGroupsForApplication) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListAttributeGroupsForApplication) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListAttributeGroupsForApplicationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListAttributeGroupsForApplicationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpListTagsForResource struct { } @@ -441,6 +461,10 @@ func addOpListAssociatedResourcesValidationMiddleware(stack *middleware.Stack) e return stack.Initialize.Add(&validateOpListAssociatedResources{}, middleware.After) } +func addOpListAttributeGroupsForApplicationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListAttributeGroupsForApplication{}, middleware.After) +} + func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) } @@ -693,6 +717,21 @@ func validateOpListAssociatedResourcesInput(v *ListAssociatedResourcesInput) err } } +func validateOpListAttributeGroupsForApplicationInput(v *ListAttributeGroupsForApplicationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListAttributeGroupsForApplicationInput"} + if v.Application == nil { + invalidParams.Add(smithy.NewErrParamRequired("Application")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpListTagsForResourceInput(v *ListTagsForResourceInput) error { if v == nil { return nil diff --git a/service/workspaces/api_op_ImportWorkspaceImage.go b/service/workspaces/api_op_ImportWorkspaceImage.go index 43a047cb0ac..092d107e2e1 100644 --- a/service/workspaces/api_op_ImportWorkspaceImage.go +++ b/service/workspaces/api_op_ImportWorkspaceImage.go @@ -53,10 +53,8 @@ type ImportWorkspaceImageInput struct { // protocol you want to use for your BYOL Workspace image, either PCoIP or // WorkSpaces Streaming Protocol (WSP). To use WSP, specify a value that ends in // _WSP. To use PCoIP, specify a value that does not end in _WSP. For - // non-GPU-enabled images (bundles other than Graphics.g4dn, GraphicsPro.g4dn, - // Graphics, or GraphicsPro), specify BYOL_REGULAR or BYOL_REGULAR_WSP, depending - // on the protocol. Use BYOL_GRAPHICS_G4DN ingestion for both Graphics.g4dn and - // GraphicsPro.g4dn. + // non-GPU-enabled bundles (bundles other than Graphics or GraphicsPro), specify + // BYOL_REGULAR or BYOL_REGULAR_WSP, depending on the protocol. // // This member is required. IngestionProcess types.WorkspaceImageIngestionProcess @@ -65,13 +63,7 @@ type ImportWorkspaceImageInput struct { // Windows 10 BYOL images. For more information about subscribing to Office for // BYOL images, see Bring Your Own Windows Desktop Licenses // (https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html). - // - // * - // Although this parameter is an array, only one item is allowed at this time - // - // * - // Microsoft Office 2016 application subscription through AWS is currently not - // supported for Graphics.g4dn Bring Your Own License (BYOL) images + // Although this parameter is an array, only one item is allowed at this time. Applications []types.Application // The tags. Each WorkSpaces resource can have a maximum of 50 tags. diff --git a/service/workspaces/deserializers.go b/service/workspaces/deserializers.go index bd3d24411ef..32267726c09 100644 --- a/service/workspaces/deserializers.go +++ b/service/workspaces/deserializers.go @@ -9658,6 +9658,15 @@ func awsAwsjson11_deserializeDocumentOperationNotSupportedException(v **types.Op sv.Message = ptr.String(jtv) } + case "reason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ExceptionErrorCode to be of type string, got %T instead", value) + } + sv.Reason = ptr.String(jtv) + } + default: _, _ = key, value diff --git a/service/workspaces/types/errors.go b/service/workspaces/types/errors.go index 546fc5b3300..1e55f6bd71b 100644 --- a/service/workspaces/types/errors.go +++ b/service/workspaces/types/errors.go @@ -90,6 +90,8 @@ func (e *OperationInProgressException) ErrorFault() smithy.ErrorFault { return s type OperationNotSupportedException struct { Message *string + Reason *string + noSmithyDocumentSerde } diff --git a/service/workspaces/types/types.go b/service/workspaces/types/types.go index ed6845d44f3..d0b055a3876 100644 --- a/service/workspaces/types/types.go +++ b/service/workspaces/types/types.go @@ -170,8 +170,8 @@ type DefaultClientBrandingAttributes struct { // is en_US. LoginMessage map[string]string - // The logo URL. This is the link where users can download the logo image. The only - // supported image format is .png. + // The logo URL. The only image format accepted is a binary data object that is + // converted from a .png file. LogoUrl *string // The support email. The company's customer support email address. @@ -211,8 +211,8 @@ type DefaultImportClientBrandingAttributes struct { // is en_US. LoginMessage map[string]string - // The logo. This is the link where users can download the logo image. The only - // image format accepted is .png. + // The logo. The only image format accepted is a binary data object that is + // converted from a .png file. Logo []byte // The support email. The company's customer support email address. @@ -340,22 +340,24 @@ type IosClientBrandingAttributes struct { LoginMessage map[string]string // The @2x version of the logo. This is the higher resolution display that offers a - // scale factor of 2.0 (or @2x). For more information about iOS image size and - // resolution, see Image Size and Resolution + // scale factor of 2.0 (or @2x). The only image format accepted is a binary data + // object that is converted from a .png file. For more information about iOS image + // size and resolution, see Image Size and Resolution // (https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/image-size-and-resolution/) // in the Apple Human Interface Guidelines. Logo2xUrl *string // The @3x version of the logo. This is the higher resolution display that offers a - // scale factor of 3.0 (or @3x). For more information about iOS image size and - // resolution, see Image Size and Resolution + // scale factor of 3.0 (or @3x).The only image format accepted is a binary data + // object that is converted from a .png file. For more information about iOS image + // size and resolution, see Image Size and Resolution // (https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/image-size-and-resolution/) // in the Apple Human Interface Guidelines. Logo3xUrl *string - // The logo. This is the link where users can download the logo image. This is the - // standard-resolution display that has a 1:1 pixel density (or @1x), where one - // pixel is equal to one point. + // The logo. This is the standard-resolution display that has a 1:1 pixel density + // (or @1x), where one pixel is equal to one point. The only image format accepted + // is a binary data object that is converted from a .png file. LogoUrl *string // The support email. The company's customer support email address. @@ -395,21 +397,23 @@ type IosImportClientBrandingAttributes struct { // is en_US. LoginMessage map[string]string - // The logo. This is the link where users can download the logo image. This is the - // standard-resolution display that has a 1:1 pixel density (or @1x), where one - // pixel is equal to one point. + // The logo. This is the standard-resolution display that has a 1:1 pixel density + // (or @1x), where one pixel is equal to one point. The only image format accepted + // is a binary data object that is converted from a .png file. Logo []byte // The @2x version of the logo. This is the higher resolution display that offers a - // scale factor of 2.0 (or @2x). For more information about iOS image size and - // resolution, see Image Size and Resolution + // scale factor of 2.0 (or @2x). The only image format accepted is a binary data + // object that is converted from a .png file. For more information about iOS image + // size and resolution, see Image Size and Resolution // (https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/image-size-and-resolution/) // in the Apple Human Interface Guidelines. Logo2x []byte // The @3x version of the logo. This is the higher resolution display that offers a - // scale factor of 3.0 (or @3x). For more information about iOS image size and - // resolution, see Image Size and Resolution + // scale factor of 3.0 (or @3x). The only image format accepted is a binary data + // object that is converted from a .png file. For more information about iOS image + // size and resolution, see Image Size and Resolution // (https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/image-size-and-resolution/) // in the Apple Human Interface Guidelines. Logo3x []byte