From 69a608f663233555dcf3a87bea11e3f746347d77 Mon Sep 17 00:00:00 2001 From: AWS SDK for Go v2 automation user Date: Tue, 5 Jul 2022 18:21:39 +0000 Subject: [PATCH] Regenerated Clients --- .../1c1d295a44494467b97af97aef283b2d.json | 8 + .../3e3da0888dd541769f19f9490533bf96.json | 8 + .../41575353444b40ffbf474f4155544f00.json | 8 + .../469c3d4b6c2a415ba9e28dd1e467aa9c.json | 8 + .../48c1a6ab4c164db4ade90c05917b21ca.json | 8 + .../b1b02f7809504f3e9501888daf639df3.json | 8 + .../f6313c5f6c014a5fb0aead8af3af01c9.json | 8 + .../api_op_DescribeOrganizationConfigRules.go | 12 +- ...op_DescribeOrganizationConformancePacks.go | 13 +- .../api_op_PutOrganizationConformancePack.go | 14 +- .../api_op_PutRemediationConfigurations.go | 8 +- .../configservice/api_op_PutResourceConfig.go | 5 +- service/configservice/types/types.go | 15 +- service/lexmodelsv2/api_op_CreateExport.go | 5 +- service/lexmodelsv2/deserializers.go | 9 + service/lexmodelsv2/serializers.go | 5 + service/lexmodelsv2/types/enums.go | 18 + service/lexmodelsv2/types/types.go | 7 +- .../api_op_CreateAccountCustomization.go | 4 +- .../api_op_CreateAccountSubscription.go | 246 + .../api_op_DescribeAccountSubscription.go | 145 + ...api_op_GenerateEmbedUrlForAnonymousUser.go | 25 +- ...pi_op_GenerateEmbedUrlForRegisteredUser.go | 10 + .../quicksight/api_op_GetDashboardEmbedUrl.go | 39 +- .../api_op_UpdateAccountCustomization.go | 6 +- .../api_op_UpdateAccountSettings.go | 4 +- .../api_op_UpdatePublicSharingSettings.go | 18 +- service/quicksight/deserializers.go | 522 ++ service/quicksight/generated.json | 2 + service/quicksight/serializers.go | 235 + service/quicksight/types/enums.go | 26 +- service/quicksight/types/types.go | 68 +- service/quicksight/validators.go | 90 + service/rds/api_op_BacktrackDBCluster.go | 2 +- service/rds/api_op_CopyDBClusterSnapshot.go | 123 +- service/rds/api_op_CopyDBSnapshot.go | 67 +- service/rds/api_op_CreateDBCluster.go | 100 +- service/rds/api_op_CreateDBClusterEndpoint.go | 2 +- .../api_op_CreateDBClusterParameterGroup.go | 2 +- service/rds/api_op_CreateDBInstance.go | 92 +- .../rds/api_op_CreateDBInstanceReadReplica.go | 124 +- service/rds/api_op_CreateEventSubscription.go | 2 +- service/rds/api_op_CreateGlobalCluster.go | 4 +- service/rds/api_op_DescribeDBClusters.go | 568 ++ service/rds/api_op_DescribeEvents.go | 9 +- service/rds/api_op_FailoverDBCluster.go | 2 +- service/rds/api_op_ModifyDBCluster.go | 26 +- .../api_op_ModifyDBClusterParameterGroup.go | 16 +- ...api_op_ModifyDBClusterSnapshotAttribute.go | 4 +- service/rds/api_op_ModifyDBInstance.go | 52 +- .../rds/api_op_ModifyDBProxyTargetGroup.go | 4 +- .../rds/api_op_ModifyDBSnapshotAttribute.go | 6 +- service/rds/api_op_RestoreDBClusterFromS3.go | 12 +- .../api_op_RestoreDBClusterFromSnapshot.go | 2 +- .../api_op_RestoreDBClusterToPointInTime.go | 2 +- service/rds/api_op_RestoreDBInstanceFromS3.go | 28 +- ...rtDBInstanceAutomatedBackupsReplication.go | 23 +- ...opDBInstanceAutomatedBackupsReplication.go | 4 +- service/rds/types/types.go | 56 +- service/rolesanywhere/LICENSE.txt | 202 + service/rolesanywhere/api_client.go | 433 ++ service/rolesanywhere/api_client_test.go | 123 + service/rolesanywhere/api_op_CreateProfile.go | 152 + .../rolesanywhere/api_op_CreateTrustAnchor.go | 140 + service/rolesanywhere/api_op_DeleteCrl.go | 125 + service/rolesanywhere/api_op_DeleteProfile.go | 121 + .../rolesanywhere/api_op_DeleteTrustAnchor.go | 123 + service/rolesanywhere/api_op_DisableCrl.go | 125 + .../rolesanywhere/api_op_DisableProfile.go | 124 + .../api_op_DisableTrustAnchor.go | 126 + service/rolesanywhere/api_op_EnableCrl.go | 126 + service/rolesanywhere/api_op_EnableProfile.go | 123 + .../rolesanywhere/api_op_EnableTrustAnchor.go | 125 + service/rolesanywhere/api_op_GetCrl.go | 125 + service/rolesanywhere/api_op_GetProfile.go | 121 + service/rolesanywhere/api_op_GetSubject.go | 125 + .../rolesanywhere/api_op_GetTrustAnchor.go | 123 + service/rolesanywhere/api_op_ImportCrl.go | 144 + service/rolesanywhere/api_op_ListCrls.go | 205 + service/rolesanywhere/api_op_ListProfiles.go | 205 + service/rolesanywhere/api_op_ListSubjects.go | 205 + .../api_op_ListTagsForResource.go | 122 + .../rolesanywhere/api_op_ListTrustAnchors.go | 206 + service/rolesanywhere/api_op_TagResource.go | 122 + service/rolesanywhere/api_op_UntagResource.go | 122 + service/rolesanywhere/api_op_UpdateCrl.go | 133 + service/rolesanywhere/api_op_UpdateProfile.go | 142 + .../rolesanywhere/api_op_UpdateTrustAnchor.go | 135 + service/rolesanywhere/deserializers.go | 5373 +++++++++++++++++ service/rolesanywhere/doc.go | 21 + service/rolesanywhere/endpoints.go | 200 + service/rolesanywhere/generated.json | 54 + service/rolesanywhere/go.mod | 16 + service/rolesanywhere/go.sum | 11 + service/rolesanywhere/go_module_metadata.go | 6 + .../internal/endpoints/endpoints.go | 309 + .../internal/endpoints/endpoints_test.go | 11 + service/rolesanywhere/protocol_test.go | 3 + service/rolesanywhere/serializers.go | 1867 ++++++ service/rolesanywhere/types/enums.go | 23 + service/rolesanywhere/types/errors.go | 84 + service/rolesanywhere/types/types.go | 306 + .../types/types_exported_test.go | 29 + service/rolesanywhere/validators.go | 941 +++ .../ssmincidents/api_op_UpdateResponsePlan.go | 5 + service/ssmincidents/deserializers.go | 5 + service/ssmincidents/serializers.go | 25 + service/ssmincidents/types/types.go | 3 + 108 files changed, 16093 insertions(+), 541 deletions(-) create mode 100644 .changelog/1c1d295a44494467b97af97aef283b2d.json create mode 100644 .changelog/3e3da0888dd541769f19f9490533bf96.json create mode 100644 .changelog/41575353444b40ffbf474f4155544f00.json create mode 100644 .changelog/469c3d4b6c2a415ba9e28dd1e467aa9c.json create mode 100644 .changelog/48c1a6ab4c164db4ade90c05917b21ca.json create mode 100644 .changelog/b1b02f7809504f3e9501888daf639df3.json create mode 100644 .changelog/f6313c5f6c014a5fb0aead8af3af01c9.json create mode 100644 service/quicksight/api_op_CreateAccountSubscription.go create mode 100644 service/quicksight/api_op_DescribeAccountSubscription.go create mode 100644 service/rolesanywhere/LICENSE.txt create mode 100644 service/rolesanywhere/api_client.go create mode 100644 service/rolesanywhere/api_client_test.go create mode 100644 service/rolesanywhere/api_op_CreateProfile.go create mode 100644 service/rolesanywhere/api_op_CreateTrustAnchor.go create mode 100644 service/rolesanywhere/api_op_DeleteCrl.go create mode 100644 service/rolesanywhere/api_op_DeleteProfile.go create mode 100644 service/rolesanywhere/api_op_DeleteTrustAnchor.go create mode 100644 service/rolesanywhere/api_op_DisableCrl.go create mode 100644 service/rolesanywhere/api_op_DisableProfile.go create mode 100644 service/rolesanywhere/api_op_DisableTrustAnchor.go create mode 100644 service/rolesanywhere/api_op_EnableCrl.go create mode 100644 service/rolesanywhere/api_op_EnableProfile.go create mode 100644 service/rolesanywhere/api_op_EnableTrustAnchor.go create mode 100644 service/rolesanywhere/api_op_GetCrl.go create mode 100644 service/rolesanywhere/api_op_GetProfile.go create mode 100644 service/rolesanywhere/api_op_GetSubject.go create mode 100644 service/rolesanywhere/api_op_GetTrustAnchor.go create mode 100644 service/rolesanywhere/api_op_ImportCrl.go create mode 100644 service/rolesanywhere/api_op_ListCrls.go create mode 100644 service/rolesanywhere/api_op_ListProfiles.go create mode 100644 service/rolesanywhere/api_op_ListSubjects.go create mode 100644 service/rolesanywhere/api_op_ListTagsForResource.go create mode 100644 service/rolesanywhere/api_op_ListTrustAnchors.go create mode 100644 service/rolesanywhere/api_op_TagResource.go create mode 100644 service/rolesanywhere/api_op_UntagResource.go create mode 100644 service/rolesanywhere/api_op_UpdateCrl.go create mode 100644 service/rolesanywhere/api_op_UpdateProfile.go create mode 100644 service/rolesanywhere/api_op_UpdateTrustAnchor.go create mode 100644 service/rolesanywhere/deserializers.go create mode 100644 service/rolesanywhere/doc.go create mode 100644 service/rolesanywhere/endpoints.go create mode 100644 service/rolesanywhere/generated.json create mode 100644 service/rolesanywhere/go.mod create mode 100644 service/rolesanywhere/go.sum create mode 100644 service/rolesanywhere/go_module_metadata.go create mode 100644 service/rolesanywhere/internal/endpoints/endpoints.go create mode 100644 service/rolesanywhere/internal/endpoints/endpoints_test.go create mode 100644 service/rolesanywhere/protocol_test.go create mode 100644 service/rolesanywhere/serializers.go create mode 100644 service/rolesanywhere/types/enums.go create mode 100644 service/rolesanywhere/types/errors.go create mode 100644 service/rolesanywhere/types/types.go create mode 100644 service/rolesanywhere/types/types_exported_test.go create mode 100644 service/rolesanywhere/validators.go diff --git a/.changelog/1c1d295a44494467b97af97aef283b2d.json b/.changelog/1c1d295a44494467b97af97aef283b2d.json new file mode 100644 index 00000000000..26699584d71 --- /dev/null +++ b/.changelog/1c1d295a44494467b97af97aef283b2d.json @@ -0,0 +1,8 @@ +{ + "id": "1c1d295a-4449-4467-b97a-f97aef283b2d", + "type": "feature", + "description": "This release introduces additional optional parameters \"messageSelectionStrategy\" to PromptSpecification, which enables the users to configure the bot to play messages in orderly manner.", + "modules": [ + "service/lexmodelsv2" + ] +} \ No newline at end of file diff --git a/.changelog/3e3da0888dd541769f19f9490533bf96.json b/.changelog/3e3da0888dd541769f19f9490533bf96.json new file mode 100644 index 00000000000..76f9a6b43b8 --- /dev/null +++ b/.changelog/3e3da0888dd541769f19f9490533bf96.json @@ -0,0 +1,8 @@ +{ + "id": "3e3da088-8dd5-4176-9f19-f9490533bf96", + "type": "feature", + "description": "IAM Roles Anywhere allows your workloads such as servers, containers, and applications to obtain temporary AWS credentials and use the same IAM roles and policies that you have configured for your AWS workloads to access AWS resources.", + "modules": [ + "service/rolesanywhere" + ] +} \ No newline at end of file diff --git a/.changelog/41575353444b40ffbf474f4155544f00.json b/.changelog/41575353444b40ffbf474f4155544f00.json new file mode 100644 index 00000000000..9d71f8135e2 --- /dev/null +++ b/.changelog/41575353444b40ffbf474f4155544f00.json @@ -0,0 +1,8 @@ +{ + "id": "41575353-444b-40ff-bf47-4f4155544f00", + "type": "release", + "description": "New AWS service client module", + "modules": [ + "service/rolesanywhere" + ] +} \ No newline at end of file diff --git a/.changelog/469c3d4b6c2a415ba9e28dd1e467aa9c.json b/.changelog/469c3d4b6c2a415ba9e28dd1e467aa9c.json new file mode 100644 index 00000000000..18873df7bd5 --- /dev/null +++ b/.changelog/469c3d4b6c2a415ba9e28dd1e467aa9c.json @@ -0,0 +1,8 @@ +{ + "id": "469c3d4b-6c2a-415b-a9e2-8dd1e467aa9c", + "type": "feature", + "description": "Adds support for tagging incident-record on creation by providing incident tags in the template within a response-plan.", + "modules": [ + "service/ssmincidents" + ] +} \ No newline at end of file diff --git a/.changelog/48c1a6ab4c164db4ade90c05917b21ca.json b/.changelog/48c1a6ab4c164db4ade90c05917b21ca.json new file mode 100644 index 00000000000..5bf576c9528 --- /dev/null +++ b/.changelog/48c1a6ab4c164db4ade90c05917b21ca.json @@ -0,0 +1,8 @@ +{ + "id": "48c1a6ab-4c16-4db4-ade9-0c05917b21ca", + "type": "feature", + "description": "Adds waiters support for DBCluster.", + "modules": [ + "service/rds" + ] +} \ No newline at end of file diff --git a/.changelog/b1b02f7809504f3e9501888daf639df3.json b/.changelog/b1b02f7809504f3e9501888daf639df3.json new file mode 100644 index 00000000000..18c3be20ff0 --- /dev/null +++ b/.changelog/b1b02f7809504f3e9501888daf639df3.json @@ -0,0 +1,8 @@ +{ + "id": "b1b02f78-0950-4f3e-9501-888daf639df3", + "type": "feature", + "description": "This release allows customers to programmatically create QuickSight accounts with Enterprise and Enterprise + Q editions. It also releases allowlisting domains for embedding QuickSight dashboards at runtime through the embedding APIs.", + "modules": [ + "service/quicksight" + ] +} \ No newline at end of file diff --git a/.changelog/f6313c5f6c014a5fb0aead8af3af01c9.json b/.changelog/f6313c5f6c014a5fb0aead8af3af01c9.json new file mode 100644 index 00000000000..f5b3e47c5b1 --- /dev/null +++ b/.changelog/f6313c5f6c014a5fb0aead8af3af01c9.json @@ -0,0 +1,8 @@ +{ + "id": "f6313c5f-6c01-4a5f-b0ae-ad8af3af01c9", + "type": "documentation", + "description": "Updating documentation service limits", + "modules": [ + "service/configservice" + ] +} \ No newline at end of file diff --git a/service/configservice/api_op_DescribeOrganizationConfigRules.go b/service/configservice/api_op_DescribeOrganizationConfigRules.go index 2d8134744db..527692eb831 100644 --- a/service/configservice/api_op_DescribeOrganizationConfigRules.go +++ b/service/configservice/api_op_DescribeOrganizationConfigRules.go @@ -15,7 +15,17 @@ import ( // Returns a list of organization Config rules. When you specify the limit and the // next token, you receive a paginated response. Limit and next token are not // applicable if you specify organization Config rule names. It is only applicable, -// when you request all the organization Config rules. +// when you request all the organization Config rules. For accounts within an +// organzation If you deploy an organizational rule or conformance pack in an +// organization administrator account, and then establish a delegated administrator +// and deploy an organizational rule or conformance pack in the delegated +// administrator account, you won't be able to see the organizational rule or +// conformance pack in the organization administrator account from the delegated +// administrator account or see the organizational rule or conformance pack in the +// delegated administrator account from organization administrator account. The +// DescribeOrganizationConfigRules and DescribeOrganizationConformancePacks APIs +// can only see and interact with the organization-related resource that were +// deployed from within the account calling those APIs. func (c *Client) DescribeOrganizationConfigRules(ctx context.Context, params *DescribeOrganizationConfigRulesInput, optFns ...func(*Options)) (*DescribeOrganizationConfigRulesOutput, error) { if params == nil { params = &DescribeOrganizationConfigRulesInput{} diff --git a/service/configservice/api_op_DescribeOrganizationConformancePacks.go b/service/configservice/api_op_DescribeOrganizationConformancePacks.go index 600ead92f10..59600d555b0 100644 --- a/service/configservice/api_op_DescribeOrganizationConformancePacks.go +++ b/service/configservice/api_op_DescribeOrganizationConformancePacks.go @@ -15,7 +15,18 @@ import ( // Returns a list of organization conformance packs. When you specify the limit and // the next token, you receive a paginated response. Limit and next token are not // applicable if you specify organization conformance packs names. They are only -// applicable, when you request all the organization conformance packs. +// applicable, when you request all the organization conformance packs. For +// accounts within an organzation If you deploy an organizational rule or +// conformance pack in an organization administrator account, and then establish a +// delegated administrator and deploy an organizational rule or conformance pack in +// the delegated administrator account, you won't be able to see the organizational +// rule or conformance pack in the organization administrator account from the +// delegated administrator account or see the organizational rule or conformance +// pack in the delegated administrator account from organization administrator +// account. The DescribeOrganizationConfigRules and +// DescribeOrganizationConformancePacks APIs can only see and interact with the +// organization-related resource that were deployed from within the account calling +// those APIs. func (c *Client) DescribeOrganizationConformancePacks(ctx context.Context, params *DescribeOrganizationConformancePacksInput, optFns ...func(*Options)) (*DescribeOrganizationConformancePacksOutput, error) { if params == nil { params = &DescribeOrganizationConformancePacksInput{} diff --git a/service/configservice/api_op_PutOrganizationConformancePack.go b/service/configservice/api_op_PutOrganizationConformancePack.go index 3fa68553132..32cfb538758 100644 --- a/service/configservice/api_op_PutOrganizationConformancePack.go +++ b/service/configservice/api_op_PutOrganizationConformancePack.go @@ -12,9 +12,13 @@ import ( ) // Deploys conformance packs across member accounts in an Amazon Web Services -// Organization. Only a master account and a delegated administrator can call this -// API. When calling this API with a delegated administrator, you must ensure -// Organizations ListDelegatedAdministrator permissions are added. This API enables +// Organization. For information on how many organization conformance packs and how +// many Config rules you can have per account, see Service Limits +// (https://docs.aws.amazon.com/config/latest/developerguide/configlimits.html) in +// the Config Developer Guide. Only a master account and a delegated administrator +// can call this API. When calling this API with a delegated administrator, you +// must ensure Organizations ListDelegatedAdministrator permissions are added. An +// organization can have up to 3 delegated administrators. This API enables // organization service access for config-multiaccountsetup.amazonaws.com through // the EnableAWSServiceAccess action and creates a service linked role // AWSServiceRoleForConfigMultiAccountSetup in the master or delegated @@ -30,9 +34,7 @@ import ( // CREATE_IN_PROGRESS and UPDATE_IN_PROGRESS until the conformance pack is created // or updated. // -// You cannot update a conformance pack while it is in this state. You -// can create 50 conformance packs with 25 Config rules in each pack and 3 -// delegated administrator per organization. +// You cannot update a conformance pack while it is in this state. func (c *Client) PutOrganizationConformancePack(ctx context.Context, params *PutOrganizationConformancePackInput, optFns ...func(*Options)) (*PutOrganizationConformancePackOutput, error) { if params == nil { params = &PutOrganizationConformancePackInput{} diff --git a/service/configservice/api_op_PutRemediationConfigurations.go b/service/configservice/api_op_PutRemediationConfigurations.go index da092a37218..d486bcb5aef 100644 --- a/service/configservice/api_op_PutRemediationConfigurations.go +++ b/service/configservice/api_op_PutRemediationConfigurations.go @@ -19,7 +19,13 @@ import ( // SSM document, you must call this again to ensure the remediations can run. This // API does not support adding remediation configurations for service-linked Config // Rules such as Organization Config rules, the rules deployed by conformance -// packs, and rules deployed by Amazon Web Services Security Hub. +// packs, and rules deployed by Amazon Web Services Security Hub. For manual +// remediation configuration, you need to provide a value for automationAssumeRole +// or use a value in the assumeRolefield to remediate your resources. The SSM +// automation document can use either as long as it maps to a valid parameter. +// However, for automatic remediation configuration, the only valid assumeRole +// field value is AutomationAssumeRole and you need to provide a value for +// AutomationAssumeRole to remediate your resources. func (c *Client) PutRemediationConfigurations(ctx context.Context, params *PutRemediationConfigurationsInput, optFns ...func(*Options)) (*PutRemediationConfigurationsOutput, error) { if params == nil { params = &PutRemediationConfigurationsInput{} diff --git a/service/configservice/api_op_PutResourceConfig.go b/service/configservice/api_op_PutResourceConfig.go index ce826ed877b..178bfa26e6c 100644 --- a/service/configservice/api_op_PutResourceConfig.go +++ b/service/configservice/api_op_PutResourceConfig.go @@ -65,7 +65,10 @@ type PutResourceConfigInput struct { // Name of the resource. ResourceName *string - // Tags associated with the resource. + // Tags associated with the resource. This field is not to be confused with the + // Amazon Web Services-wide tag feature for Amazon Web Services resources. Tags for + // PutResourceConfig are tags that you supply for the configuration items of your + // custom resources. Tags map[string]string noSmithyDocumentSerde diff --git a/service/configservice/types/types.go b/service/configservice/types/types.go index 1a3f3d48dba..0acc0e82833 100644 --- a/service/configservice/types/types.go +++ b/service/configservice/types/types.go @@ -543,7 +543,7 @@ type ConfigRule struct { // The maximum frequency with which Config runs evaluations for a rule. You can // specify a value for MaximumExecutionFrequency when: // - // * You are using an Config + // * This is for an Config // managed rule that is triggered at a periodic frequency. // // * Your custom rule is @@ -868,7 +868,9 @@ type ConfigurationRecorder struct { RecordingGroup *RecordingGroup // Amazon Resource Name (ARN) of the IAM role used to describe the Amazon Web - // Services resources associated with the account. + // Services resources associated with the account. While the API model does not + // require this field, the server will reject a request without a defined roleARN + // for the configuration recorder. RoleARN *string noSmithyDocumentSerde @@ -1994,11 +1996,10 @@ type OrganizationManagedRuleMetadata struct { // function. InputParameters *string - // The maximum frequency with which Config runs evaluations for a rule. You are - // using an Config managed rule that is triggered at a periodic frequency. By - // default, rules with a periodic trigger are evaluated every 24 hours. To change - // the frequency, specify a valid value for the MaximumExecutionFrequency - // parameter. + // The maximum frequency with which Config runs evaluations for a rule. This is for + // an Config managed rule that is triggered at a periodic frequency. By default, + // rules with a periodic trigger are evaluated every 24 hours. To change the + // frequency, specify a valid value for the MaximumExecutionFrequency parameter. MaximumExecutionFrequency MaximumExecutionFrequency // The ID of the Amazon Web Services resource that was evaluated. diff --git a/service/lexmodelsv2/api_op_CreateExport.go b/service/lexmodelsv2/api_op_CreateExport.go index 1ceb103bec9..85d584aa63e 100644 --- a/service/lexmodelsv2/api_op_CreateExport.go +++ b/service/lexmodelsv2/api_op_CreateExport.go @@ -64,8 +64,9 @@ type CreateExportOutput struct { ExportId *string // The status of the export. When the status is Completed, you can use the - // DescribeExport (https://docs.aws.amazon.com/latest/dg/API_DescribeExport.html) - // operation to get the pre-signed S3 URL link to your exported bot or bot locale. + // DescribeExport + // (https://docs.aws.amazon.com/lexv2/latest/dg/API_DescribeExport.html) operation + // to get the pre-signed S3 URL link to your exported bot or bot locale. ExportStatus types.ExportStatus // The file format used for the bot or bot locale definition files. diff --git a/service/lexmodelsv2/deserializers.go b/service/lexmodelsv2/deserializers.go index f1d75d1732a..ff2e83fb2fc 100644 --- a/service/lexmodelsv2/deserializers.go +++ b/service/lexmodelsv2/deserializers.go @@ -18421,6 +18421,15 @@ func awsRestjson1_deserializeDocumentPromptSpecification(v **types.PromptSpecifi return err } + case "messageSelectionStrategy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected MessageSelectionStrategy to be of type string, got %T instead", value) + } + sv.MessageSelectionStrategy = types.MessageSelectionStrategy(jtv) + } + default: _, _ = key, value diff --git a/service/lexmodelsv2/serializers.go b/service/lexmodelsv2/serializers.go index 3fe5b9f54ce..46569c61d57 100644 --- a/service/lexmodelsv2/serializers.go +++ b/service/lexmodelsv2/serializers.go @@ -7685,6 +7685,11 @@ func awsRestjson1_serializeDocumentPromptSpecification(v *types.PromptSpecificat } } + if len(v.MessageSelectionStrategy) > 0 { + ok := object.Key("messageSelectionStrategy") + ok.String(string(v.MessageSelectionStrategy)) + } + return nil } diff --git a/service/lexmodelsv2/types/enums.go b/service/lexmodelsv2/types/enums.go index 77c70d4f843..f47cece85b0 100644 --- a/service/lexmodelsv2/types/enums.go +++ b/service/lexmodelsv2/types/enums.go @@ -646,6 +646,24 @@ func (MergeStrategy) Values() []MergeStrategy { } } +type MessageSelectionStrategy string + +// Enum values for MessageSelectionStrategy +const ( + MessageSelectionStrategyRandom MessageSelectionStrategy = "Random" + MessageSelectionStrategyOrdered MessageSelectionStrategy = "Ordered" +) + +// Values returns all known values for MessageSelectionStrategy. 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 (MessageSelectionStrategy) Values() []MessageSelectionStrategy { + return []MessageSelectionStrategy{ + "Random", + "Ordered", + } +} + type ObfuscationSettingType string // Enum values for ObfuscationSettingType diff --git a/service/lexmodelsv2/types/types.go b/service/lexmodelsv2/types/types.go index aed373523d3..803a55960c8 100644 --- a/service/lexmodelsv2/types/types.go +++ b/service/lexmodelsv2/types/types.go @@ -99,7 +99,7 @@ type AssociatedTranscript struct { // The content of the transcript that meets the search filter criteria. For the // JSON format of the transcript, see Output transcript format - // (https://docs.aws.amazon.com/lex/latest/dg/designing-output-format.html). + // (https://docs.aws.amazon.com/lexv2/latest/dg/designing-output-format.html). Transcript *string noSmithyDocumentSerde @@ -451,7 +451,7 @@ type BotLocaleSummary struct { } // The object representing the URL of the bot definition, the URL of the associated -// transcript and a statistical summary of the bot recommendation results. +// transcript, and a statistical summary of the bot recommendation results. type BotRecommendationResults struct { // The presigned url link of the associated transcript. @@ -1551,6 +1551,9 @@ type PromptSpecification struct { // Indicates whether the user can interrupt a speech prompt from the bot. AllowInterrupt *bool + // Indicates how a message is selected from a message group among retries. + MessageSelectionStrategy MessageSelectionStrategy + noSmithyDocumentSerde } diff --git a/service/quicksight/api_op_CreateAccountCustomization.go b/service/quicksight/api_op_CreateAccountCustomization.go index f6da74b7709..1282e5016f1 100644 --- a/service/quicksight/api_op_CreateAccountCustomization.go +++ b/service/quicksight/api_op_CreateAccountCustomization.go @@ -11,8 +11,8 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Creates Amazon QuickSight customizations the current Amazon Web Services Region. -// Currently, you can add a custom default theme by using the +// Creates Amazon QuickSight customizations for the current Amazon Web Services +// Region. Currently, you can add a custom default theme by using the // CreateAccountCustomization or UpdateAccountCustomization API operation. To // further customize Amazon QuickSight by removing Amazon QuickSight sample assets // and videos for all new users, see Customizing Amazon QuickSight diff --git a/service/quicksight/api_op_CreateAccountSubscription.go b/service/quicksight/api_op_CreateAccountSubscription.go new file mode 100644 index 00000000000..aaf1f181b88 --- /dev/null +++ b/service/quicksight/api_op_CreateAccountSubscription.go @@ -0,0 +1,246 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package quicksight + +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/quicksight/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Amazon QuickSight account, or subscribes to Amazon QuickSight Q. The +// Amazon Web Services Region for the account is derived from what is configured in +// the CLI or SDK. This operation isn't supported in the US East (Ohio) Region, +// South America (Sao Paulo) Region, or Asia Pacific (Singapore) Region. Before you +// use this operation, make sure that you can connect to an existing Amazon Web +// Services account. If you don't have an Amazon Web Services account, see Sign up +// for Amazon Web Services +// (https://docs.aws.amazon.com/quicksight/latest/user/setting-up-aws-sign-up.html) +// in the Amazon QuickSight User Guide. The person who signs up for Amazon +// QuickSight needs to have the correct Identity and Access Management (IAM) +// permissions. For more information, see IAM Policy Examples for Amazon QuickSight +// (https://docs.aws.amazon.com/quicksight/latest/user/iam-policy-examples.html) in +// the Amazon QuickSight User Guide. If your IAM policy includes both the Subscribe +// and CreateAccountSubscription actions, make sure that both actions are set to +// Allow. If either action is set to Deny, the Deny action prevails and your API +// call fails. You can't pass an existing IAM role to access other Amazon Web +// Services services using this API operation. To pass your existing IAM role to +// Amazon QuickSight, see Passing IAM roles to Amazon QuickSight +// (https://docs.aws.amazon.com/quicksight/latest/user/security_iam_service-with-iam.html#security-create-iam-role) +// in the Amazon QuickSight User Guide. You can't set default resource access on +// the new account from the Amazon QuickSight API. Instead, add default resource +// access from the Amazon QuickSight console. For more information about setting +// default resource access to Amazon Web Services services, see Setting default +// resource access to Amazon Web Services services +// (https://docs.aws.amazon.com/quicksight/latest/user/scoping-policies-defaults.html) +// in the Amazon QuickSight User Guide. +func (c *Client) CreateAccountSubscription(ctx context.Context, params *CreateAccountSubscriptionInput, optFns ...func(*Options)) (*CreateAccountSubscriptionOutput, error) { + if params == nil { + params = &CreateAccountSubscriptionInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateAccountSubscription", params, optFns, c.addOperationCreateAccountSubscriptionMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateAccountSubscriptionOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateAccountSubscriptionInput struct { + + // The name of your Amazon QuickSight account. This name is unique over all of + // Amazon Web Services, and it appears only when users sign in. You can't change + // AccountName value after the Amazon QuickSight account is created. + // + // This member is required. + AccountName *string + + // The method that you want to use to authenticate your Amazon QuickSight account. + // Currently, the valid values for this parameter are IAM_AND_QUICKSIGHT, IAM_ONLY, + // and ACTIVE_DIRECTORY. If you choose ACTIVE_DIRECTORY, provide an + // ActiveDirectoryName and an AdminGroup associated with your Active Directory. + // + // This member is required. + AuthenticationMethod types.AuthenticationMethodOption + + // The Amazon Web Services account ID of the account that you're using to create + // your Amazon QuickSight account. + // + // This member is required. + AwsAccountId *string + + // The edition of Amazon QuickSight that you want your account to have. Currently, + // you can choose from ENTERPRISE or ENTERPRISE_AND_Q. If you choose + // ENTERPRISE_AND_Q, the following parameters are required: + // + // * FirstName + // + // * + // LastName + // + // * EmailAddress + // + // * ContactNumber + // + // This member is required. + Edition types.Edition + + // The email address that you want Amazon QuickSight to send notifications to + // regarding your Amazon QuickSight account or Amazon QuickSight subscription. + // + // This member is required. + NotificationEmail *string + + // The name of your Active Directory. This field is required if ACTIVE_DIRECTORY is + // the selected authentication method of the new Amazon QuickSight account. + ActiveDirectoryName *string + + // The admin group associated with your Active Directory. This field is required if + // ACTIVE_DIRECTORY is the selected authentication method of the new Amazon + // QuickSight account. For more information about using Active Directory in Amazon + // QuickSight, see Using Active Directory with Amazon QuickSight Enterprise Edition + // (https://docs.aws.amazon.com/quicksight/latest/user/aws-directory-service.html) + // in the Amazon QuickSight User Guide. + AdminGroup []string + + // The author group associated with your Active Directory. For more information + // about using Active Directory in Amazon QuickSight, see Using Active Directory + // with Amazon QuickSight Enterprise Edition + // (https://docs.aws.amazon.com/quicksight/latest/user/aws-directory-service.html) + // in the Amazon QuickSight User Guide. + AuthorGroup []string + + // A 10-digit phone number for the author of the Amazon QuickSight account to use + // for future communications. This field is required if ENTERPPRISE_AND_Q is the + // selected edition of the new Amazon QuickSight account. + ContactNumber *string + + // The ID of the Active Directory that is associated with your Amazon QuickSight + // account. + DirectoryId *string + + // The email address of the author of the Amazon QuickSight account to use for + // future communications. This field is required if ENTERPPRISE_AND_Q is the + // selected edition of the new Amazon QuickSight account. + EmailAddress *string + + // The first name of the author of the Amazon QuickSight account to use for future + // communications. This field is required if ENTERPPRISE_AND_Q is the selected + // edition of the new Amazon QuickSight account. + FirstName *string + + // The last name of the author of the Amazon QuickSight account to use for future + // communications. This field is required if ENTERPPRISE_AND_Q is the selected + // edition of the new Amazon QuickSight account. + LastName *string + + // The reader group associated with your Active Direcrtory. For more information + // about using Active Directory in Amazon QuickSight, see Using Active Directory + // with Amazon QuickSight Enterprise Edition + // (https://docs.aws.amazon.com/quicksight/latest/user/aws-directory-service.html) + // in the Amazon QuickSight User Guide. + ReaderGroup []string + + // The realm of the Active Directory that is associated with your Amazon QuickSight + // account. This field is required if ACTIVE_DIRECTORY is the selected + // authentication method of the new Amazon QuickSight account. + Realm *string + + noSmithyDocumentSerde +} + +type CreateAccountSubscriptionOutput struct { + + // The Amazon Web Services request ID for this operation. + RequestId *string + + // A SignupResponse object that returns information about a newly created Amazon + // QuickSight account. + SignupResponse *types.SignupResponse + + // The HTTP status of the request. + Status int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateAccountSubscriptionMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateAccountSubscription{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateAccountSubscription{}, 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 = addOpCreateAccountSubscriptionValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAccountSubscription(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_opCreateAccountSubscription(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "quicksight", + OperationName: "CreateAccountSubscription", + } +} diff --git a/service/quicksight/api_op_DescribeAccountSubscription.go b/service/quicksight/api_op_DescribeAccountSubscription.go new file mode 100644 index 00000000000..b8066a33b8e --- /dev/null +++ b/service/quicksight/api_op_DescribeAccountSubscription.go @@ -0,0 +1,145 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package quicksight + +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/quicksight/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Use the DescribeAccountSubscription operation to receive a description of a +// Amazon QuickSight account's subscription. A successful API call returns an +// AccountInfo object that includes an account's name, subscription status, +// authentication type, edition, and notification email address. +func (c *Client) DescribeAccountSubscription(ctx context.Context, params *DescribeAccountSubscriptionInput, optFns ...func(*Options)) (*DescribeAccountSubscriptionOutput, error) { + if params == nil { + params = &DescribeAccountSubscriptionInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DescribeAccountSubscription", params, optFns, c.addOperationDescribeAccountSubscriptionMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DescribeAccountSubscriptionOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DescribeAccountSubscriptionInput struct { + + // The Amazon Web Services account ID associated with your Amazon QuickSight + // account. + // + // This member is required. + AwsAccountId *string + + noSmithyDocumentSerde +} + +type DescribeAccountSubscriptionOutput struct { + + // A structure that contains the following elements: + // + // * Your Amazon QuickSight + // account name. + // + // * The edition of Amazon QuickSight that your account is using. + // + // * + // The notification email address that is associated with the Amazon QuickSight + // account. + // + // * The authentication type of the Amazon QuickSight account. + // + // * The + // status of the Amazon QuickSight account's subscription. + AccountInfo *types.AccountInfo + + // The Amazon Web Services request ID for this operation. + RequestId *string + + // The HTTP status of the request. + Status int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDescribeAccountSubscriptionMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDescribeAccountSubscription{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDescribeAccountSubscription{}, 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 = addOpDescribeAccountSubscriptionValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeAccountSubscription(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_opDescribeAccountSubscription(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "quicksight", + OperationName: "DescribeAccountSubscription", + } +} diff --git a/service/quicksight/api_op_GenerateEmbedUrlForAnonymousUser.go b/service/quicksight/api_op_GenerateEmbedUrlForAnonymousUser.go index b5121ccab24..f4e840f5300 100644 --- a/service/quicksight/api_op_GenerateEmbedUrlForAnonymousUser.go +++ b/service/quicksight/api_op_GenerateEmbedUrlForAnonymousUser.go @@ -54,11 +54,11 @@ func (c *Client) GenerateEmbedUrlForAnonymousUser(ctx context.Context, params *G type GenerateEmbedUrlForAnonymousUserInput struct { - // The Amazon Resource Names for the Amazon QuickSight resources that the user is - // authorized to access during the lifetime of the session. If you choose Dashboard - // embedding experience, pass the list of dashboard ARNs in the account that you - // want the user to be able to view. Currently, you can pass up to 25 dashboard - // ARNs in each API call. + // The Amazon Resource Names (ARNs) for the Amazon QuickSight resources that the + // user is authorized to access during the lifetime of the session. If you choose + // Dashboard embedding experience, pass the list of dashboard ARNs in the account + // that you want the user to be able to view. Currently, you can pass up to 25 + // dashboard ARNs in each API call. // // This member is required. AuthorizedResourceArns []string @@ -69,7 +69,7 @@ type GenerateEmbedUrlForAnonymousUserInput struct { // This member is required. AwsAccountId *string - // The configuration of the experience you are embedding. + // The configuration of the experience that you are embedding. // // This member is required. ExperienceConfiguration *types.AnonymousUserEmbeddingExperienceConfiguration @@ -80,6 +80,16 @@ type GenerateEmbedUrlForAnonymousUserInput struct { // This member is required. Namespace *string + // The domains that you want to add to the allow list for access to the generated + // URL that is then embedded. This optional parameter overrides the static domains + // that are configured in the Manage QuickSight menu in the Amazon QuickSight + // console and instead allows only the domains that you include in this parameter. + // You can list up to three domains or subdomains in each API call. To include a + // subdomain, use * to include all subdomains under a specific domain to the allow + // list. For example, https://*.sapp.amazon.com, includes all subdomains under + // https://sapp.amazon.com. + AllowedDomains []string + // How many minutes the session is valid. The session lifetime must be in [15-600] // minutes range. SessionLifetimeInMinutes *int64 @@ -90,7 +100,8 @@ type GenerateEmbedUrlForAnonymousUserInput struct { // used to provide row-level security. These are not the tags used for the Amazon // Web Services resource tagging feature. For more information, see Using Row-Level // Security (RLS) with Tags - // (https://docs.aws.amazon.com/quicksight/latest/user/quicksight-dev-rls-tags.html). + // (https://docs.aws.amazon.com/quicksight/latest/user/quicksight-dev-rls-tags.html)in + // the Amazon QuickSight User Guide. SessionTags []types.SessionTag noSmithyDocumentSerde diff --git a/service/quicksight/api_op_GenerateEmbedUrlForRegisteredUser.go b/service/quicksight/api_op_GenerateEmbedUrlForRegisteredUser.go index 49baf0ecf43..7587b915d83 100644 --- a/service/quicksight/api_op_GenerateEmbedUrlForRegisteredUser.go +++ b/service/quicksight/api_op_GenerateEmbedUrlForRegisteredUser.go @@ -72,6 +72,16 @@ type GenerateEmbedUrlForRegisteredUserInput struct { // This member is required. UserArn *string + // The domains that you want to add to the allow list for access to the generated + // URL that is then embedded. This optional parameter overrides the static domains + // that are configured in the Manage QuickSight menu in the Amazon QuickSight + // console and instead allows only the domains that you include in this parameter. + // You can list up to three domains or subdomains in each API call. To include a + // subdomain, use * to include all subdomains under a specific domain to the allow + // list. For example, https://*.sapp.amazon.com, includes all subdomains under + // https://sapp.amazon.com. + AllowedDomains []string + // How many minutes the session is valid. The session lifetime must be in [15-600] // minutes range. SessionLifetimeInMinutes *int64 diff --git a/service/quicksight/api_op_GetDashboardEmbedUrl.go b/service/quicksight/api_op_GetDashboardEmbedUrl.go index 9b4b096c114..228b2997ce9 100644 --- a/service/quicksight/api_op_GetDashboardEmbedUrl.go +++ b/service/quicksight/api_op_GetDashboardEmbedUrl.go @@ -11,25 +11,27 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Generates a session URL and authorization code that you can use to embed an -// Amazon Amazon QuickSight read-only dashboard in your web server code. Before you -// use this command, make sure that you have configured the dashboards and -// permissions. Currently, you can use GetDashboardEmbedURL only from the server, -// not from the user's browser. The following rules apply to the combination of URL -// and authorization code: +// Generates a temporary session URL and authorization code that you can use to +// embed an Amazon QuickSight read-only dashboard in your website or application. +// Before you use this command, make sure that you have configured the dashboards +// and permissions. Currently, you can use GetDashboardEmbedURL only from the +// server, not from the user's browser. The following rules apply to the generated +// URL: // // * They must be used together. // -// * They can be used one -// time only. +// * They can be used one time only. // -// * They are valid for 5 minutes after you run this command. +// * They +// are valid for 5 minutes after you run this command. // -// * The -// resulting user session is valid for 10 hours. +// * The resulting user +// session is valid for 15 minutes (default) up to 10 hours (maximum). You can use +// the optional SessionLifetimeInMinutes parameter to customi session +// duration. // -// For more information, see -// Embedding Analytics Using GetDashboardEmbedUrl +// For more information, see Embedding Analytics Using +// GetDashboardEmbedUrl // (https://docs.aws.amazon.com/quicksight/latest/user/embedded-analytics-deprecated.html) // in the Amazon QuickSight User Guide. For more information about the high-level // steps for embedding and for an interactive demo of the ways you can customize @@ -69,12 +71,11 @@ type GetDashboardEmbedUrlInput struct { // This member is required. IdentityType types.EmbeddingIdentityType - // A list of one or more dashboard IDs that you want to add to a session that - // includes anonymous users. The IdentityType parameter must be set to ANONYMOUS - // for this to work, because other identity types authenticate as Amazon QuickSight - // or IAM users. For example, if you set "--dashboard-id dash_id1 --dashboard-id - // dash_id2 dash_id3 identity-type ANONYMOUS", the session can access all three - // dashboards. + // A list of one or more dashboard IDs that you want anonymous users to have + // tempporary access to. Currently, the IdentityType parameter must be set to + // ANONYMOUS because other identity types authenticate as Amazon QuickSight or IAM + // users. For example, if you set "--dashboard-id dash_id1 --dashboard-id dash_id2 + // dash_id3 identity-type ANONYMOUS", the session can access all three dashboards. AdditionalDashboardIds []string // The Amazon QuickSight namespace that contains the dashboard IDs in this request. diff --git a/service/quicksight/api_op_UpdateAccountCustomization.go b/service/quicksight/api_op_UpdateAccountCustomization.go index 595a3e24392..18c015f26b9 100644 --- a/service/quicksight/api_op_UpdateAccountCustomization.go +++ b/service/quicksight/api_op_UpdateAccountCustomization.go @@ -11,9 +11,9 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Updates Amazon QuickSight customizations the current Amazon Web Services Region. -// Currently, the only customization you can use is a theme. You can use -// customizations for your Amazon Web Services account or, if you specify a +// Updates Amazon QuickSight customizations for the current Amazon Web Services +// Region. Currently, the only customization that you can use is a theme. You can +// use customizations for your Amazon Web Services account or, if you specify a // namespace, for a Amazon QuickSight namespace instead. Customizations that apply // to a namespace override customizations that apply to an Amazon Web Services // account. To find out which customizations apply, use the diff --git a/service/quicksight/api_op_UpdateAccountSettings.go b/service/quicksight/api_op_UpdateAccountSettings.go index a3df4f974fe..a2357e55663 100644 --- a/service/quicksight/api_op_UpdateAccountSettings.go +++ b/service/quicksight/api_op_UpdateAccountSettings.go @@ -36,8 +36,8 @@ type UpdateAccountSettingsInput struct { // The default namespace for this Amazon Web Services account. Currently, the // default is default. Identity and Access Management (IAM) users that register for - // the first time with Amazon QuickSight provide an email that becomes associated - // with the default namespace. + // the first time with Amazon QuickSight provide an email address that becomes + // associated with the default namespace. // // This member is required. DefaultNamespace *string diff --git a/service/quicksight/api_op_UpdatePublicSharingSettings.go b/service/quicksight/api_op_UpdatePublicSharingSettings.go index 615a772a5ad..f3102ba7893 100644 --- a/service/quicksight/api_op_UpdatePublicSharingSettings.go +++ b/service/quicksight/api_op_UpdatePublicSharingSettings.go @@ -10,13 +10,15 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Use the UpdatePublicSharingSettings operation to enable or disable the public -// sharing settings of an Amazon QuickSight dashboard. To use this operation, -// enable session capacity pricing on your Amazon QuickSight account. Before you -// can enable public sharing on your account, you need to allow public sharing -// permissions to an administrative user in the IAM console. For more information -// on using IAM with Amazon QuickSight, see Using Amazon QuickSight with IAM -// (https://docs.aws.amazon.com/quicksight/latest/user/security_iam_service-with-iam.html). +// Use the UpdatePublicSharingSettings operation to turn on or turn off the public +// sharing settings of an Amazon QuickSight dashboard. To use this operation, turn +// on session capacity pricing for your Amazon QuickSight account. Before you can +// turn on public sharing on your account, make sure to give public sharing +// permissions to an administrative user in the Identity and Access Management +// (IAM) console. For more information on using IAM with Amazon QuickSight, see +// Using Amazon QuickSight with IAM +// (https://docs.aws.amazon.com/quicksight/latest/user/security_iam_service-with-iam.html) +// in the Amazon QuickSight User Guide. func (c *Client) UpdatePublicSharingSettings(ctx context.Context, params *UpdatePublicSharingSettingsInput, optFns ...func(*Options)) (*UpdatePublicSharingSettingsOutput, error) { if params == nil { params = &UpdatePublicSharingSettingsInput{} @@ -40,7 +42,7 @@ type UpdatePublicSharingSettingsInput struct { // This member is required. AwsAccountId *string - // A boolean that indicates whether or not public sharing is enabled on a Amazon + // A Boolean value that indicates whether public sharing is turned on for an Amazon // QuickSight account. PublicSharingEnabled bool diff --git a/service/quicksight/deserializers.go b/service/quicksight/deserializers.go index 2ff962e2b19..b7f67f1689c 100644 --- a/service/quicksight/deserializers.go +++ b/service/quicksight/deserializers.go @@ -435,6 +435,200 @@ func awsRestjson1_deserializeOpDocumentCreateAccountCustomizationOutput(v **Crea return nil } +type awsRestjson1_deserializeOpCreateAccountSubscription struct { +} + +func (*awsRestjson1_deserializeOpCreateAccountSubscription) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateAccountSubscription) 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_deserializeOpErrorCreateAccountSubscription(response, &metadata) + } + output := &CreateAccountSubscriptionOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsCreateAccountSubscriptionOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + + 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_deserializeOpDocumentCreateAccountSubscriptionOutput(&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_deserializeOpErrorCreateAccountSubscription(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("InternalFailureException", errorCode): + return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) + + case strings.EqualFold("InvalidParameterValueException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) + + case strings.EqualFold("PreconditionNotMetException", errorCode): + return awsRestjson1_deserializeErrorPreconditionNotMetException(response, errorBody) + + case strings.EqualFold("ResourceExistsException", errorCode): + return awsRestjson1_deserializeErrorResourceExistsException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ResourceUnavailableException", errorCode): + return awsRestjson1_deserializeErrorResourceUnavailableException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsCreateAccountSubscriptionOutput(v *CreateAccountSubscriptionOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + v.Status = int32(response.StatusCode) + + return nil +} +func awsRestjson1_deserializeOpDocumentCreateAccountSubscriptionOutput(v **CreateAccountSubscriptionOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateAccountSubscriptionOutput + if *v == nil { + sv = &CreateAccountSubscriptionOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "RequestId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.RequestId = ptr.String(jtv) + } + + case "SignupResponse": + if err := awsRestjson1_deserializeDocumentSignupResponse(&sv.SignupResponse, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpCreateAnalysis struct { } @@ -7263,6 +7457,191 @@ func awsRestjson1_deserializeOpDocumentDescribeAccountSettingsOutput(v **Describ return nil } +type awsRestjson1_deserializeOpDescribeAccountSubscription struct { +} + +func (*awsRestjson1_deserializeOpDescribeAccountSubscription) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDescribeAccountSubscription) 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_deserializeOpErrorDescribeAccountSubscription(response, &metadata) + } + output := &DescribeAccountSubscriptionOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsDescribeAccountSubscriptionOutput(output, response) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to decode response with invalid Http bindings, %w", err)} + } + + 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_deserializeOpDocumentDescribeAccountSubscriptionOutput(&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_deserializeOpErrorDescribeAccountSubscription(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("InternalFailureException", errorCode): + return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) + + case strings.EqualFold("InvalidParameterValueException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterValueException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ResourceUnavailableException", errorCode): + return awsRestjson1_deserializeErrorResourceUnavailableException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsDescribeAccountSubscriptionOutput(v *DescribeAccountSubscriptionOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + v.Status = int32(response.StatusCode) + + return nil +} +func awsRestjson1_deserializeOpDocumentDescribeAccountSubscriptionOutput(v **DescribeAccountSubscriptionOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DescribeAccountSubscriptionOutput + if *v == nil { + sv = &DescribeAccountSubscriptionOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AccountInfo": + if err := awsRestjson1_deserializeDocumentAccountInfo(&sv.AccountInfo, value); err != nil { + return err + } + + case "RequestId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.RequestId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpDescribeAnalysis struct { } @@ -24086,6 +24465,82 @@ func awsRestjson1_deserializeDocumentAccountCustomization(v **types.AccountCusto return nil } +func awsRestjson1_deserializeDocumentAccountInfo(v **types.AccountInfo, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AccountInfo + if *v == nil { + sv = &types.AccountInfo{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AccountName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AccountName = ptr.String(jtv) + } + + case "AccountSubscriptionStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AccountSubscriptionStatus = ptr.String(jtv) + } + + case "AuthenticationType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AuthenticationType = ptr.String(jtv) + } + + case "Edition": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Edition to be of type string, got %T instead", value) + } + sv.Edition = types.Edition(jtv) + } + + case "NotificationEmail": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.NotificationEmail = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentAccountSettings(v **types.AccountSettings, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -31792,6 +32247,73 @@ func awsRestjson1_deserializeDocumentSheetStyle(v **types.SheetStyle, value inte return nil } +func awsRestjson1_deserializeDocumentSignupResponse(v **types.SignupResponse, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SignupResponse + if *v == nil { + sv = &types.SignupResponse{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "accountName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.AccountName = ptr.String(jtv) + } + + case "directoryType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DirectoryType = ptr.String(jtv) + } + + case "IAMUser": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IAMUser = jtv + } + + case "userLoginName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.UserLoginName = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentSnowflakeParameters(v **types.SnowflakeParameters, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/quicksight/generated.json b/service/quicksight/generated.json index 54352443c12..ab4f262685e 100644 --- a/service/quicksight/generated.json +++ b/service/quicksight/generated.json @@ -10,6 +10,7 @@ "api_client_test.go", "api_op_CancelIngestion.go", "api_op_CreateAccountCustomization.go", + "api_op_CreateAccountSubscription.go", "api_op_CreateAnalysis.go", "api_op_CreateDashboard.go", "api_op_CreateDataSet.go", @@ -44,6 +45,7 @@ "api_op_DeleteUserByPrincipalId.go", "api_op_DescribeAccountCustomization.go", "api_op_DescribeAccountSettings.go", + "api_op_DescribeAccountSubscription.go", "api_op_DescribeAnalysis.go", "api_op_DescribeAnalysisPermissions.go", "api_op_DescribeDashboard.go", diff --git a/service/quicksight/serializers.go b/service/quicksight/serializers.go index 40c91657a69..ec4a50cba3d 100644 --- a/service/quicksight/serializers.go +++ b/service/quicksight/serializers.go @@ -187,6 +187,158 @@ func awsRestjson1_serializeOpDocumentCreateAccountCustomizationInput(v *CreateAc return nil } +type awsRestjson1_serializeOpCreateAccountSubscription struct { +} + +func (*awsRestjson1_serializeOpCreateAccountSubscription) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateAccountSubscription) 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.(*CreateAccountSubscriptionInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/account/{AwsAccountId}") + 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_serializeOpHttpBindingsCreateAccountSubscriptionInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateAccountSubscriptionInput(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_serializeOpHttpBindingsCreateAccountSubscriptionInput(v *CreateAccountSubscriptionInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AwsAccountId == nil || len(*v.AwsAccountId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member AwsAccountId must not be empty")} + } + if v.AwsAccountId != nil { + if err := encoder.SetURI("AwsAccountId").String(*v.AwsAccountId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateAccountSubscriptionInput(v *CreateAccountSubscriptionInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccountName != nil { + ok := object.Key("AccountName") + ok.String(*v.AccountName) + } + + if v.ActiveDirectoryName != nil { + ok := object.Key("ActiveDirectoryName") + ok.String(*v.ActiveDirectoryName) + } + + if v.AdminGroup != nil { + ok := object.Key("AdminGroup") + if err := awsRestjson1_serializeDocumentGroupsList(v.AdminGroup, ok); err != nil { + return err + } + } + + if len(v.AuthenticationMethod) > 0 { + ok := object.Key("AuthenticationMethod") + ok.String(string(v.AuthenticationMethod)) + } + + if v.AuthorGroup != nil { + ok := object.Key("AuthorGroup") + if err := awsRestjson1_serializeDocumentGroupsList(v.AuthorGroup, ok); err != nil { + return err + } + } + + if v.ContactNumber != nil { + ok := object.Key("ContactNumber") + ok.String(*v.ContactNumber) + } + + if v.DirectoryId != nil { + ok := object.Key("DirectoryId") + ok.String(*v.DirectoryId) + } + + if len(v.Edition) > 0 { + ok := object.Key("Edition") + ok.String(string(v.Edition)) + } + + if v.EmailAddress != nil { + ok := object.Key("EmailAddress") + ok.String(*v.EmailAddress) + } + + if v.FirstName != nil { + ok := object.Key("FirstName") + ok.String(*v.FirstName) + } + + if v.LastName != nil { + ok := object.Key("LastName") + ok.String(*v.LastName) + } + + if v.NotificationEmail != nil { + ok := object.Key("NotificationEmail") + ok.String(*v.NotificationEmail) + } + + if v.ReaderGroup != nil { + ok := object.Key("ReaderGroup") + if err := awsRestjson1_serializeDocumentGroupsList(v.ReaderGroup, ok); err != nil { + return err + } + } + + if v.Realm != nil { + ok := object.Key("Realm") + ok.String(*v.Realm) + } + + return nil +} + type awsRestjson1_serializeOpCreateAnalysis struct { } @@ -3220,6 +3372,64 @@ func awsRestjson1_serializeOpHttpBindingsDescribeAccountSettingsInput(v *Describ return nil } +type awsRestjson1_serializeOpDescribeAccountSubscription struct { +} + +func (*awsRestjson1_serializeOpDescribeAccountSubscription) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDescribeAccountSubscription) 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.(*DescribeAccountSubscriptionInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/account/{AwsAccountId}") + 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_serializeOpHttpBindingsDescribeAccountSubscriptionInput(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_serializeOpHttpBindingsDescribeAccountSubscriptionInput(v *DescribeAccountSubscriptionInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.AwsAccountId == nil || len(*v.AwsAccountId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member AwsAccountId must not be empty")} + } + if v.AwsAccountId != nil { + if err := encoder.SetURI("AwsAccountId").String(*v.AwsAccountId); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpDescribeAnalysis struct { } @@ -4988,6 +5198,13 @@ func awsRestjson1_serializeOpDocumentGenerateEmbedUrlForAnonymousUserInput(v *Ge object := value.Object() defer object.Close() + if v.AllowedDomains != nil { + ok := object.Key("AllowedDomains") + if err := awsRestjson1_serializeDocumentStringList(v.AllowedDomains, ok); err != nil { + return err + } + } + if v.AuthorizedResourceArns != nil { ok := object.Key("AuthorizedResourceArns") if err := awsRestjson1_serializeDocumentArnList(v.AuthorizedResourceArns, ok); err != nil { @@ -5095,6 +5312,13 @@ func awsRestjson1_serializeOpDocumentGenerateEmbedUrlForRegisteredUserInput(v *G object := value.Object() defer object.Close() + if v.AllowedDomains != nil { + ok := object.Key("AllowedDomains") + if err := awsRestjson1_serializeDocumentStringList(v.AllowedDomains, ok); err != nil { + return err + } + } + if v.ExperienceConfiguration != nil { ok := object.Key("ExperienceConfiguration") if err := awsRestjson1_serializeDocumentRegisteredUserEmbeddingExperienceConfiguration(v.ExperienceConfiguration, ok); err != nil { @@ -11226,6 +11450,17 @@ func awsRestjson1_serializeDocumentGroupSearchFilterList(v []types.GroupSearchFi return nil } +func awsRestjson1_serializeDocumentGroupsList(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + func awsRestjson1_serializeDocumentGutterStyle(v *types.GutterStyle, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/quicksight/types/enums.go b/service/quicksight/types/enums.go index ab2dbf1e97c..d933215e5da 100644 --- a/service/quicksight/types/enums.go +++ b/service/quicksight/types/enums.go @@ -72,6 +72,26 @@ func (AssignmentStatus) Values() []AssignmentStatus { } } +type AuthenticationMethodOption string + +// Enum values for AuthenticationMethodOption +const ( + AuthenticationMethodOptionIamAndQuicksight AuthenticationMethodOption = "IAM_AND_QUICKSIGHT" + AuthenticationMethodOptionIamOnly AuthenticationMethodOption = "IAM_ONLY" + AuthenticationMethodOptionActiveDirectory AuthenticationMethodOption = "ACTIVE_DIRECTORY" +) + +// Values returns all known values for AuthenticationMethodOption. 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 (AuthenticationMethodOption) Values() []AuthenticationMethodOption { + return []AuthenticationMethodOption{ + "IAM_AND_QUICKSIGHT", + "IAM_ONLY", + "ACTIVE_DIRECTORY", + } +} + type ColumnDataType string // Enum values for ColumnDataType @@ -314,8 +334,9 @@ type Edition string // Enum values for Edition const ( - EditionStandard Edition = "STANDARD" - EditionEnterprise Edition = "ENTERPRISE" + EditionStandard Edition = "STANDARD" + EditionEnterprise Edition = "ENTERPRISE" + EditionEnterpriseAndQ Edition = "ENTERPRISE_AND_Q" ) // Values returns all known values for Edition. Note that this can be expanded in @@ -325,6 +346,7 @@ func (Edition) Values() []Edition { return []Edition{ "STANDARD", "ENTERPRISE", + "ENTERPRISE_AND_Q", } } diff --git a/service/quicksight/types/types.go b/service/quicksight/types/types.go index d9448e37202..e9a163077f3 100644 --- a/service/quicksight/types/types.go +++ b/service/quicksight/types/types.go @@ -20,6 +20,45 @@ type AccountCustomization struct { noSmithyDocumentSerde } +// A structure that contains the following account information elements: +// +// * Your +// Amazon QuickSight account name. +// +// * The edition of Amazon QuickSight that your +// account is using. +// +// * The notification email address that is associated with the +// Amazon QuickSight account. +// +// * The authentication type of the Amazon QuickSight +// account. +// +// * The status of the Amazon QuickSight account's subscription. +type AccountInfo struct { + + // The account name that you provided for the Amazon QuickSight subscription in + // your Amazon Web Services account. You create this name when you sign up for + // Amazon QuickSight. It's unique over all of Amazon Web Services, and it appears + // only when users sign in. + AccountName *string + + // The status of your account subscription. + AccountSubscriptionStatus *string + + // The way that your Amazon QuickSight account is authenticated. + AuthenticationType *string + + // The edition of your Amazon QuickSight account. + Edition Edition + + // The email address that will be used for Amazon QuickSight to send notifications + // regarding your Amazon Web Services account or Amazon QuickSight subscription. + NotificationEmail *string + + noSmithyDocumentSerde +} + // The Amazon QuickSight settings associated with your Amazon Web Services account. type AccountSettings struct { @@ -39,8 +78,8 @@ type AccountSettings struct { // The main notification email for your Amazon QuickSight subscription. NotificationEmail *string - // A boolean that indicates whether or not public sharing is enabled on an Amazon - // QuickSight account. For more information about enabling public sharing, see + // A Boolean value that indicates whether public sharing is turned on for an Amazon + // QuickSight account. For more information about turning on public sharing, see // UpdatePublicSharingSettings // (https://docs.aws.amazon.com/quicksight/latest/APIReference/API_UpdatePublicSharingSettings.html). PublicSharingEnabled bool @@ -60,7 +99,7 @@ type ActiveIAMPolicyAssignment struct { noSmithyDocumentSerde } -// Ad hoc (one-time) filtering option. +// An ad hoc (one-time) filtering option. type AdHocFilteringOption struct { // Availability status. @@ -1990,7 +2029,8 @@ type RegisteredUserEmbeddingExperienceConfiguration struct { // The configuration details for embedding the Q search bar. For more information // about embedding the Q search bar, see Embedding Overview - // (https://docs.aws.amazon.com/quicksight/latest/user/embedding-overview.html). + // (https://docs.aws.amazon.com/quicksight/latest/user/embedding-overview.html) in + // the Amazon QuickSight User Guide. QSearchBar *RegisteredUserQSearchBarEmbeddingConfiguration // The configuration details for providing each Amazon QuickSight console embedding @@ -2331,6 +2371,26 @@ type SheetStyle struct { noSmithyDocumentSerde } +// A SignupResponse object that contains a summary of a newly created account. +type SignupResponse struct { + + // The name of your Amazon QuickSight account. + AccountName *string + + // The type of Active Directory that is being used to authenticate the Amazon + // QuickSight account. Valid values are SIMPLE_AD, AD_CONNECTOR, and MICROSOFT_AD. + DirectoryType *string + + // A Boolean that is TRUE if the Amazon QuickSight uses IAM as an authentication + // method. + IAMUser bool + + // The user login name for your Amazon QuickSight account. + UserLoginName *string + + noSmithyDocumentSerde +} + // The parameters for Snowflake. type SnowflakeParameters struct { diff --git a/service/quicksight/validators.go b/service/quicksight/validators.go index 46f6d187be4..0953a9e4a42 100644 --- a/service/quicksight/validators.go +++ b/service/quicksight/validators.go @@ -50,6 +50,26 @@ func (m *validateOpCreateAccountCustomization) HandleInitialize(ctx context.Cont return next.HandleInitialize(ctx, in) } +type validateOpCreateAccountSubscription struct { +} + +func (*validateOpCreateAccountSubscription) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateAccountSubscription) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateAccountSubscriptionInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateAccountSubscriptionInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpCreateAnalysis struct { } @@ -730,6 +750,26 @@ func (m *validateOpDescribeAccountSettings) HandleInitialize(ctx context.Context return next.HandleInitialize(ctx, in) } +type validateOpDescribeAccountSubscription struct { +} + +func (*validateOpDescribeAccountSubscription) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDescribeAccountSubscription) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DescribeAccountSubscriptionInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDescribeAccountSubscriptionInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpDescribeAnalysis struct { } @@ -2378,6 +2418,10 @@ func addOpCreateAccountCustomizationValidationMiddleware(stack *middleware.Stack return stack.Initialize.Add(&validateOpCreateAccountCustomization{}, middleware.After) } +func addOpCreateAccountSubscriptionValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateAccountSubscription{}, middleware.After) +} + func addOpCreateAnalysisValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpCreateAnalysis{}, middleware.After) } @@ -2514,6 +2558,10 @@ func addOpDescribeAccountSettingsValidationMiddleware(stack *middleware.Stack) e return stack.Initialize.Add(&validateOpDescribeAccountSettings{}, middleware.After) } +func addOpDescribeAccountSubscriptionValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDescribeAccountSubscription{}, middleware.After) +} + func addOpDescribeAnalysisValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDescribeAnalysis{}, middleware.After) } @@ -4659,6 +4707,33 @@ func validateOpCreateAccountCustomizationInput(v *CreateAccountCustomizationInpu } } +func validateOpCreateAccountSubscriptionInput(v *CreateAccountSubscriptionInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateAccountSubscriptionInput"} + if len(v.Edition) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Edition")) + } + if len(v.AuthenticationMethod) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("AuthenticationMethod")) + } + if v.AwsAccountId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AwsAccountId")) + } + if v.AccountName == nil { + invalidParams.Add(smithy.NewErrParamRequired("AccountName")) + } + if v.NotificationEmail == nil { + invalidParams.Add(smithy.NewErrParamRequired("NotificationEmail")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpCreateAnalysisInput(v *CreateAnalysisInput) error { if v == nil { return nil @@ -5506,6 +5581,21 @@ func validateOpDescribeAccountSettingsInput(v *DescribeAccountSettingsInput) err } } +func validateOpDescribeAccountSubscriptionInput(v *DescribeAccountSubscriptionInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DescribeAccountSubscriptionInput"} + if v.AwsAccountId == nil { + invalidParams.Add(smithy.NewErrParamRequired("AwsAccountId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpDescribeAnalysisInput(v *DescribeAnalysisInput) error { if v == nil { return nil diff --git a/service/rds/api_op_BacktrackDBCluster.go b/service/rds/api_op_BacktrackDBCluster.go index b08319c2715..90bae796758 100644 --- a/service/rds/api_op_BacktrackDBCluster.go +++ b/service/rds/api_op_BacktrackDBCluster.go @@ -14,7 +14,7 @@ import ( // Backtracks a DB cluster to a specific time, without creating a new DB cluster. // For more information on backtracking, see Backtracking an Aurora DB Cluster // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/AuroraMySQL.Managing.Backtrack.html) -// in the Amazon Aurora User Guide. This action applies only to Aurora MySQL DB +// in the Amazon Aurora User Guide. This action only applies to Aurora MySQL DB // clusters. func (c *Client) BacktrackDBCluster(ctx context.Context, params *BacktrackDBClusterInput, optFns ...func(*Options)) (*BacktrackDBClusterOutput, error) { if params == nil { diff --git a/service/rds/api_op_CopyDBClusterSnapshot.go b/service/rds/api_op_CopyDBClusterSnapshot.go index 6039ec55dab..c4d3e19c638 100644 --- a/service/rds/api_op_CopyDBClusterSnapshot.go +++ b/service/rds/api_op_CopyDBClusterSnapshot.go @@ -17,7 +17,7 @@ import ( // manual DB cluster snapshot, SourceDBClusterSnapshotIdentifier must be the Amazon // Resource Name (ARN) of the shared DB cluster snapshot. You can copy an encrypted // DB cluster snapshot from another Amazon Web Services Region. In that case, the -// Amazon Web Services Region where you call the CopyDBClusterSnapshot operation is +// Amazon Web Services Region where you call the CopyDBClusterSnapshot action is // the destination Amazon Web Services Region for the encrypted DB cluster snapshot // to be copied to. To copy an encrypted DB cluster snapshot from another Amazon // Web Services Region, you must provide the following values: @@ -27,21 +27,60 @@ import ( // identifier for the key to use to encrypt the copy of the DB cluster snapshot in // the destination Amazon Web Services Region. // -// * TargetDBClusterSnapshotIdentifier -// - The identifier for the new copy of the DB cluster snapshot in the destination -// Amazon Web Services Region. +// * PreSignedUrl - A URL that +// contains a Signature Version 4 signed request for the CopyDBClusterSnapshot +// action to be called in the source Amazon Web Services Region where the DB +// cluster snapshot is copied from. The pre-signed URL must be a valid request for +// the CopyDBClusterSnapshot API action that can be executed in the source Amazon +// Web Services Region that contains the encrypted DB cluster snapshot to be +// copied. The pre-signed URL request must contain the following parameter +// values: // -// * SourceDBClusterSnapshotIdentifier - The DB -// cluster snapshot identifier for the encrypted DB cluster snapshot to be copied. -// This identifier must be in the ARN format for the source Amazon Web Services -// Region and is the same value as the SourceDBClusterSnapshotIdentifier in the -// presigned URL. +// * KmsKeyId - The Amazon Web Services KMS key identifier for the KMS key +// to use to encrypt the copy of the DB cluster snapshot in the destination Amazon +// Web Services Region. This is the same identifier for both the +// CopyDBClusterSnapshot action that is called in the destination Amazon Web +// Services Region, and the action contained in the pre-signed URL. // -// To cancel the copy operation once it is in progress, delete the -// target DB cluster snapshot identified by TargetDBClusterSnapshotIdentifier while -// that DB cluster snapshot is in "copying" status. For more information on copying -// encrypted Amazon Aurora DB cluster snapshots from one Amazon Web Services Region -// to another, see Copying a Snapshot +// * +// DestinationRegion - The name of the Amazon Web Services Region that the DB +// cluster snapshot is to be created in. +// +// * SourceDBClusterSnapshotIdentifier - The +// DB cluster snapshot identifier for the encrypted DB cluster snapshot to be +// copied. This identifier must be in the Amazon Resource Name (ARN) format for the +// source Amazon Web Services Region. For example, if you are copying an encrypted +// DB cluster snapshot from the us-west-2 Amazon Web Services Region, then your +// SourceDBClusterSnapshotIdentifier looks like the following example: +// arn:aws:rds:us-west-2:123456789012:cluster-snapshot:aurora-cluster1-snapshot-20161115. +// +// To +// learn how to generate a Signature Version 4 signed request, see Authenticating +// Requests: Using Query Parameters (Amazon Web Services Signature Version 4) +// (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) +// and Signature Version 4 Signing Process +// (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). If you +// are using an Amazon Web Services SDK tool or the CLI, you can specify +// SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl +// manually. Specifying SourceRegion autogenerates a pre-signed URL that is a valid +// request for the operation that can be executed in the source Amazon Web Services +// Region. +// +// * TargetDBClusterSnapshotIdentifier - The identifier for the new copy +// of the DB cluster snapshot in the destination Amazon Web Services Region. +// +// * +// SourceDBClusterSnapshotIdentifier - The DB cluster snapshot identifier for the +// encrypted DB cluster snapshot to be copied. This identifier must be in the ARN +// format for the source Amazon Web Services Region and is the same value as the +// SourceDBClusterSnapshotIdentifier in the pre-signed URL. +// +// To cancel the copy +// operation once it is in progress, delete the target DB cluster snapshot +// identified by TargetDBClusterSnapshotIdentifier while that DB cluster snapshot +// is in "copying" status. For more information on copying encrypted Amazon Aurora +// DB cluster snapshots from one Amazon Web Services Region to another, see +// Copying a Snapshot // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_CopySnapshot.html) // in the Amazon Aurora User Guide. For more information on Amazon Aurora DB // clusters, see What is Amazon Aurora? @@ -129,36 +168,33 @@ type CopyDBClusterSnapshotInput struct { // value for the KmsKeyId parameter, an error is returned. KmsKeyId *string - // When you are copying a DB cluster snapshot from one Amazon Web Services GovCloud - // (US) Region to another, the URL that contains a Signature Version 4 signed - // request for the CopyDBClusterSnapshot API operation in the Amazon Web Services - // Region that contains the source DB cluster snapshot to copy. Use the - // PreSignedUrl parameter when copying an encrypted DB cluster snapshot from - // another Amazon Web Services Region. Don't specify PreSignedUrl when copying an - // encrypted DB cluster snapshot in the same Amazon Web Services Region. This - // setting applies only to Amazon Web Services GovCloud (US) Regions. It's ignored - // in other Amazon Web Services Regions. The presigned URL must be a valid request - // for the CopyDBClusterSnapshot API operation that can run in the source Amazon - // Web Services Region that contains the encrypted DB cluster snapshot to copy. The - // presigned URL request must contain the following parameter values: - // - // * KmsKeyId - - // The KMS key identifier for the KMS key to use to encrypt the copy of the DB - // cluster snapshot in the destination Amazon Web Services Region. This is the same - // identifier for both the CopyDBClusterSnapshot operation that is called in the - // destination Amazon Web Services Region, and the operation contained in the - // presigned URL. + // The URL that contains a Signature Version 4 signed request for the + // CopyDBClusterSnapshot API action in the Amazon Web Services Region that contains + // the source DB cluster snapshot to copy. The PreSignedUrl parameter must be used + // when copying an encrypted DB cluster snapshot from another Amazon Web Services + // Region. Don't specify PreSignedUrl when you are copying an encrypted DB cluster + // snapshot in the same Amazon Web Services Region. The pre-signed URL must be a + // valid request for the CopyDBClusterSnapshot API action that can be executed in + // the source Amazon Web Services Region that contains the encrypted DB cluster + // snapshot to be copied. The pre-signed URL request must contain the following + // parameter values: // - // * DestinationRegion - The name of the Amazon Web Services Region - // that the DB cluster snapshot is to be created in. + // * KmsKeyId - The Amazon Web Services KMS key identifier for + // the KMS key to use to encrypt the copy of the DB cluster snapshot in the + // destination Amazon Web Services Region. This is the same identifier for both the + // CopyDBClusterSnapshot action that is called in the destination Amazon Web + // Services Region, and the action contained in the pre-signed URL. // // * - // SourceDBClusterSnapshotIdentifier - The DB cluster snapshot identifier for the - // encrypted DB cluster snapshot to be copied. This identifier must be in the - // Amazon Resource Name (ARN) format for the source Amazon Web Services Region. For - // example, if you are copying an encrypted DB cluster snapshot from the us-west-2 - // Amazon Web Services Region, then your SourceDBClusterSnapshotIdentifier looks - // like the following example: + // DestinationRegion - The name of the Amazon Web Services Region that the DB + // cluster snapshot is to be created in. + // + // * SourceDBClusterSnapshotIdentifier - The + // DB cluster snapshot identifier for the encrypted DB cluster snapshot to be + // copied. This identifier must be in the Amazon Resource Name (ARN) format for the + // source Amazon Web Services Region. For example, if you are copying an encrypted + // DB cluster snapshot from the us-west-2 Amazon Web Services Region, then your + // SourceDBClusterSnapshotIdentifier looks like the following example: // arn:aws:rds:us-west-2:123456789012:cluster-snapshot:aurora-cluster1-snapshot-20161115. // // To @@ -169,8 +205,9 @@ type CopyDBClusterSnapshotInput struct { // (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). If you // are using an Amazon Web Services SDK tool or the CLI, you can specify // SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl - // manually. Specifying SourceRegion autogenerates a presigned URL that is a valid - // request for the operation that can run in the source Amazon Web Services Region. + // manually. Specifying SourceRegion autogenerates a pre-signed URL that is a valid + // request for the operation that can be executed in the source Amazon Web Services + // Region. PreSignedUrl *string // The AWS region the resource is in. The presigned URL will be created with this diff --git a/service/rds/api_op_CopyDBSnapshot.go b/service/rds/api_op_CopyDBSnapshot.go index 5ebf7bd970a..47a12b6bfba 100644 --- a/service/rds/api_op_CopyDBSnapshot.go +++ b/service/rds/api_op_CopyDBSnapshot.go @@ -16,8 +16,8 @@ import ( // Copies the specified DB snapshot. The source DB snapshot must be in the // available state. You can copy a snapshot from one Amazon Web Services Region to // another. In that case, the Amazon Web Services Region where you call the -// CopyDBSnapshot operation is the destination Amazon Web Services Region for the -// DB snapshot copy. This command doesn't apply to RDS Custom. For more information +// CopyDBSnapshot action is the destination Amazon Web Services Region for the DB +// snapshot copy. This command doesn't apply to RDS Custom. For more information // about copying snapshots, see Copying a DB Snapshot // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CopySnapshot.html#USER_CopyDBSnapshot) // in the Amazon RDS User Guide. @@ -48,10 +48,11 @@ type CopyDBSnapshotInput struct { // If you are copying from a shared manual DB snapshot, this parameter must be the // Amazon Resource Name (ARN) of the shared DB snapshot. If you are copying an // encrypted snapshot this parameter must be in the ARN format for the source - // Amazon Web Services Region. Constraints: + // Amazon Web Services Region, and must match the SourceDBSnapshotIdentifier in the + // PreSignedUrl parameter. Constraints: // - // * Must specify a valid system snapshot - // in the "available" state. + // * Must specify a valid system snapshot in + // the "available" state. // // Example: rds:mydb-2012-04-02-00-01 Example: // arn:aws:rds:us-west-2:123456789012:snapshot:mysql-instance1-snapshot-20130805 @@ -108,39 +109,36 @@ type CopyDBSnapshotInput struct { // in the Amazon RDS User Guide. OptionGroupName *string - // When you are copying a snapshot from one Amazon Web Services GovCloud (US) - // Region to another, the URL that contains a Signature Version 4 signed request - // for the CopyDBSnapshot API operation in the source Amazon Web Services Region - // that contains the source DB snapshot to copy. This setting applies only to - // Amazon Web Services GovCloud (US) Regions. It's ignored in other Amazon Web - // Services Regions. You must specify this parameter when you copy an encrypted DB - // snapshot from another Amazon Web Services Region by using the Amazon RDS API. - // Don't specify PreSignedUrl when you are copying an encrypted DB snapshot in the - // same Amazon Web Services Region. The presigned URL must be a valid request for - // the CopyDBClusterSnapshot API operation that can run in the source Amazon Web - // Services Region that contains the encrypted DB cluster snapshot to copy. The - // presigned URL request must contain the following parameter values: + // The URL that contains a Signature Version 4 signed request for the + // CopyDBSnapshot API action in the source Amazon Web Services Region that contains + // the source DB snapshot to copy. You must specify this parameter when you copy an + // encrypted DB snapshot from another Amazon Web Services Region by using the + // Amazon RDS API. Don't specify PreSignedUrl when you are copying an encrypted DB + // snapshot in the same Amazon Web Services Region. The presigned URL must be a + // valid request for the CopyDBSnapshot API action that can be executed in the + // source Amazon Web Services Region that contains the encrypted DB snapshot to be + // copied. The presigned URL request must contain the following parameter + // values: // - // * - // DestinationRegion - The Amazon Web Services Region that the encrypted DB - // snapshot is copied to. This Amazon Web Services Region is the same one where the - // CopyDBSnapshot operation is called that contains this presigned URL. For + // * DestinationRegion - The Amazon Web Services Region that the encrypted + // DB snapshot is copied to. This Amazon Web Services Region is the same one where + // the CopyDBSnapshot action is called that contains this presigned URL. For // example, if you copy an encrypted DB snapshot from the us-west-2 Amazon Web // Services Region to the us-east-1 Amazon Web Services Region, then you call the - // CopyDBSnapshot operation in the us-east-1 Amazon Web Services Region and provide - // a presigned URL that contains a call to the CopyDBSnapshot operation in the - // us-west-2 Amazon Web Services Region. For this example, the DestinationRegion in - // the presigned URL must be set to the us-east-1 Amazon Web Services Region. + // CopyDBSnapshot action in the us-east-1 Amazon Web Services Region and provide a + // presigned URL that contains a call to the CopyDBSnapshot action in the us-west-2 + // Amazon Web Services Region. For this example, the DestinationRegion in the + // presigned URL must be set to the us-east-1 Amazon Web Services Region. // // * - // KmsKeyId - The KMS key identifier for the KMS key to use to encrypt the copy of - // the DB snapshot in the destination Amazon Web Services Region. This is the same - // identifier for both the CopyDBSnapshot operation that is called in the - // destination Amazon Web Services Region, and the operation contained in the - // presigned URL. + // KmsKeyId - The Amazon Web Services KMS key identifier for the KMS key to use to + // encrypt the copy of the DB snapshot in the destination Amazon Web Services + // Region. This is the same identifier for both the CopyDBSnapshot action that is + // called in the destination Amazon Web Services Region, and the action contained + // in the presigned URL. // - // * SourceDBSnapshotIdentifier - The DB snapshot identifier for - // the encrypted snapshot to be copied. This identifier must be in the Amazon + // * SourceDBSnapshotIdentifier - The DB snapshot identifier + // for the encrypted snapshot to be copied. This identifier must be in the Amazon // Resource Name (ARN) format for the source Amazon Web Services Region. For // example, if you are copying an encrypted DB snapshot from the us-west-2 Amazon // Web Services Region, then your SourceDBSnapshotIdentifier looks like the @@ -155,8 +153,9 @@ type CopyDBSnapshotInput struct { // (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). If you // are using an Amazon Web Services SDK tool or the CLI, you can specify // SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl - // manually. Specifying SourceRegion autogenerates a presigned URL that is a valid - // request for the operation that can run in the source Amazon Web Services Region. + // manually. Specifying SourceRegion autogenerates a pre-signed URL that is a valid + // request for the operation that can be executed in the source Amazon Web Services + // Region. PreSignedUrl *string // The AWS region the resource is in. The presigned URL will be created with this diff --git a/service/rds/api_op_CreateDBCluster.go b/service/rds/api_op_CreateDBCluster.go index b5c71940080..efbe3072b4b 100644 --- a/service/rds/api_op_CreateDBCluster.go +++ b/service/rds/api_op_CreateDBCluster.go @@ -16,7 +16,9 @@ import ( // Creates a new Amazon Aurora DB cluster or Multi-AZ DB cluster. You can use the // ReplicationSourceIdentifier parameter to create an Amazon Aurora DB cluster as a // read replica of another DB cluster or Amazon RDS MySQL or PostgreSQL DB -// instance. For more information on Amazon Aurora, see What is Amazon Aurora? +// instance. For cross-Region replication where the DB cluster identified by +// ReplicationSourceIdentifier is encrypted, also specify the PreSignedUrl +// parameter. For more information on Amazon Aurora, see What is Amazon Aurora? // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html) // in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters, // see Multi-AZ deployments with two readable standby DB instances @@ -211,7 +213,7 @@ type CreateDBClusterInput struct { // and Access Management (IAM) accounts to database accounts. By default, mapping // isn't enabled. For more information, see IAM Database Authentication // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/UsingWithRDS.IAMDBAuth.html) - // in the Amazon Aurora User Guide. Valid for: Aurora DB clusters only + // in the Amazon Aurora User Guide.. Valid for: Aurora DB clusters only EnableIAMDatabaseAuthentication *bool // A value that indicates whether to turn on Performance Insights for the DB @@ -226,8 +228,7 @@ type CreateDBClusterInput struct { // and higher 2.x versions. The global engine mode isn't required for Aurora MySQL // version 1.22 and higher 1.x versions, and global engine mode isn't required for // any 2.x versions. The multimaster engine mode only applies for DB clusters - // created with Aurora MySQL version 5.6.10a. The serverless engine mode only - // applies for Aurora Serverless v1 DB clusters. For Aurora PostgreSQL, the global + // created with Aurora MySQL version 5.6.10a. For Aurora PostgreSQL, the global // engine mode isn't required, and both the parallelquery and the multimaster // engine modes currently aren't supported. Limitations and requirements apply to // some DB engine modes. For more information, see the following sections in the @@ -237,10 +238,6 @@ type CreateDBClusterInput struct { // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html#aurora-serverless.limitations) // // * - // Requirements for Aurora Serverless v2 - // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless-v2.requirements.html) - // - // * // Limitations of Parallel Query // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-mysql-parallel-query.html#aurora-mysql-parallel-query-limitations) // @@ -373,30 +370,8 @@ type CreateDBClusterInput struct { // Valid for: Multi-AZ DB clusters only PerformanceInsightsKMSKeyId *string - // The number of days to retain Performance Insights data. The default is 7 days. - // The following values are valid: - // - // * 7 - // - // * month * 31, where month is a number of - // months from 1-23 - // - // * 731 - // - // For example, the following values are valid: - // - // * 93 (3 - // months * 31) - // - // * 341 (11 months * 31) - // - // * 589 (19 months * 31) - // - // * 731 - // - // If you - // specify a retention period such as 94, which isn't a valid value, RDS issues an - // error. Valid for: Multi-AZ DB clusters only + // The amount of time, in days, to retain Performance Insights data. Valid values + // are 7 or 731 (2 years). Valid for: Multi-AZ DB clusters only PerformanceInsightsRetentionPeriod *int32 // The port number on which the instances in the DB cluster accept connections. RDS @@ -405,44 +380,43 @@ type CreateDBClusterInput struct { // for: Aurora DB clusters and Multi-AZ DB clusters Port *int32 - // When you are replicating a DB cluster from one Amazon Web Services GovCloud (US) - // Region to another, an URL that contains a Signature Version 4 signed request for - // the CreateDBCluster operation to be called in the source Amazon Web Services - // Region where the DB cluster is replicated from. Specify PreSignedUrl only when - // you are performing cross-Region replication from an encrypted DB cluster. The - // presigned URL must be a valid request for the CreateDBCluster API operation that - // can run in the source Amazon Web Services Region that contains the encrypted DB - // cluster to copy. The presigned URL request must contain the following parameter + // A URL that contains a Signature Version 4 signed request for the CreateDBCluster + // action to be called in the source Amazon Web Services Region where the DB + // cluster is replicated from. Specify PreSignedUrl only when you are performing + // cross-Region replication from an encrypted DB cluster. The pre-signed URL must + // be a valid request for the CreateDBCluster API action that can be executed in + // the source Amazon Web Services Region that contains the encrypted DB cluster to + // be copied. The pre-signed URL request must contain the following parameter // values: // - // * KmsKeyId - The KMS key identifier for the KMS key to use to encrypt - // the copy of the DB cluster in the destination Amazon Web Services Region. This - // should refer to the same KMS key for both the CreateDBCluster operation that is - // called in the destination Amazon Web Services Region, and the operation - // contained in the presigned URL. - // - // * DestinationRegion - The name of the Amazon - // Web Services Region that Aurora read replica will be created in. - // - // * - // ReplicationSourceIdentifier - The DB cluster identifier for the encrypted DB - // cluster to be copied. This identifier must be in the Amazon Resource Name (ARN) - // format for the source Amazon Web Services Region. For example, if you are - // copying an encrypted DB cluster from the us-west-2 Amazon Web Services Region, - // then your ReplicationSourceIdentifier would look like Example: - // arn:aws:rds:us-west-2:123456789012:cluster:aurora-cluster1. - // - // To learn how to - // generate a Signature Version 4 signed request, see Authenticating Requests: - // Using Query Parameters (Amazon Web Services Signature Version 4) + // * KmsKeyId - The Amazon Web Services KMS key identifier for the KMS key + // to use to encrypt the copy of the DB cluster in the destination Amazon Web + // Services Region. This should refer to the same KMS key for both the + // CreateDBCluster action that is called in the destination Amazon Web Services + // Region, and the action contained in the pre-signed URL. + // + // * DestinationRegion - + // The name of the Amazon Web Services Region that Aurora read replica will be + // created in. + // + // * ReplicationSourceIdentifier - The DB cluster identifier for the + // encrypted DB cluster to be copied. This identifier must be in the Amazon + // Resource Name (ARN) format for the source Amazon Web Services Region. For + // example, if you are copying an encrypted DB cluster from the us-west-2 Amazon + // Web Services Region, then your ReplicationSourceIdentifier would look like + // Example: arn:aws:rds:us-west-2:123456789012:cluster:aurora-cluster1. + // + // To learn + // how to generate a Signature Version 4 signed request, see Authenticating + // Requests: Using Query Parameters (Amazon Web Services Signature Version 4) // (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) // and Signature Version 4 Signing Process // (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). If you // are using an Amazon Web Services SDK tool or the CLI, you can specify // SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl - // manually. Specifying SourceRegion autogenerates a presigned URL that is a valid - // request for the operation that can run in the source Amazon Web Services Region. - // Valid for: Aurora DB clusters only + // manually. Specifying SourceRegion autogenerates a pre-signed URL that is a valid + // request for the operation that can be executed in the source Amazon Web Services + // Region. Valid for: Aurora DB clusters only PreSignedUrl *string // The daily time range during which automated backups are created if automated diff --git a/service/rds/api_op_CreateDBClusterEndpoint.go b/service/rds/api_op_CreateDBClusterEndpoint.go index 0b44ba2beb9..4e6b394490e 100644 --- a/service/rds/api_op_CreateDBClusterEndpoint.go +++ b/service/rds/api_op_CreateDBClusterEndpoint.go @@ -12,7 +12,7 @@ import ( ) // Creates a new custom endpoint and associates it with an Amazon Aurora DB -// cluster. This action applies only to Aurora DB clusters. +// cluster. This action only applies to Aurora DB clusters. func (c *Client) CreateDBClusterEndpoint(ctx context.Context, params *CreateDBClusterEndpointInput, optFns ...func(*Options)) (*CreateDBClusterEndpointOutput, error) { if params == nil { params = &CreateDBClusterEndpointInput{} diff --git a/service/rds/api_op_CreateDBClusterParameterGroup.go b/service/rds/api_op_CreateDBClusterParameterGroup.go index 9eaa0c47381..5b5036a259e 100644 --- a/service/rds/api_op_CreateDBClusterParameterGroup.go +++ b/service/rds/api_op_CreateDBClusterParameterGroup.go @@ -32,7 +32,7 @@ import ( // for a DB cluster, such as the character set for the default database defined by // the character_set_database parameter. You can use the Parameter Groups option of // the Amazon RDS console (https://console.aws.amazon.com/rds/) or the -// DescribeDBClusterParameters operation to verify that your DB cluster parameter +// DescribeDBClusterParameters action to verify that your DB cluster parameter // group has been created or modified. For more information on Amazon Aurora, see // What is Amazon Aurora? // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html) diff --git a/service/rds/api_op_CreateDBInstance.go b/service/rds/api_op_CreateDBInstance.go index 03fcc67c6c2..2270390b124 100644 --- a/service/rds/api_op_CreateDBInstance.go +++ b/service/rds/api_op_CreateDBInstance.go @@ -11,16 +11,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Creates a new DB instance. The new DB instance can be an RDS DB instance, or it -// can be a DB instance in an Aurora DB cluster. For an Aurora DB cluster, you can -// call this operation multiple times to add more than one DB instance to the -// cluster. For more information about creating an RDS DB instance, see Creating -// an Amazon RDS DB instance -// (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreateDBInstance.html) -// in the Amazon RDS User Guide. For more information about creating a DB instance -// in an Aurora DB cluster, see Creating an Amazon Aurora DB cluster -// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.CreateInstance.html) -// in the Amazon Aurora User Guide. +// Creates a new DB instance. func (c *Client) CreateDBInstance(ctx context.Context, params *CreateDBInstanceInput, optFns ...func(*Options)) (*CreateDBInstanceOutput, error) { if params == nil { params = &CreateDBInstanceInput{} @@ -39,14 +30,12 @@ func (c *Client) CreateDBInstance(ctx context.Context, params *CreateDBInstanceI // type CreateDBInstanceInput struct { - // The compute and memory capacity of the DB instance, for example db.m5.large. Not + // The compute and memory capacity of the DB instance, for example db.m4.large. Not // all DB instance classes are available in all Amazon Web Services Regions, or for // all database engines. For the full list of DB instance classes, and availability - // for your engine, see DB instance classes + // for your engine, see DB Instance Class // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) - // in the Amazon RDS User Guide or Aurora DB instance classes - // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.DBInstanceClass.html) - // in the Amazon Aurora User Guide. + // in the Amazon RDS User Guide. // // This member is required. DBInstanceClass *string @@ -238,7 +227,8 @@ type CreateDBInstanceInput struct { // * Can't be set to 0 if the DB instance is a source // to read replicas // - // * Can't be set to 0 for an RDS Custom for Oracle DB instance + // * Can't be set to 0 or 35 for an RDS Custom for Oracle DB + // instance BackupRetentionPeriod *int32 // Specifies where automated backups and manual snapshots are stored. Possible @@ -385,9 +375,8 @@ type CreateDBInstanceInput struct { // hyphens DBParameterGroupName *string - // A list of DB security groups to associate with this DB instance. This setting - // applies to the legacy EC2-Classic platform, which is no longer used to create - // new DB instances. Use the VpcSecurityGroupIds setting instead. + // A list of DB security groups to associate with this DB instance. Default: The + // default DB security group for the database engine. DBSecurityGroups []string // A DB subnet group to associate with this DB instance. Constraints: Must match @@ -411,13 +400,11 @@ type CreateDBInstanceInput struct { // in an Active Directory Domain. For more information, see Kerberos // Authentication // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/kerberos-authentication.html) - // in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom. Amazon - // Aurora Not applicable. The domain is managed by the DB cluster. + // in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom. Domain *string // Specify the name of the IAM role to be used when making API calls to the - // Directory Service. This setting doesn't apply to RDS Custom. Amazon Aurora Not - // applicable. The domain is managed by the DB cluster. + // Directory Service. This setting doesn't apply to RDS Custom. DomainIAMRoleName *string // The list of log types that need to be enabled for exporting to CloudWatch Logs. @@ -448,12 +435,12 @@ type CreateDBInstanceInput struct { // A value that indicates whether to enable mapping of Amazon Web Services Identity // and Access Management (IAM) accounts to database accounts. By default, mapping - // isn't enabled. For more information, see IAM Database Authentication for MySQL - // and PostgreSQL + // isn't enabled. This setting doesn't apply to RDS Custom or Amazon Aurora. In + // Aurora, mapping Amazon Web Services IAM accounts to database accounts is managed + // by the DB cluster. For more information, see IAM Database Authentication for + // MySQL and PostgreSQL // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html) - // in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom. Amazon - // Aurora Not applicable. Mapping Amazon Web Services IAM accounts to database - // accounts is managed by the DB cluster. + // in the Amazon RDS User Guide. EnableIAMDatabaseAuthentication *bool // A value that indicates whether to enable Performance Insights for the DB @@ -463,7 +450,7 @@ type CreateDBInstanceInput struct { EnablePerformanceInsights *bool // The version number of the database engine to use. For a list of valid engine - // versions, use the DescribeDBEngineVersions operation. The following are the + // versions, use the DescribeDBEngineVersions action. The following are the // database engines and links to information about the major and minor versions // that are available with Amazon RDS. Not every database engine is available for // every Amazon Web Services Region. Amazon Aurora Not applicable. The version @@ -502,8 +489,7 @@ type CreateDBInstanceInput struct { // in the Amazon RDS User Guide. Constraints: For MariaDB, MySQL, Oracle, and // PostgreSQL DB instances, must be a multiple between .5 and 50 of the storage // amount for the DB instance. For SQL Server DB instances, must be a multiple - // between 1 and 50 of the storage amount for the DB instance. Amazon Aurora Not - // applicable. Storage is managed by the DB cluster. + // between 1 and 50 of the storage amount for the DB instance. Iops *int32 // The Amazon Web Services KMS key identifier for an encrypted DB instance. The @@ -524,7 +510,7 @@ type CreateDBInstanceInput struct { // License model information for this DB instance. Valid values: license-included | // bring-your-own-license | general-public-license This setting doesn't apply to - // RDS Custom. Amazon Aurora Not applicable. + // RDS Custom. LicenseModel *string // The password for the master user. The password can include any printable ASCII @@ -556,8 +542,7 @@ type CreateDBInstanceInput struct { // including limitations that apply to it, see Managing capacity automatically // with Amazon RDS storage autoscaling // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling) - // in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom. Amazon - // Aurora Not applicable. Storage is managed by the DB cluster. + // in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom. MaxAllocatedStorage *int32 // The interval, in seconds, between points when Enhanced Monitoring metrics are @@ -579,8 +564,7 @@ type CreateDBInstanceInput struct { // A value that indicates whether the DB instance is a Multi-AZ deployment. You // can't set the AvailabilityZone parameter if the DB instance is a Multi-AZ - // deployment. This setting doesn't apply to RDS Custom. Amazon Aurora Not - // applicable. DB instance Availability Zones (AZs) are managed by the DB cluster. + // deployment. This setting doesn't apply to RDS Custom. MultiAZ *bool // The name of the NCHAR character set for the Oracle DB instance. This parameter @@ -605,8 +589,7 @@ type CreateDBInstanceInput struct { // specified option group. Permanent options, such as the TDE option for Oracle // Advanced Security TDE, can't be removed from an option group. Also, that option // group can't be removed from a DB instance after it is associated with a DB - // instance. This setting doesn't apply to RDS Custom. Amazon Aurora Not - // applicable. + // instance. This setting doesn't apply to RDS Custom. OptionGroupName *string // The Amazon Web Services KMS key identifier for encryption of Performance @@ -618,30 +601,8 @@ type CreateDBInstanceInput struct { // This setting doesn't apply to RDS Custom. PerformanceInsightsKMSKeyId *string - // The number of days to retain Performance Insights data. The default is 7 days. - // The following values are valid: - // - // * 7 - // - // * month * 31, where month is a number of - // months from 1-23 - // - // * 731 - // - // For example, the following values are valid: - // - // * 93 (3 - // months * 31) - // - // * 341 (11 months * 31) - // - // * 589 (19 months * 31) - // - // * 731 - // - // If you - // specify a retention period such as 94, which isn't a valid value, RDS issues an - // error. This setting doesn't apply to RDS Custom. + // The amount of time, in days, to retain Performance Insights data. Valid values + // are 7 or 731 (2 years). This setting doesn't apply to RDS Custom. PerformanceInsightsRetentionPeriod *int32 // The port number on which the database accepts connections. MySQL Default: 3306 @@ -682,8 +643,7 @@ type CreateDBInstanceInput struct { PreferredMaintenanceWindow *string // The number of CPU cores and the number of threads per core for the DB instance - // class of the DB instance. This setting doesn't apply to RDS Custom. Amazon - // Aurora Not applicable. + // class of the DB instance. This setting doesn't apply to RDS Custom. ProcessorFeatures []types.ProcessorFeature // A value that specifies the order in which an Aurora Replica is promoted to the @@ -734,15 +694,13 @@ type CreateDBInstanceInput struct { // Specifies the storage type to be associated with the DB instance. Valid values: // standard | gp2 | io1 If you specify io1, you must also include a value for the // Iops parameter. Default: io1 if the Iops parameter is specified, otherwise gp2 - // Amazon Aurora Not applicable. Storage is managed by the DB cluster. StorageType *string // Tags to assign to the DB instance. Tags []types.Tag // The ARN from the key store with which to associate the instance for TDE - // encryption. This setting doesn't apply to RDS Custom. Amazon Aurora Not - // applicable. + // encryption. This setting doesn't apply to RDS Custom. TdeCredentialArn *string // The password for the given ARN from the key store in order to access the device. diff --git a/service/rds/api_op_CreateDBInstanceReadReplica.go b/service/rds/api_op_CreateDBInstanceReadReplica.go index 245674f03f4..1769f4155ed 100644 --- a/service/rds/api_op_CreateDBInstanceReadReplica.go +++ b/service/rds/api_op_CreateDBInstanceReadReplica.go @@ -18,9 +18,9 @@ import ( // MariaDB, Oracle, PostgreSQL, or SQL Server. For more information, see Working // with Read Replicas // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html) in -// the Amazon RDS User Guide. Amazon Aurora doesn't support this operation. Call -// the CreateDBInstance operation to create a DB instance for an Aurora DB cluster. -// All read replica DB instances are created with backups disabled. All other DB +// the Amazon RDS User Guide. Amazon Aurora doesn't support this action. Call the +// CreateDBInstance action to create a DB instance for an Aurora DB cluster. All +// read replica DB instances are created with backups disabled. All other DB // instance attributes (including DB security groups and DB parameter groups) are // inherited from the source DB instance, except as specified. Your source DB // instance must have backup retention enabled. @@ -135,16 +135,15 @@ type CreateDBInstanceReadReplicaInput struct { // DBParameterGroup of source DB instance for a same Region read replica, or the // default DBParameterGroup for the specified DB engine for a cross-Region read // replica. Specifying a parameter group for this operation is only supported for - // MySQL and Oracle DB instances. It isn't supported for RDS Custom. - // Constraints: + // Oracle DB instances. It isn't supported for RDS Custom. Constraints: // - // * Must be 1 to 255 letters, numbers, or hyphens. + // * Must be + // 1 to 255 letters, numbers, or hyphens. // - // * First - // character must be a letter + // * First character must be a letter // - // * Can't end with a hyphen or contain two consecutive - // hyphens + // * + // Can't end with a hyphen or contain two consecutive hyphens DBParameterGroupName *string // Specifies a DB subnet group for the DB instance. The new DB instance is created @@ -296,76 +295,49 @@ type CreateDBInstanceReadReplicaInput struct { // This setting doesn't apply to RDS Custom. PerformanceInsightsKMSKeyId *string - // The number of days to retain Performance Insights data. The default is 7 days. - // The following values are valid: - // - // * 7 - // - // * month * 31, where month is a number of - // months from 1-23 - // - // * 731 - // - // For example, the following values are valid: - // - // * 93 (3 - // months * 31) - // - // * 341 (11 months * 31) - // - // * 589 (19 months * 31) - // - // * 731 - // - // If you - // specify a retention period such as 94, which isn't a valid value, RDS issues an - // error. This setting doesn't apply to RDS Custom. + // The amount of time, in days, to retain Performance Insights data. Valid values + // are 7 or 731 (2 years). This setting doesn't apply to RDS Custom. PerformanceInsightsRetentionPeriod *int32 // The port number that the DB instance uses for connections. Default: Inherits // from the source DB instance Valid Values: 1150-65535 Port *int32 - // When you are creating a read replica from one Amazon Web Services GovCloud (US) - // Region to another or from one China Amazon Web Services Region to another, the - // URL that contains a Signature Version 4 signed request for the - // CreateDBInstanceReadReplica API operation in the source Amazon Web Services - // Region that contains the source DB instance. This setting applies only to Amazon - // Web Services GovCloud (US) Regions and China Amazon Web Services Regions. It's - // ignored in other Amazon Web Services Regions. You must specify this parameter - // when you create an encrypted read replica from another Amazon Web Services - // Region by using the Amazon RDS API. Don't specify PreSignedUrl when you are - // creating an encrypted read replica in the same Amazon Web Services Region. The - // presigned URL must be a valid request for the CreateDBInstanceReadReplica API - // operation that can run in the source Amazon Web Services Region that contains - // the encrypted source DB instance. The presigned URL request must contain the - // following parameter values: - // - // * DestinationRegion - The Amazon Web Services - // Region that the encrypted read replica is created in. This Amazon Web Services - // Region is the same one where the CreateDBInstanceReadReplica operation is called - // that contains this presigned URL. For example, if you create an encrypted DB - // instance in the us-west-1 Amazon Web Services Region, from a source DB instance - // in the us-east-2 Amazon Web Services Region, then you call the - // CreateDBInstanceReadReplica operation in the us-east-1 Amazon Web Services - // Region and provide a presigned URL that contains a call to the - // CreateDBInstanceReadReplica operation in the us-west-2 Amazon Web Services - // Region. For this example, the DestinationRegion in the presigned URL must be set - // to the us-east-1 Amazon Web Services Region. - // - // * KmsKeyId - The KMS key - // identifier for the key to use to encrypt the read replica in the destination - // Amazon Web Services Region. This is the same identifier for both the - // CreateDBInstanceReadReplica operation that is called in the destination Amazon - // Web Services Region, and the operation contained in the presigned URL. + // The URL that contains a Signature Version 4 signed request for the + // CreateDBInstanceReadReplica API action in the source Amazon Web Services Region + // that contains the source DB instance. You must specify this parameter when you + // create an encrypted read replica from another Amazon Web Services Region by + // using the Amazon RDS API. Don't specify PreSignedUrl when you are creating an + // encrypted read replica in the same Amazon Web Services Region. The presigned URL + // must be a valid request for the CreateDBInstanceReadReplica API action that can + // be executed in the source Amazon Web Services Region that contains the encrypted + // source DB instance. The presigned URL request must contain the following + // parameter values: + // + // * DestinationRegion - The Amazon Web Services Region that the + // encrypted read replica is created in. This Amazon Web Services Region is the + // same one where the CreateDBInstanceReadReplica action is called that contains + // this presigned URL. For example, if you create an encrypted DB instance in the + // us-west-1 Amazon Web Services Region, from a source DB instance in the us-east-2 + // Amazon Web Services Region, then you call the CreateDBInstanceReadReplica action + // in the us-east-1 Amazon Web Services Region and provide a presigned URL that + // contains a call to the CreateDBInstanceReadReplica action in the us-west-2 + // Amazon Web Services Region. For this example, the DestinationRegion in the + // presigned URL must be set to the us-east-1 Amazon Web Services Region. // // * - // SourceDBInstanceIdentifier - The DB instance identifier for the encrypted DB - // instance to be replicated. This identifier must be in the Amazon Resource Name - // (ARN) format for the source Amazon Web Services Region. For example, if you are - // creating an encrypted read replica from a DB instance in the us-west-2 Amazon - // Web Services Region, then your SourceDBInstanceIdentifier looks like the - // following example: + // KmsKeyId - The Amazon Web Services KMS key identifier for the key to use to + // encrypt the read replica in the destination Amazon Web Services Region. This is + // the same identifier for both the CreateDBInstanceReadReplica action that is + // called in the destination Amazon Web Services Region, and the action contained + // in the presigned URL. + // + // * SourceDBInstanceIdentifier - The DB instance identifier + // for the encrypted DB instance to be replicated. This identifier must be in the + // Amazon Resource Name (ARN) format for the source Amazon Web Services Region. For + // example, if you are creating an encrypted read replica from a DB instance in the + // us-west-2 Amazon Web Services Region, then your SourceDBInstanceIdentifier looks + // like the following example: // arn:aws:rds:us-west-2:123456789012:instance:mysql-instance1-20161115. // // To learn @@ -377,10 +349,10 @@ type CreateDBInstanceReadReplicaInput struct { // are using an Amazon Web Services SDK tool or the CLI, you can specify // SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl // manually. Specifying SourceRegion autogenerates a presigned URL that is a valid - // request for the operation that can run in the source Amazon Web Services Region. - // SourceRegion isn't supported for SQL Server, because Amazon RDS for SQL Server - // doesn't support cross-Region read replicas. This setting doesn't apply to RDS - // Custom. + // request for the operation that can be executed in the source Amazon Web Services + // Region. SourceRegion isn't supported for SQL Server, because SQL Server on + // Amazon RDS doesn't support cross-Region read replicas. This setting doesn't + // apply to RDS Custom. PreSignedUrl *string // The number of CPU cores and the number of threads per core for the DB instance diff --git a/service/rds/api_op_CreateEventSubscription.go b/service/rds/api_op_CreateEventSubscription.go index c9a3bc2953d..a5b9d001083 100644 --- a/service/rds/api_op_CreateEventSubscription.go +++ b/service/rds/api_op_CreateEventSubscription.go @@ -11,7 +11,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Creates an RDS event notification subscription. This operation requires a topic +// Creates an RDS event notification subscription. This action requires a topic // Amazon Resource Name (ARN) created by either the RDS console, the SNS console, // or the SNS API. To obtain an ARN with SNS, you must create a topic in Amazon SNS // and subscribe to the topic. The ARN is displayed in the SNS console. You can diff --git a/service/rds/api_op_CreateGlobalCluster.go b/service/rds/api_op_CreateGlobalCluster.go index 68ef360f1ae..69e9fa56f4d 100644 --- a/service/rds/api_op_CreateGlobalCluster.go +++ b/service/rds/api_op_CreateGlobalCluster.go @@ -18,7 +18,7 @@ import ( // subsystem. You can create a global database that is initially empty, and then // add a primary cluster and a secondary cluster to it. Or you can specify an // existing Aurora cluster during the create operation, and this cluster becomes -// the primary cluster of the global database. This action applies only to Aurora +// the primary cluster of the global database. This action only applies to Aurora // DB clusters. func (c *Client) CreateGlobalCluster(ctx context.Context, params *CreateGlobalClusterInput, optFns ...func(*Options)) (*CreateGlobalClusterOutput, error) { if params == nil { @@ -37,7 +37,7 @@ func (c *Client) CreateGlobalCluster(ctx context.Context, params *CreateGlobalCl type CreateGlobalClusterInput struct { - // The name for your database of up to 64 alphanumeric characters. If you do not + // The name for your database of up to 64 alpha-numeric characters. If you do not // provide a name, Amazon Aurora will not create a database in the global database // cluster you are creating. DatabaseName *string diff --git a/service/rds/api_op_DescribeDBClusters.go b/service/rds/api_op_DescribeDBClusters.go index da2264db929..27bc8143fdf 100644 --- a/service/rds/api_op_DescribeDBClusters.go +++ b/service/rds/api_op_DescribeDBClusters.go @@ -4,12 +4,18 @@ package rds import ( "context" + "errors" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/rds/types" "github.com/aws/smithy-go/middleware" + smithytime "github.com/aws/smithy-go/time" smithyhttp "github.com/aws/smithy-go/transport/http" + smithywaiter "github.com/aws/smithy-go/waiter" + "github.com/jmespath/go-jmespath" + "strconv" + "time" ) // Returns information about Amazon Aurora DB clusters and Multi-AZ DB clusters. @@ -256,6 +262,568 @@ func (p *DescribeDBClustersPaginator) NextPage(ctx context.Context, optFns ...fu return result, nil } +// DBClusterAvailableWaiterOptions are waiter options for DBClusterAvailableWaiter +type DBClusterAvailableWaiterOptions struct { + + // Set of options to modify how an operation is invoked. These apply to all + // operations invoked for this client. Use functional options on operation call to + // modify this list for per operation behavior. + APIOptions []func(*middleware.Stack) error + + // MinDelay is the minimum amount of time to delay between retries. If unset, + // DBClusterAvailableWaiter will use default minimum delay of 30 seconds. Note that + // MinDelay must resolve to a value lesser than or equal to the MaxDelay. + MinDelay time.Duration + + // MaxDelay is the maximum amount of time to delay between retries. If unset or set + // to zero, DBClusterAvailableWaiter will use default max delay of 120 seconds. + // Note that MaxDelay must resolve to value greater than or equal to the MinDelay. + MaxDelay time.Duration + + // LogWaitAttempts is used to enable logging for waiter retry attempts + LogWaitAttempts bool + + // Retryable is function that can be used to override the service defined + // waiter-behavior based on operation output, or returned error. This function is + // used by the waiter to decide if a state is retryable or a terminal state. By + // default service-modeled logic will populate this option. This option can thus be + // used to define a custom waiter state with fall-back to service-modeled waiter + // state mutators.The function returns an error in case of a failure state. In case + // of retry state, this function returns a bool value of true and nil error, while + // in case of success it returns a bool value of false and nil error. + Retryable func(context.Context, *DescribeDBClustersInput, *DescribeDBClustersOutput, error) (bool, error) +} + +// DBClusterAvailableWaiter defines the waiters for DBClusterAvailable +type DBClusterAvailableWaiter struct { + client DescribeDBClustersAPIClient + + options DBClusterAvailableWaiterOptions +} + +// NewDBClusterAvailableWaiter constructs a DBClusterAvailableWaiter. +func NewDBClusterAvailableWaiter(client DescribeDBClustersAPIClient, optFns ...func(*DBClusterAvailableWaiterOptions)) *DBClusterAvailableWaiter { + options := DBClusterAvailableWaiterOptions{} + options.MinDelay = 30 * time.Second + options.MaxDelay = 120 * time.Second + options.Retryable = dBClusterAvailableStateRetryable + + for _, fn := range optFns { + fn(&options) + } + return &DBClusterAvailableWaiter{ + client: client, + options: options, + } +} + +// Wait calls the waiter function for DBClusterAvailable waiter. The maxWaitDur is +// the maximum wait duration the waiter will wait. The maxWaitDur is required and +// must be greater than zero. +func (w *DBClusterAvailableWaiter) Wait(ctx context.Context, params *DescribeDBClustersInput, maxWaitDur time.Duration, optFns ...func(*DBClusterAvailableWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBClusterAvailable waiter and +// returns the output of the successful operation. The maxWaitDur is the maximum +// wait duration the waiter will wait. The maxWaitDur is required and must be +// greater than zero. +func (w *DBClusterAvailableWaiter) WaitForOutput(ctx context.Context, params *DescribeDBClustersInput, maxWaitDur time.Duration, optFns ...func(*DBClusterAvailableWaiterOptions)) (*DescribeDBClustersOutput, error) { + if maxWaitDur <= 0 { + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") + } + + options := w.options + for _, fn := range optFns { + fn(&options) + } + + if options.MaxDelay <= 0 { + options.MaxDelay = 120 * time.Second + } + + if options.MinDelay > options.MaxDelay { + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + } + + ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) + defer cancelFn() + + logger := smithywaiter.Logger{} + remainingTime := maxWaitDur + + var attempt int64 + for { + + attempt++ + apiOptions := options.APIOptions + start := time.Now() + + if options.LogWaitAttempts { + logger.Attempt = attempt + apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...) + apiOptions = append(apiOptions, logger.AddLogger) + } + + out, err := w.client.DescribeDBClusters(ctx, params, func(o *Options) { + o.APIOptions = append(o.APIOptions, apiOptions...) + }) + + retryable, err := options.Retryable(ctx, params, out, err) + if err != nil { + return nil, err + } + if !retryable { + return out, nil + } + + remainingTime -= time.Since(start) + if remainingTime < options.MinDelay || remainingTime <= 0 { + break + } + + // compute exponential backoff between waiter retries + delay, err := smithywaiter.ComputeDelay( + attempt, options.MinDelay, options.MaxDelay, remainingTime, + ) + if err != nil { + return nil, fmt.Errorf("error computing waiter delay, %w", err) + } + + remainingTime -= delay + // sleep for the delay amount before invoking a request + if err := smithytime.SleepWithContext(ctx, delay); err != nil { + return nil, fmt.Errorf("request cancelled while waiting, %w", err) + } + } + return nil, fmt.Errorf("exceeded max wait time for DBClusterAvailable waiter") +} + +func dBClusterAvailableStateRetryable(ctx context.Context, input *DescribeDBClustersInput, output *DescribeDBClustersOutput, err error) (bool, error) { + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "available" + var match = true + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + if len(listOfValues) == 0 { + match = false + } + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) != expectedValue { + match = false + } + } + + if match { + return false, nil + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "deleted" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "deleting" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "failed" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "incompatible-restore" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "incompatible-parameters" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + return true, nil +} + +// DBClusterDeletedWaiterOptions are waiter options for DBClusterDeletedWaiter +type DBClusterDeletedWaiterOptions struct { + + // Set of options to modify how an operation is invoked. These apply to all + // operations invoked for this client. Use functional options on operation call to + // modify this list for per operation behavior. + APIOptions []func(*middleware.Stack) error + + // MinDelay is the minimum amount of time to delay between retries. If unset, + // DBClusterDeletedWaiter will use default minimum delay of 30 seconds. Note that + // MinDelay must resolve to a value lesser than or equal to the MaxDelay. + MinDelay time.Duration + + // MaxDelay is the maximum amount of time to delay between retries. If unset or set + // to zero, DBClusterDeletedWaiter will use default max delay of 120 seconds. Note + // that MaxDelay must resolve to value greater than or equal to the MinDelay. + MaxDelay time.Duration + + // LogWaitAttempts is used to enable logging for waiter retry attempts + LogWaitAttempts bool + + // Retryable is function that can be used to override the service defined + // waiter-behavior based on operation output, or returned error. This function is + // used by the waiter to decide if a state is retryable or a terminal state. By + // default service-modeled logic will populate this option. This option can thus be + // used to define a custom waiter state with fall-back to service-modeled waiter + // state mutators.The function returns an error in case of a failure state. In case + // of retry state, this function returns a bool value of true and nil error, while + // in case of success it returns a bool value of false and nil error. + Retryable func(context.Context, *DescribeDBClustersInput, *DescribeDBClustersOutput, error) (bool, error) +} + +// DBClusterDeletedWaiter defines the waiters for DBClusterDeleted +type DBClusterDeletedWaiter struct { + client DescribeDBClustersAPIClient + + options DBClusterDeletedWaiterOptions +} + +// NewDBClusterDeletedWaiter constructs a DBClusterDeletedWaiter. +func NewDBClusterDeletedWaiter(client DescribeDBClustersAPIClient, optFns ...func(*DBClusterDeletedWaiterOptions)) *DBClusterDeletedWaiter { + options := DBClusterDeletedWaiterOptions{} + options.MinDelay = 30 * time.Second + options.MaxDelay = 120 * time.Second + options.Retryable = dBClusterDeletedStateRetryable + + for _, fn := range optFns { + fn(&options) + } + return &DBClusterDeletedWaiter{ + client: client, + options: options, + } +} + +// Wait calls the waiter function for DBClusterDeleted waiter. The maxWaitDur is +// the maximum wait duration the waiter will wait. The maxWaitDur is required and +// must be greater than zero. +func (w *DBClusterDeletedWaiter) Wait(ctx context.Context, params *DescribeDBClustersInput, maxWaitDur time.Duration, optFns ...func(*DBClusterDeletedWaiterOptions)) error { + _, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...) + return err +} + +// WaitForOutput calls the waiter function for DBClusterDeleted waiter and returns +// the output of the successful operation. The maxWaitDur is the maximum wait +// duration the waiter will wait. The maxWaitDur is required and must be greater +// than zero. +func (w *DBClusterDeletedWaiter) WaitForOutput(ctx context.Context, params *DescribeDBClustersInput, maxWaitDur time.Duration, optFns ...func(*DBClusterDeletedWaiterOptions)) (*DescribeDBClustersOutput, error) { + if maxWaitDur <= 0 { + return nil, fmt.Errorf("maximum wait time for waiter must be greater than zero") + } + + options := w.options + for _, fn := range optFns { + fn(&options) + } + + if options.MaxDelay <= 0 { + options.MaxDelay = 120 * time.Second + } + + if options.MinDelay > options.MaxDelay { + return nil, fmt.Errorf("minimum waiter delay %v must be lesser than or equal to maximum waiter delay of %v.", options.MinDelay, options.MaxDelay) + } + + ctx, cancelFn := context.WithTimeout(ctx, maxWaitDur) + defer cancelFn() + + logger := smithywaiter.Logger{} + remainingTime := maxWaitDur + + var attempt int64 + for { + + attempt++ + apiOptions := options.APIOptions + start := time.Now() + + if options.LogWaitAttempts { + logger.Attempt = attempt + apiOptions = append([]func(*middleware.Stack) error{}, options.APIOptions...) + apiOptions = append(apiOptions, logger.AddLogger) + } + + out, err := w.client.DescribeDBClusters(ctx, params, func(o *Options) { + o.APIOptions = append(o.APIOptions, apiOptions...) + }) + + retryable, err := options.Retryable(ctx, params, out, err) + if err != nil { + return nil, err + } + if !retryable { + return out, nil + } + + remainingTime -= time.Since(start) + if remainingTime < options.MinDelay || remainingTime <= 0 { + break + } + + // compute exponential backoff between waiter retries + delay, err := smithywaiter.ComputeDelay( + attempt, options.MinDelay, options.MaxDelay, remainingTime, + ) + if err != nil { + return nil, fmt.Errorf("error computing waiter delay, %w", err) + } + + remainingTime -= delay + // sleep for the delay amount before invoking a request + if err := smithytime.SleepWithContext(ctx, delay); err != nil { + return nil, fmt.Errorf("request cancelled while waiting, %w", err) + } + } + return nil, fmt.Errorf("exceeded max wait time for DBClusterDeleted waiter") +} + +func dBClusterDeletedStateRetryable(ctx context.Context, input *DescribeDBClustersInput, output *DescribeDBClustersOutput, err error) (bool, error) { + + if err == nil { + pathValue, err := jmespath.Search("length(DBClusters) == `0`", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "true" + bv, err := strconv.ParseBool(expectedValue) + if err != nil { + return false, fmt.Errorf("error parsing boolean from string %w", err) + } + value, ok := pathValue.(bool) + if !ok { + return false, fmt.Errorf("waiter comparator expected bool value got %T", pathValue) + } + + if value == bv { + return false, nil + } + } + + if err != nil { + var errorType *types.DBClusterNotFoundFault + if errors.As(err, &errorType) { + return false, nil + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "creating" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "modifying" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "rebooting" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + if err == nil { + pathValue, err := jmespath.Search("DBClusters[].Status", output) + if err != nil { + return false, fmt.Errorf("error evaluating waiter state: %w", err) + } + + expectedValue := "resetting-master-credentials" + listOfValues, ok := pathValue.([]interface{}) + if !ok { + return false, fmt.Errorf("waiter comparator expected list got %T", pathValue) + } + + for _, v := range listOfValues { + value, ok := v.(*string) + if !ok { + return false, fmt.Errorf("waiter comparator expected *string value, got %T", pathValue) + } + + if string(*value) == expectedValue { + return false, fmt.Errorf("waiter state transitioned to Failure") + } + } + } + + return true, nil +} + func newServiceMetadataMiddleware_opDescribeDBClusters(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, diff --git a/service/rds/api_op_DescribeEvents.go b/service/rds/api_op_DescribeEvents.go index ccdae4e5eb2..abf457c25a7 100644 --- a/service/rds/api_op_DescribeEvents.go +++ b/service/rds/api_op_DescribeEvents.go @@ -17,13 +17,8 @@ import ( // security groups, DB snapshots, DB cluster snapshots, and RDS Proxies for the // past 14 days. Events specific to a particular DB instance, DB cluster, DB // parameter group, DB security group, DB snapshot, DB cluster snapshot group, or -// RDS Proxy can be obtained by providing the name as a parameter. For more -// information on working with events, see Monitoring Amazon RDS events -// (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/working-with-events.html) -// in the Amazon RDS User Guide and Monitoring Amazon Aurora events -// (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/working-with-events.html) -// in the Amazon Aurora User Guide. By default, RDS returns events that were -// generated in the past hour. +// RDS Proxy can be obtained by providing the name as a parameter. By default, RDS +// returns events that were generated in the past hour. func (c *Client) DescribeEvents(ctx context.Context, params *DescribeEventsInput, optFns ...func(*Options)) (*DescribeEventsOutput, error) { if params == nil { params = &DescribeEventsInput{} diff --git a/service/rds/api_op_FailoverDBCluster.go b/service/rds/api_op_FailoverDBCluster.go index e894b2fc5ea..f7cfe0e47e7 100644 --- a/service/rds/api_op_FailoverDBCluster.go +++ b/service/rds/api_op_FailoverDBCluster.go @@ -18,7 +18,7 @@ import ( // instances (read-only instances) in the DB cluster to be the primary DB instance // (the cluster writer). An Amazon Aurora DB cluster automatically fails over to an // Aurora Replica, if one exists, when the primary DB instance fails. A Multi-AZ DB -// cluster automatically fails over to a readable standby DB instance when the +// cluster automatically fails over to a readbable standby DB instance when the // primary DB instance fails. To simulate a failure of a primary instance for // testing, you can force a failover. Because each instance in a DB cluster has its // own endpoint address, make sure to clean up and re-establish any existing diff --git a/service/rds/api_op_ModifyDBCluster.go b/service/rds/api_op_ModifyDBCluster.go index 4ee78268470..20c794eea18 100644 --- a/service/rds/api_op_ModifyDBCluster.go +++ b/service/rds/api_op_ModifyDBCluster.go @@ -274,30 +274,8 @@ type ModifyDBClusterInput struct { // Valid for: Multi-AZ DB clusters only PerformanceInsightsKMSKeyId *string - // The number of days to retain Performance Insights data. The default is 7 days. - // The following values are valid: - // - // * 7 - // - // * month * 31, where month is a number of - // months from 1-23 - // - // * 731 - // - // For example, the following values are valid: - // - // * 93 (3 - // months * 31) - // - // * 341 (11 months * 31) - // - // * 589 (19 months * 31) - // - // * 731 - // - // If you - // specify a retention period such as 94, which isn't a valid value, RDS issues an - // error. Valid for: Multi-AZ DB clusters only + // The amount of time, in days, to retain Performance Insights data. Valid values + // are 7 or 731 (2 years). Valid for: Multi-AZ DB clusters only PerformanceInsightsRetentionPeriod *int32 // The port number on which the DB cluster accepts connections. Constraints: Value diff --git a/service/rds/api_op_ModifyDBClusterParameterGroup.go b/service/rds/api_op_ModifyDBClusterParameterGroup.go index 6b81d6db2d0..d8b56f9c096 100644 --- a/service/rds/api_op_ModifyDBClusterParameterGroup.go +++ b/service/rds/api_op_ModifyDBClusterParameterGroup.go @@ -22,14 +22,14 @@ import ( // when creating the default database for a DB cluster, such as the character set // for the default database defined by the character_set_database parameter. You // can use the Parameter Groups option of the Amazon RDS console -// (https://console.aws.amazon.com/rds/) or the DescribeDBClusterParameters -// operation to verify that your DB cluster parameter group has been created or -// modified. If the modified DB cluster parameter group is used by an Aurora -// Serverless v1 cluster, Aurora applies the update immediately. The cluster -// restart might interrupt your workload. In that case, your application must -// reopen any connections and retry any transactions that were active when the -// parameter changes took effect. For more information on Amazon Aurora DB -// clusters, see What is Amazon Aurora? +// (https://console.aws.amazon.com/rds/) or the DescribeDBClusterParameters action +// to verify that your DB cluster parameter group has been created or modified. If +// the modified DB cluster parameter group is used by an Aurora Serverless v1 +// cluster, Aurora applies the update immediately. The cluster restart might +// interrupt your workload. In that case, your application must reopen any +// connections and retry any transactions that were active when the parameter +// changes took effect. For more information on Amazon Aurora DB clusters, see +// What is Amazon Aurora? // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html) // in the Amazon Aurora User Guide. For more information on Multi-AZ DB clusters, // see Multi-AZ deployments with two readable standby DB instances diff --git a/service/rds/api_op_ModifyDBClusterSnapshotAttribute.go b/service/rds/api_op_ModifyDBClusterSnapshotAttribute.go index a84a672b8c1..2568033c870 100644 --- a/service/rds/api_op_ModifyDBClusterSnapshotAttribute.go +++ b/service/rds/api_op_ModifyDBClusterSnapshotAttribute.go @@ -25,7 +25,7 @@ import ( // as a value for that parameter in this case. To view which Amazon Web Services // accounts have access to copy or restore a manual DB cluster snapshot, or whether // a manual DB cluster snapshot is public or private, use the -// DescribeDBClusterSnapshotAttributes API operation. The accounts are returned as +// DescribeDBClusterSnapshotAttributes API action. The accounts are returned as // values for the restore attribute. func (c *Client) ModifyDBClusterSnapshotAttribute(ctx context.Context, params *ModifyDBClusterSnapshotAttributeInput, optFns ...func(*Options)) (*ModifyDBClusterSnapshotAttributeOutput, error) { if params == nil { @@ -48,7 +48,7 @@ type ModifyDBClusterSnapshotAttributeInput struct { // The name of the DB cluster snapshot attribute to modify. To manage authorization // for other Amazon Web Services accounts to copy or restore a manual DB cluster // snapshot, set this value to restore. To view the list of attributes available to - // modify, use the DescribeDBClusterSnapshotAttributes API operation. + // modify, use the DescribeDBClusterSnapshotAttributes API action. // // This member is required. AttributeName *string diff --git a/service/rds/api_op_ModifyDBInstance.go b/service/rds/api_op_ModifyDBInstance.go index cb44f3f0d11..4ff5d28d5e7 100644 --- a/service/rds/api_op_ModifyDBInstance.go +++ b/service/rds/api_op_ModifyDBInstance.go @@ -111,14 +111,14 @@ type ModifyDBInstanceInput struct { // setting Constraints: // // * It must be a value from 0 to 35. It can't be set to 0 if - // the DB instance is a source to read replicas. It can't be set to 0 for an RDS - // Custom for Oracle DB instance. + // the DB instance is a source to read replicas. It can't be set to 0 or 35 for an + // RDS Custom for Oracle DB instance. // - // * It can be specified for a MySQL read replica - // only if the source is running MySQL 5.6 or later. + // * It can be specified for a MySQL read + // replica only if the source is running MySQL 5.6 or later. // - // * It can be specified for a - // PostgreSQL read replica only if the source is running PostgreSQL 9.3.5. + // * It can be specified + // for a PostgreSQL read replica only if the source is running PostgreSQL 9.3.5. BackupRetentionPeriod *int32 // Specifies the certificate to associate with the DB instance. This setting @@ -161,14 +161,12 @@ type ModifyDBInstanceInput struct { // more information, see ModifyDBCluster. CopyTagsToSnapshot *bool - // The new compute and memory capacity of the DB instance, for example db.m5.large. + // The new compute and memory capacity of the DB instance, for example db.m4.large. // Not all DB instance classes are available in all Amazon Web Services Regions, or // for all database engines. For the full list of DB instance classes, and - // availability for your engine, see DB instance classes + // availability for your engine, see DB Instance Class // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html) - // in the Amazon RDS User Guide or Aurora DB instance classes - // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.DBInstanceClass.html) - // in the Amazon Aurora User Guide. If you modify the DB instance class, an outage + // in the Amazon RDS User Guide. If you modify the DB instance class, an outage // occurs during the change. The change is applied during the next maintenance // window, unless ApplyImmediately is enabled for this request. This setting // doesn't apply to RDS Custom for Oracle. Default: Uses existing setting @@ -265,7 +263,7 @@ type ModifyDBInstanceInput struct { // A value that indicates whether to enable Performance Insights for the DB // instance. For more information, see Using Amazon Performance Insights // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html) - // in the Amazon RDS User Guide. This setting doesn't apply to RDS Custom. + // in the Amazon RDS User Guide.. This setting doesn't apply to RDS Custom. EnablePerformanceInsights *bool // The version number of the database engine to upgrade to. Changing this parameter @@ -322,8 +320,8 @@ type ModifyDBInstanceInput struct { // Constraints: Must contain from 8 to 128 characters. MySQL Constraints: Must // contain from 8 to 41 characters. Oracle Constraints: Must contain from 8 to 30 // characters. PostgreSQL Constraints: Must contain from 8 to 128 characters. - // Amazon RDS API operations never return the password, so this action provides a - // way to regain access to a primary instance user if the password is lost. This + // Amazon RDS API actions never return the password, so this action provides a way + // to regain access to a primary instance user if the password is lost. This // includes restoring privileges that might have been accidentally revoked. MasterUserPassword *string @@ -410,30 +408,8 @@ type ModifyDBInstanceInput struct { // This setting doesn't apply to RDS Custom. PerformanceInsightsKMSKeyId *string - // The number of days to retain Performance Insights data. The default is 7 days. - // The following values are valid: - // - // * 7 - // - // * month * 31, where month is a number of - // months from 1-23 - // - // * 731 - // - // For example, the following values are valid: - // - // * 93 (3 - // months * 31) - // - // * 341 (11 months * 31) - // - // * 589 (19 months * 31) - // - // * 731 - // - // If you - // specify a retention period such as 94, which isn't a valid value, RDS issues an - // error. This setting doesn't apply to RDS Custom. + // The amount of time, in days, to retain Performance Insights data. Valid values + // are 7 or 731 (2 years). This setting doesn't apply to RDS Custom. PerformanceInsightsRetentionPeriod *int32 // The daily time range during which automated backups are created if automated diff --git a/service/rds/api_op_ModifyDBProxyTargetGroup.go b/service/rds/api_op_ModifyDBProxyTargetGroup.go index 91e5ce6655d..9b7924a61a4 100644 --- a/service/rds/api_op_ModifyDBProxyTargetGroup.go +++ b/service/rds/api_op_ModifyDBProxyTargetGroup.go @@ -29,12 +29,12 @@ func (c *Client) ModifyDBProxyTargetGroup(ctx context.Context, params *ModifyDBP type ModifyDBProxyTargetGroupInput struct { - // The name of the proxy. + // The name of the new proxy to which to assign the target group. // // This member is required. DBProxyName *string - // The name of the target group to modify. + // The name of the new target group to assign to the proxy. // // This member is required. TargetGroupName *string diff --git a/service/rds/api_op_ModifyDBSnapshotAttribute.go b/service/rds/api_op_ModifyDBSnapshotAttribute.go index 1c9b4e5e5c5..43b7b0bb135 100644 --- a/service/rds/api_op_ModifyDBSnapshotAttribute.go +++ b/service/rds/api_op_ModifyDBSnapshotAttribute.go @@ -24,8 +24,8 @@ import ( // ValuesToAdd parameter. You can't use all as a value for that parameter in this // case. To view which Amazon Web Services accounts have access to copy or restore // a manual DB snapshot, or whether a manual DB snapshot public or private, use the -// DescribeDBSnapshotAttributes API operation. The accounts are returned as values -// for the restore attribute. +// DescribeDBSnapshotAttributes API action. The accounts are returned as values for +// the restore attribute. func (c *Client) ModifyDBSnapshotAttribute(ctx context.Context, params *ModifyDBSnapshotAttributeInput, optFns ...func(*Options)) (*ModifyDBSnapshotAttributeOutput, error) { if params == nil { params = &ModifyDBSnapshotAttributeInput{} @@ -47,7 +47,7 @@ type ModifyDBSnapshotAttributeInput struct { // The name of the DB snapshot attribute to modify. To manage authorization for // other Amazon Web Services accounts to copy or restore a manual DB snapshot, set // this value to restore. To view the list of attributes available to modify, use - // the DescribeDBSnapshotAttributes API operation. + // the DescribeDBSnapshotAttributes API action. // // This member is required. AttributeName *string diff --git a/service/rds/api_op_RestoreDBClusterFromS3.go b/service/rds/api_op_RestoreDBClusterFromS3.go index c3180036508..aa140078a18 100644 --- a/service/rds/api_op_RestoreDBClusterFromS3.go +++ b/service/rds/api_op_RestoreDBClusterFromS3.go @@ -61,8 +61,8 @@ type RestoreDBClusterFromS3Input struct { DBClusterIdentifier *string // The name of the database engine to be used for this DB cluster. Valid Values: - // aurora (for MySQL 5.6-compatible Aurora) and aurora-mysql (for MySQL - // 5.7-compatible and MySQL 8.0-compatible Aurora) + // aurora (for MySQL 5.6-compatible Aurora), aurora-mysql (for MySQL 5.7-compatible + // and MySQL 8.0-compatible Aurora), and aurora-postgresql // // This member is required. Engine *string @@ -193,8 +193,12 @@ type RestoreDBClusterFromS3Input struct { // "DBEngineVersions[].EngineVersion" To list all of the available engine versions // for aurora-mysql (for MySQL 5.7-compatible and MySQL 8.0-compatible Aurora), use // the following command: aws rds describe-db-engine-versions --engine aurora-mysql - // --query "DBEngineVersions[].EngineVersion" Aurora MySQL Example: 5.6.10a, - // 5.6.mysql_aurora.1.19.2, 5.7.mysql_aurora.2.07.1, 8.0.mysql_aurora.3.02.0 + // --query "DBEngineVersions[].EngineVersion" To list all of the available engine + // versions for aurora-postgresql, use the following command: aws rds + // describe-db-engine-versions --engine aurora-postgresql --query + // "DBEngineVersions[].EngineVersion" Aurora MySQL Example: 5.6.10a, + // 5.6.mysql_aurora.1.19.2, 5.7.12, 5.7.mysql_aurora.2.04.5, + // 8.0.mysql_aurora.3.01.0 Aurora PostgreSQL Example: 9.6.3, 10.7 EngineVersion *string // The Amazon Web Services KMS key identifier for an encrypted DB cluster. The diff --git a/service/rds/api_op_RestoreDBClusterFromSnapshot.go b/service/rds/api_op_RestoreDBClusterFromSnapshot.go index a86c7734639..2e5596c0521 100644 --- a/service/rds/api_op_RestoreDBClusterFromSnapshot.go +++ b/service/rds/api_op_RestoreDBClusterFromSnapshot.go @@ -162,7 +162,7 @@ type RestoreDBClusterFromSnapshotInput struct { // For more information about exporting CloudWatch Logs for Amazon RDS, see // Publishing Database Logs to Amazon CloudWatch Logs // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch) - // in the Amazon RDS User Guide. For more information about exporting CloudWatch + // in the Amazon RDS User Guide.. For more information about exporting CloudWatch // Logs for Amazon Aurora, see Publishing Database Logs to Amazon CloudWatch Logs // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch) // in the Amazon Aurora User Guide. Valid for: Aurora DB clusters and Multi-AZ DB diff --git a/service/rds/api_op_RestoreDBClusterToPointInTime.go b/service/rds/api_op_RestoreDBClusterToPointInTime.go index cafa62beaa3..3d033478e9f 100644 --- a/service/rds/api_op_RestoreDBClusterToPointInTime.go +++ b/service/rds/api_op_RestoreDBClusterToPointInTime.go @@ -146,7 +146,7 @@ type RestoreDBClusterToPointInTimeInput struct { // For more information about exporting CloudWatch Logs for Amazon RDS, see // Publishing Database Logs to Amazon CloudWatch Logs // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch) - // in the Amazon RDS User Guide. For more information about exporting CloudWatch + // in the Amazon RDS User Guide.. For more information about exporting CloudWatch // Logs for Amazon Aurora, see Publishing Database Logs to Amazon CloudWatch Logs // (https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_LogAccess.html#USER_LogAccess.Procedural.UploadtoCloudWatch) // in the Amazon Aurora User Guide. Valid for: Aurora DB clusters and Multi-AZ DB diff --git a/service/rds/api_op_RestoreDBInstanceFromS3.go b/service/rds/api_op_RestoreDBInstanceFromS3.go index 7dd75ce9c84..3c5b9d26f61 100644 --- a/service/rds/api_op_RestoreDBInstanceFromS3.go +++ b/service/rds/api_op_RestoreDBInstanceFromS3.go @@ -163,7 +163,7 @@ type RestoreDBInstanceFromS3Input struct { // A value that indicates whether to enable Performance Insights for the DB // instance. For more information, see Using Amazon Performance Insights // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html) - // in the Amazon RDS User Guide. + // in the Amazon RDS User Guide.. EnablePerformanceInsights *bool // The version number of the database engine to use. Choose the latest minor @@ -262,30 +262,8 @@ type RestoreDBInstanceFromS3Input struct { // account has a different default KMS key for each Amazon Web Services Region. PerformanceInsightsKMSKeyId *string - // The number of days to retain Performance Insights data. The default is 7 days. - // The following values are valid: - // - // * 7 - // - // * month * 31, where month is a number of - // months from 1-23 - // - // * 731 - // - // For example, the following values are valid: - // - // * 93 (3 - // months * 31) - // - // * 341 (11 months * 31) - // - // * 589 (19 months * 31) - // - // * 731 - // - // If you - // specify a retention period such as 94, which isn't a valid value, RDS issues an - // error. + // The amount of time, in days, to retain Performance Insights data. Valid values + // are 7 or 731 (2 years). PerformanceInsightsRetentionPeriod *int32 // The port number on which the database accepts connections. Type: Integer Valid diff --git a/service/rds/api_op_StartDBInstanceAutomatedBackupsReplication.go b/service/rds/api_op_StartDBInstanceAutomatedBackupsReplication.go index 26cdf698b40..ae7b4c34f3d 100644 --- a/service/rds/api_op_StartDBInstanceAutomatedBackupsReplication.go +++ b/service/rds/api_op_StartDBInstanceAutomatedBackupsReplication.go @@ -49,23 +49,12 @@ type StartDBInstanceAutomatedBackupsReplicationInput struct { // arn:aws:kms:us-east-1:123456789012:key/AKIAIOSFODNN7EXAMPLE. KmsKeyId *string - // In an Amazon Web Services GovCloud (US) Region, an URL that contains a Signature - // Version 4 signed request for the StartDBInstanceAutomatedBackupsReplication - // operation to call in the Amazon Web Services Region of the source DB instance. - // The presigned URL must be a valid request for the - // StartDBInstanceAutomatedBackupsReplication API operation that can run in the - // Amazon Web Services Region that contains the source DB instance. This setting - // applies only to Amazon Web Services GovCloud (US) Regions. It's ignored in other - // Amazon Web Services Regions. To learn how to generate a Signature Version 4 - // signed request, see Authenticating Requests: Using Query Parameters (Amazon Web - // Services Signature Version 4) - // (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) - // and Signature Version 4 Signing Process - // (https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). If you - // are using an Amazon Web Services SDK tool or the CLI, you can specify - // SourceRegion (or --source-region for the CLI) instead of specifying PreSignedUrl - // manually. Specifying SourceRegion autogenerates a presigned URL that is a valid - // request for the operation that can run in the source Amazon Web Services Region. + // A URL that contains a Signature Version 4 signed request for the + // StartDBInstanceAutomatedBackupsReplication action to be called in the Amazon Web + // Services Region of the source DB instance. The presigned URL must be a valid + // request for the StartDBInstanceAutomatedBackupsReplication API action that can + // be executed in the Amazon Web Services Region that contains the source DB + // instance. PreSignedUrl *string noSmithyDocumentSerde diff --git a/service/rds/api_op_StopDBInstanceAutomatedBackupsReplication.go b/service/rds/api_op_StopDBInstanceAutomatedBackupsReplication.go index d6ae4480304..21a9fc27718 100644 --- a/service/rds/api_op_StopDBInstanceAutomatedBackupsReplication.go +++ b/service/rds/api_op_StopDBInstanceAutomatedBackupsReplication.go @@ -12,8 +12,8 @@ import ( ) // Stops automated backup replication for a DB instance. This command doesn't apply -// to RDS Custom, Aurora MySQL, and Aurora PostgreSQL. For more information, see -// Replicating Automated Backups to Another Amazon Web Services Region +// to RDS Custom. For more information, see Replicating Automated Backups to +// Another Amazon Web Services Region // (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReplicateBackups.html) // in the Amazon RDS User Guide. func (c *Client) StopDBInstanceAutomatedBackupsReplication(ctx context.Context, params *StopDBInstanceAutomatedBackupsReplicationInput, optFns ...func(*Options)) (*StopDBInstanceAutomatedBackupsReplicationOutput, error) { diff --git a/service/rds/types/types.go b/service/rds/types/types.go index f73374be3c7..4514f5dda29 100644 --- a/service/rds/types/types.go +++ b/service/rds/types/types.go @@ -554,29 +554,9 @@ type DBCluster struct { // non-Aurora Multi-AZ DB clusters. PerformanceInsightsKMSKeyId *string - // The number of days to retain Performance Insights data. The default is 7 days. - // The following values are valid: - // - // * 7 - // - // * month * 31, where month is a number of - // months from 1-23 - // - // * 731 - // - // For example, the following values are valid: - // - // * 93 (3 - // months * 31) - // - // * 341 (11 months * 31) - // - // * 589 (19 months * 31) - // - // * 731 - // - // This - // setting is only for non-Aurora Multi-AZ DB clusters. + // The amount of time, in days, to retain Performance Insights data. Valid values + // are 7 or 731 (2 years). This setting is only for non-Aurora Multi-AZ DB + // clusters. PerformanceInsightsRetentionPeriod *int32 // Specifies the port that the database engine is listening on. @@ -1357,26 +1337,8 @@ type DBInstance struct { // ID, alias ARN, or alias name for the KMS key. PerformanceInsightsKMSKeyId *string - // The number of days to retain Performance Insights data. The default is 7 days. - // The following values are valid: - // - // * 7 - // - // * month * 31, where month is a number of - // months from 1-23 - // - // * 731 - // - // For example, the following values are valid: - // - // * 93 (3 - // months * 31) - // - // * 341 (11 months * 31) - // - // * 589 (19 months * 31) - // - // * 731 + // The amount of time, in days, to retain Performance Insights data. Valid values + // are 7 or 731 (2 years). PerformanceInsightsRetentionPeriod *int32 // Specifies the daily time range during which automated backups are created if @@ -2263,9 +2225,7 @@ type EngineDefaults struct { noSmithyDocumentSerde } -// This data type is used as a response element in the DescribeEvents -// (https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeEvents.html) -// action. +// This data type is used as a response element in the DescribeEvents action. type Event struct { // Specifies the date and time of the event. @@ -2290,7 +2250,6 @@ type Event struct { } // Contains the results of a successful invocation of the DescribeEventCategories -// (https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeEventCategories.html) // operation. type EventCategoriesMap struct { @@ -3697,8 +3656,7 @@ type ValidStorageOptions struct { // membership. type VpcSecurityGroupMembership struct { - // The membership status of the VPC security group. Currently, the only valid - // status is active. + // The status of the VPC security group. Status *string // The name of the VPC security group. diff --git a/service/rolesanywhere/LICENSE.txt b/service/rolesanywhere/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/rolesanywhere/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/service/rolesanywhere/api_client.go b/service/rolesanywhere/api_client.go new file mode 100644 index 00000000000..7c3bce0960c --- /dev/null +++ b/service/rolesanywhere/api_client.go @@ -0,0 +1,433 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/defaults" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/retry" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + smithy "github.com/aws/smithy-go" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net" + "net/http" + "time" +) + +const ServiceID = "RolesAnywhere" +const ServiceAPIVersion = "2018-05-10" + +// Client provides the API client to make operations call for IAM Roles Anywhere. +type Client struct { + options Options +} + +// New returns an initialized Client based on the functional options. Provide +// additional functional options to further configure the behavior of the client, +// such as changing the client's endpoint or adding custom middleware behavior. +func New(options Options, optFns ...func(*Options)) *Client { + options = options.Copy() + + resolveDefaultLogger(&options) + + setResolvedDefaultsMode(&options) + + resolveRetryer(&options) + + resolveHTTPClient(&options) + + resolveHTTPSignerV4(&options) + + resolveDefaultEndpointConfiguration(&options) + + for _, fn := range optFns { + fn(&options) + } + + client := &Client{ + options: options, + } + + return client +} + +type Options struct { + // Set of options to modify how an operation is invoked. These apply to all + // operations invoked for this client. Use functional options on operation call to + // modify this list for per operation behavior. + APIOptions []func(*middleware.Stack) error + + // Configures the events that will be sent to the configured logger. + ClientLogMode aws.ClientLogMode + + // The credentials object to use when signing requests. + Credentials aws.CredentialsProvider + + // The configuration DefaultsMode that the SDK should use when constructing the + // clients initial default settings. + DefaultsMode aws.DefaultsMode + + // The endpoint options to be used when attempting to resolve an endpoint. + EndpointOptions EndpointResolverOptions + + // The service endpoint resolver. + EndpointResolver EndpointResolver + + // Signature Version 4 (SigV4) Signer + HTTPSignerV4 HTTPSignerV4 + + // The logger writer interface to write logging messages to. + Logger logging.Logger + + // The region to send requests to. (Required) + Region string + + // RetryMaxAttempts specifies the maximum number attempts an API client will call + // an operation that fails with a retryable error. A value of 0 is ignored, and + // will not be used to configure the API client created default retryer, or modify + // per operation call's retry max attempts. When creating a new API Clients this + // member will only be used if the Retryer Options member is nil. This value will + // be ignored if Retryer is not nil. If specified in an operation call's functional + // options with a value that is different than the constructed client's Options, + // the Client's Retryer will be wrapped to use the operation's specific + // RetryMaxAttempts value. + RetryMaxAttempts int + + // RetryMode specifies the retry mode the API client will be created with, if + // Retryer option is not also specified. When creating a new API Clients this + // member will only be used if the Retryer Options member is nil. This value will + // be ignored if Retryer is not nil. Currently does not support per operation call + // overrides, may in the future. + RetryMode aws.RetryMode + + // Retryer guides how HTTP requests should be retried in case of recoverable + // failures. When nil the API client will use a default retryer. The kind of + // default retry created by the API client can be changed with the RetryMode + // option. + Retryer aws.Retryer + + // The RuntimeEnvironment configuration, only populated if the DefaultsMode is set + // to DefaultsModeAuto and is initialized using config.LoadDefaultConfig. You + // should not populate this structure programmatically, or rely on the values here + // within your applications. + RuntimeEnvironment aws.RuntimeEnvironment + + // The initial DefaultsMode used when the client options were constructed. If the + // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved + // value was at that point in time. Currently does not support per operation call + // overrides, may in the future. + resolvedDefaultsMode aws.DefaultsMode + + // The HTTP client to invoke API calls with. Defaults to client's default HTTP + // implementation if nil. + HTTPClient HTTPClient +} + +// WithAPIOptions returns a functional option for setting the Client's APIOptions +// option. +func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { + return func(o *Options) { + o.APIOptions = append(o.APIOptions, optFns...) + } +} + +// WithEndpointResolver returns a functional option for setting the Client's +// EndpointResolver option. +func WithEndpointResolver(v EndpointResolver) func(*Options) { + return func(o *Options) { + o.EndpointResolver = v + } +} + +type HTTPClient interface { + Do(*http.Request) (*http.Response, error) +} + +// Copy creates a clone where the APIOptions list is deep copied. +func (o Options) Copy() Options { + to := o + to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions)) + copy(to.APIOptions, o.APIOptions) + + return to +} +func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) { + ctx = middleware.ClearStackValues(ctx) + stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) + options := c.options.Copy() + for _, fn := range optFns { + fn(&options) + } + + finalizeRetryMaxAttemptOptions(&options, *c) + + finalizeClientEndpointResolverOptions(&options) + + for _, fn := range stackFns { + if err := fn(stack, options); err != nil { + return nil, metadata, err + } + } + + for _, fn := range options.APIOptions { + if err := fn(stack); err != nil { + return nil, metadata, err + } + } + + handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack) + result, metadata, err = handler.Handle(ctx, params) + if err != nil { + err = &smithy.OperationError{ + ServiceID: ServiceID, + OperationName: opID, + Err: err, + } + } + return result, metadata, err +} + +type noSmithyDocumentSerde = smithydocument.NoSerde + +func resolveDefaultLogger(o *Options) { + if o.Logger != nil { + return + } + o.Logger = logging.Nop{} +} + +func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error { + return middleware.AddSetLoggerMiddleware(stack, o.Logger) +} + +func setResolvedDefaultsMode(o *Options) { + if len(o.resolvedDefaultsMode) > 0 { + return + } + + var mode aws.DefaultsMode + mode.SetFromString(string(o.DefaultsMode)) + + if mode == aws.DefaultsModeAuto { + mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment) + } + + o.resolvedDefaultsMode = mode +} + +// NewFromConfig returns a new client from the provided config. +func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { + opts := Options{ + Region: cfg.Region, + DefaultsMode: cfg.DefaultsMode, + RuntimeEnvironment: cfg.RuntimeEnvironment, + HTTPClient: cfg.HTTPClient, + Credentials: cfg.Credentials, + APIOptions: cfg.APIOptions, + Logger: cfg.Logger, + ClientLogMode: cfg.ClientLogMode, + } + resolveAWSRetryerProvider(cfg, &opts) + resolveAWSRetryMaxAttempts(cfg, &opts) + resolveAWSRetryMode(cfg, &opts) + resolveAWSEndpointResolver(cfg, &opts) + resolveUseDualStackEndpoint(cfg, &opts) + resolveUseFIPSEndpoint(cfg, &opts) + return New(opts, optFns...) +} + +func resolveHTTPClient(o *Options) { + var buildable *awshttp.BuildableClient + + if o.HTTPClient != nil { + var ok bool + buildable, ok = o.HTTPClient.(*awshttp.BuildableClient) + if !ok { + return + } + } else { + buildable = awshttp.NewBuildableClient() + } + + modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) + if err == nil { + buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) { + if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok { + dialer.Timeout = dialerTimeout + } + }) + + buildable = buildable.WithTransportOptions(func(transport *http.Transport) { + if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok { + transport.TLSHandshakeTimeout = tlsHandshakeTimeout + } + }) + } + + o.HTTPClient = buildable +} + +func resolveRetryer(o *Options) { + if o.Retryer != nil { + return + } + + if len(o.RetryMode) == 0 { + modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) + if err == nil { + o.RetryMode = modeConfig.RetryMode + } + } + if len(o.RetryMode) == 0 { + o.RetryMode = aws.RetryModeStandard + } + + var standardOptions []func(*retry.StandardOptions) + if v := o.RetryMaxAttempts; v != 0 { + standardOptions = append(standardOptions, func(so *retry.StandardOptions) { + so.MaxAttempts = v + }) + } + + switch o.RetryMode { + case aws.RetryModeAdaptive: + var adaptiveOptions []func(*retry.AdaptiveModeOptions) + if len(standardOptions) != 0 { + adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) { + ao.StandardOptions = append(ao.StandardOptions, standardOptions...) + }) + } + o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...) + + default: + o.Retryer = retry.NewStandard(standardOptions...) + } +} + +func resolveAWSRetryerProvider(cfg aws.Config, o *Options) { + if cfg.Retryer == nil { + return + } + o.Retryer = cfg.Retryer() +} + +func resolveAWSRetryMode(cfg aws.Config, o *Options) { + if len(cfg.RetryMode) == 0 { + return + } + o.RetryMode = cfg.RetryMode +} +func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { + if cfg.RetryMaxAttempts == 0 { + return + } + o.RetryMaxAttempts = cfg.RetryMaxAttempts +} + +func finalizeRetryMaxAttemptOptions(o *Options, client Client) { + if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { + return + } + + o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) +} + +func resolveAWSEndpointResolver(cfg aws.Config, o *Options) { + if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil { + return + } + o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions, NewDefaultEndpointResolver()) +} + +func addClientUserAgent(stack *middleware.Stack) error { + return awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "rolesanywhere", goModuleVersion)(stack) +} + +func addHTTPSignerV4Middleware(stack *middleware.Stack, o Options) error { + mw := v4.NewSignHTTPRequestMiddleware(v4.SignHTTPRequestMiddlewareOptions{ + CredentialsProvider: o.Credentials, + Signer: o.HTTPSignerV4, + LogSigning: o.ClientLogMode.IsSigning(), + }) + return stack.Finalize.Add(mw, middleware.After) +} + +type HTTPSignerV4 interface { + SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error +} + +func resolveHTTPSignerV4(o *Options) { + if o.HTTPSignerV4 != nil { + return + } + o.HTTPSignerV4 = newDefaultV4Signer(*o) +} + +func newDefaultV4Signer(o Options) *v4.Signer { + return v4.NewSigner(func(so *v4.SignerOptions) { + so.Logger = o.Logger + so.LogSigning = o.ClientLogMode.IsSigning() + }) +} + +func addRetryMiddlewares(stack *middleware.Stack, o Options) error { + mo := retry.AddRetryMiddlewaresOptions{ + Retryer: o.Retryer, + LogRetryAttempts: o.ClientLogMode.IsRetries(), + } + return retry.AddRetryMiddlewares(stack, mo) +} + +// resolves dual-stack endpoint configuration +func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + o.EndpointOptions.UseDualStackEndpoint = value + } + return nil +} + +// resolves FIPS endpoint configuration +func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + o.EndpointOptions.UseFIPSEndpoint = value + } + return nil +} + +func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { + return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) +} + +func addResponseErrorMiddleware(stack *middleware.Stack) error { + return awshttp.AddResponseErrorMiddleware(stack) +} + +func addRequestResponseLogging(stack *middleware.Stack, o Options) error { + return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{ + LogRequest: o.ClientLogMode.IsRequest(), + LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(), + LogResponse: o.ClientLogMode.IsResponse(), + LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(), + }, middleware.After) +} diff --git a/service/rolesanywhere/api_client_test.go b/service/rolesanywhere/api_client_test.go new file mode 100644 index 00000000000..35637c0f1cf --- /dev/null +++ b/service/rolesanywhere/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +import ( + "context" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "io/ioutil" + "net/http" + "strings" + "testing" +) + +func TestClient_resolveRetryOptions(t *testing.T) { + nopClient := smithyhttp.ClientDoFunc(func(_ *http.Request) (*http.Response, error) { + return &http.Response{ + StatusCode: 200, + Header: http.Header{}, + Body: ioutil.NopCloser(strings.NewReader("")), + }, nil + }) + + cases := map[string]struct { + defaultsMode aws.DefaultsMode + retryer aws.Retryer + retryMaxAttempts int + opRetryMaxAttempts *int + retryMode aws.RetryMode + expectClientRetryMode aws.RetryMode + expectClientMaxAttempts int + expectOpMaxAttempts int + }{ + "defaults": { + defaultsMode: aws.DefaultsModeStandard, + expectClientRetryMode: aws.RetryModeStandard, + expectClientMaxAttempts: 3, + expectOpMaxAttempts: 3, + }, + "custom default retry": { + retryMode: aws.RetryModeAdaptive, + retryMaxAttempts: 10, + expectClientRetryMode: aws.RetryModeAdaptive, + expectClientMaxAttempts: 10, + expectOpMaxAttempts: 10, + }, + "custom op max attempts": { + retryMode: aws.RetryModeAdaptive, + retryMaxAttempts: 10, + opRetryMaxAttempts: aws.Int(2), + expectClientRetryMode: aws.RetryModeAdaptive, + expectClientMaxAttempts: 10, + expectOpMaxAttempts: 2, + }, + "custom op no change max attempts": { + retryMode: aws.RetryModeAdaptive, + retryMaxAttempts: 10, + opRetryMaxAttempts: aws.Int(10), + expectClientRetryMode: aws.RetryModeAdaptive, + expectClientMaxAttempts: 10, + expectOpMaxAttempts: 10, + }, + "custom op 0 max attempts": { + retryMode: aws.RetryModeAdaptive, + retryMaxAttempts: 10, + opRetryMaxAttempts: aws.Int(0), + expectClientRetryMode: aws.RetryModeAdaptive, + expectClientMaxAttempts: 10, + expectOpMaxAttempts: 10, + }, + } + + for name, c := range cases { + t.Run(name, func(t *testing.T) { + client := NewFromConfig(aws.Config{ + DefaultsMode: c.defaultsMode, + Retryer: func() func() aws.Retryer { + if c.retryer == nil { + return nil + } + + return func() aws.Retryer { return c.retryer } + }(), + HTTPClient: nopClient, + RetryMaxAttempts: c.retryMaxAttempts, + RetryMode: c.retryMode, + }) + + if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { + t.Errorf("expect %v retry mode, got %v", e, a) + } + if e, a := c.expectClientMaxAttempts, client.options.Retryer.MaxAttempts(); e != a { + t.Errorf("expect %v max attempts, got %v", e, a) + } + + _, _, err := client.invokeOperation(context.Background(), "mockOperation", struct{}{}, + []func(*Options){ + func(o *Options) { + if c.opRetryMaxAttempts == nil { + return + } + o.RetryMaxAttempts = *c.opRetryMaxAttempts + }, + }, + func(s *middleware.Stack, o Options) error { + s.Initialize.Clear() + s.Serialize.Clear() + s.Build.Clear() + s.Finalize.Clear() + s.Deserialize.Clear() + + if e, a := c.expectOpMaxAttempts, o.Retryer.MaxAttempts(); e != a { + t.Errorf("expect %v op max attempts, got %v", e, a) + } + return nil + }) + if err != nil { + t.Fatalf("expect no operation error, got %v", err) + } + }) + } +} diff --git a/service/rolesanywhere/api_op_CreateProfile.go b/service/rolesanywhere/api_op_CreateProfile.go new file mode 100644 index 00000000000..0b978d97b16 --- /dev/null +++ b/service/rolesanywhere/api_op_CreateProfile.go @@ -0,0 +1,152 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a profile. A profile is configuration resource to list the roles that +// RolesAnywhere service is trusted to assume. In addition, by applying a profile +// you can intersect permissions with IAM managed policies. Required permissions: +// rolesanywhere:CreateProfile. +func (c *Client) CreateProfile(ctx context.Context, params *CreateProfileInput, optFns ...func(*Options)) (*CreateProfileOutput, error) { + if params == nil { + params = &CreateProfileInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateProfile", params, optFns, c.addOperationCreateProfileMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateProfileOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateProfileInput struct { + + // The name of the profile. + // + // This member is required. + Name *string + + // A list of IAM roles that this profile can assume in a CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation. + // + // This member is required. + RoleArns []string + + // The number of seconds the vended session credentials are valid for. + DurationSeconds *int32 + + // Specifies whether the profile is enabled. + Enabled *bool + + // A list of managed policy ARNs that apply to the vended session credentials. + ManagedPolicyArns []string + + // Specifies whether instance properties are required in CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // requests with this profile. + RequireInstanceProperties *bool + + // A session policy that applies to the trust boundary of the vended session + // credentials. + SessionPolicy *string + + // The tags to attach to the profile. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type CreateProfileOutput struct { + + // The state of the profile after a read or write operation. + Profile *types.ProfileDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateProfile{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateProfile{}, 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 = addOpCreateProfileValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateProfile(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_opCreateProfile(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "CreateProfile", + } +} diff --git a/service/rolesanywhere/api_op_CreateTrustAnchor.go b/service/rolesanywhere/api_op_CreateTrustAnchor.go new file mode 100644 index 00000000000..d715dded940 --- /dev/null +++ b/service/rolesanywhere/api_op_CreateTrustAnchor.go @@ -0,0 +1,140 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a trust anchor. You establish trust between IAM Roles Anywhere and your +// certificate authority (CA) by configuring a trust anchor. A Trust Anchor is +// defined either as a reference to a AWS Certificate Manager Private Certificate +// Authority (ACM PCA), or by uploading a Certificate Authority (CA) certificate. +// Your AWS workloads can authenticate with the trust anchor using certificates +// issued by the trusted Certificate Authority (CA) in exchange for temporary AWS +// credentials. Required permissions: rolesanywhere:CreateTrustAnchor. +func (c *Client) CreateTrustAnchor(ctx context.Context, params *CreateTrustAnchorInput, optFns ...func(*Options)) (*CreateTrustAnchorOutput, error) { + if params == nil { + params = &CreateTrustAnchorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateTrustAnchor", params, optFns, c.addOperationCreateTrustAnchorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateTrustAnchorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateTrustAnchorInput struct { + + // The name of the trust anchor. + // + // This member is required. + Name *string + + // The trust anchor type and its related certificate data. + // + // This member is required. + Source *types.Source + + // Specifies whether the trust anchor is enabled. + Enabled *bool + + // The tags to attach to the trust anchor. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type CreateTrustAnchorOutput struct { + + // The state of the trust anchor after a read or write operation. + // + // This member is required. + TrustAnchor *types.TrustAnchorDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateTrustAnchorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateTrustAnchor{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateTrustAnchor{}, 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 = addOpCreateTrustAnchorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTrustAnchor(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_opCreateTrustAnchor(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "CreateTrustAnchor", + } +} diff --git a/service/rolesanywhere/api_op_DeleteCrl.go b/service/rolesanywhere/api_op_DeleteCrl.go new file mode 100644 index 00000000000..b5ce3983036 --- /dev/null +++ b/service/rolesanywhere/api_op_DeleteCrl.go @@ -0,0 +1,125 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a certificate revocation list (CRL). Required permissions: +// rolesanywhere:DeleteCrl. +func (c *Client) DeleteCrl(ctx context.Context, params *DeleteCrlInput, optFns ...func(*Options)) (*DeleteCrlOutput, error) { + if params == nil { + params = &DeleteCrlInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteCrl", params, optFns, c.addOperationDeleteCrlMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteCrlOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteCrlInput struct { + + // The unique identifier of the certificate revocation list (CRL). + // + // This member is required. + CrlId *string + + noSmithyDocumentSerde +} + +type DeleteCrlOutput struct { + + // The state of the certificate revocation list (CRL) after a read or write + // operation. + // + // This member is required. + Crl *types.CrlDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteCrlMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteCrl{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteCrl{}, 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 = addOpDeleteCrlValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteCrl(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_opDeleteCrl(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "DeleteCrl", + } +} diff --git a/service/rolesanywhere/api_op_DeleteProfile.go b/service/rolesanywhere/api_op_DeleteProfile.go new file mode 100644 index 00000000000..4d3fda4e657 --- /dev/null +++ b/service/rolesanywhere/api_op_DeleteProfile.go @@ -0,0 +1,121 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a profile. Required permissions: rolesanywhere:DeleteProfile. +func (c *Client) DeleteProfile(ctx context.Context, params *DeleteProfileInput, optFns ...func(*Options)) (*DeleteProfileOutput, error) { + if params == nil { + params = &DeleteProfileInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteProfile", params, optFns, c.addOperationDeleteProfileMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteProfileOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteProfileInput struct { + + // The unique identifier of the profile. + // + // This member is required. + ProfileId *string + + noSmithyDocumentSerde +} + +type DeleteProfileOutput struct { + + // The state of the profile after a read or write operation. + Profile *types.ProfileDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteProfile{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteProfile{}, 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 = addOpDeleteProfileValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteProfile(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_opDeleteProfile(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "DeleteProfile", + } +} diff --git a/service/rolesanywhere/api_op_DeleteTrustAnchor.go b/service/rolesanywhere/api_op_DeleteTrustAnchor.go new file mode 100644 index 00000000000..88ad1e435ed --- /dev/null +++ b/service/rolesanywhere/api_op_DeleteTrustAnchor.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a trust anchor. Required permissions: rolesanywhere:DeleteTrustAnchor. +func (c *Client) DeleteTrustAnchor(ctx context.Context, params *DeleteTrustAnchorInput, optFns ...func(*Options)) (*DeleteTrustAnchorOutput, error) { + if params == nil { + params = &DeleteTrustAnchorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteTrustAnchor", params, optFns, c.addOperationDeleteTrustAnchorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteTrustAnchorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteTrustAnchorInput struct { + + // The unique identifier of the trust anchor. + // + // This member is required. + TrustAnchorId *string + + noSmithyDocumentSerde +} + +type DeleteTrustAnchorOutput struct { + + // The state of the trust anchor after a read or write operation. + // + // This member is required. + TrustAnchor *types.TrustAnchorDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteTrustAnchorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteTrustAnchor{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteTrustAnchor{}, 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 = addOpDeleteTrustAnchorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteTrustAnchor(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_opDeleteTrustAnchor(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "DeleteTrustAnchor", + } +} diff --git a/service/rolesanywhere/api_op_DisableCrl.go b/service/rolesanywhere/api_op_DisableCrl.go new file mode 100644 index 00000000000..89532032177 --- /dev/null +++ b/service/rolesanywhere/api_op_DisableCrl.go @@ -0,0 +1,125 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Disables a certificate revocation list (CRL). Required permissions: +// rolesanywhere:DisableCrl. +func (c *Client) DisableCrl(ctx context.Context, params *DisableCrlInput, optFns ...func(*Options)) (*DisableCrlOutput, error) { + if params == nil { + params = &DisableCrlInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisableCrl", params, optFns, c.addOperationDisableCrlMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisableCrlOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisableCrlInput struct { + + // The unique identifier of the certificate revocation list (CRL). + // + // This member is required. + CrlId *string + + noSmithyDocumentSerde +} + +type DisableCrlOutput struct { + + // The state of the certificate revocation list (CRL) after a read or write + // operation. + // + // This member is required. + Crl *types.CrlDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisableCrlMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisableCrl{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisableCrl{}, 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 = addOpDisableCrlValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisableCrl(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_opDisableCrl(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "DisableCrl", + } +} diff --git a/service/rolesanywhere/api_op_DisableProfile.go b/service/rolesanywhere/api_op_DisableProfile.go new file mode 100644 index 00000000000..70f890c4081 --- /dev/null +++ b/service/rolesanywhere/api_op_DisableProfile.go @@ -0,0 +1,124 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Disables a profile. When disabled, CreateSession +// (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) +// requests with this profile fail. Required permissions: +// rolesanywhere:DisableProfile. +func (c *Client) DisableProfile(ctx context.Context, params *DisableProfileInput, optFns ...func(*Options)) (*DisableProfileOutput, error) { + if params == nil { + params = &DisableProfileInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisableProfile", params, optFns, c.addOperationDisableProfileMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisableProfileOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisableProfileInput struct { + + // The unique identifier of the profile. + // + // This member is required. + ProfileId *string + + noSmithyDocumentSerde +} + +type DisableProfileOutput struct { + + // The state of the profile after a read or write operation. + Profile *types.ProfileDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisableProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisableProfile{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisableProfile{}, 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 = addOpDisableProfileValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisableProfile(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_opDisableProfile(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "DisableProfile", + } +} diff --git a/service/rolesanywhere/api_op_DisableTrustAnchor.go b/service/rolesanywhere/api_op_DisableTrustAnchor.go new file mode 100644 index 00000000000..e53b6662cd3 --- /dev/null +++ b/service/rolesanywhere/api_op_DisableTrustAnchor.go @@ -0,0 +1,126 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Disables a trust anchor. When disabled, CreateSession +// (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) +// requests specifying this trust anchor are unauthorized. Required permissions: +// rolesanywhere:DisableTrustAnchor. +func (c *Client) DisableTrustAnchor(ctx context.Context, params *DisableTrustAnchorInput, optFns ...func(*Options)) (*DisableTrustAnchorOutput, error) { + if params == nil { + params = &DisableTrustAnchorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisableTrustAnchor", params, optFns, c.addOperationDisableTrustAnchorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisableTrustAnchorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisableTrustAnchorInput struct { + + // The unique identifier of the trust anchor. + // + // This member is required. + TrustAnchorId *string + + noSmithyDocumentSerde +} + +type DisableTrustAnchorOutput struct { + + // The state of the trust anchor after a read or write operation. + // + // This member is required. + TrustAnchor *types.TrustAnchorDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisableTrustAnchorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisableTrustAnchor{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisableTrustAnchor{}, 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 = addOpDisableTrustAnchorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisableTrustAnchor(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_opDisableTrustAnchor(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "DisableTrustAnchor", + } +} diff --git a/service/rolesanywhere/api_op_EnableCrl.go b/service/rolesanywhere/api_op_EnableCrl.go new file mode 100644 index 00000000000..f061c478c72 --- /dev/null +++ b/service/rolesanywhere/api_op_EnableCrl.go @@ -0,0 +1,126 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Enables a certificate revocation list (CRL). When enabled, certificates stored +// in the CRL are unauthorized to receive session credentials. Required +// permissions: rolesanywhere:EnableCrl. +func (c *Client) EnableCrl(ctx context.Context, params *EnableCrlInput, optFns ...func(*Options)) (*EnableCrlOutput, error) { + if params == nil { + params = &EnableCrlInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "EnableCrl", params, optFns, c.addOperationEnableCrlMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*EnableCrlOutput) + out.ResultMetadata = metadata + return out, nil +} + +type EnableCrlInput struct { + + // The unique identifier of the certificate revocation list (CRL). + // + // This member is required. + CrlId *string + + noSmithyDocumentSerde +} + +type EnableCrlOutput struct { + + // The state of the certificate revocation list (CRL) after a read or write + // operation. + // + // This member is required. + Crl *types.CrlDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationEnableCrlMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpEnableCrl{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpEnableCrl{}, 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 = addOpEnableCrlValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opEnableCrl(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_opEnableCrl(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "EnableCrl", + } +} diff --git a/service/rolesanywhere/api_op_EnableProfile.go b/service/rolesanywhere/api_op_EnableProfile.go new file mode 100644 index 00000000000..dc7e98ba5a9 --- /dev/null +++ b/service/rolesanywhere/api_op_EnableProfile.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Enables the roles in a profile to receive session credentials in CreateSession +// (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html). +// Required permissions: rolesanywhere:EnableProfile. +func (c *Client) EnableProfile(ctx context.Context, params *EnableProfileInput, optFns ...func(*Options)) (*EnableProfileOutput, error) { + if params == nil { + params = &EnableProfileInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "EnableProfile", params, optFns, c.addOperationEnableProfileMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*EnableProfileOutput) + out.ResultMetadata = metadata + return out, nil +} + +type EnableProfileInput struct { + + // The unique identifier of the profile. + // + // This member is required. + ProfileId *string + + noSmithyDocumentSerde +} + +type EnableProfileOutput struct { + + // The state of the profile after a read or write operation. + Profile *types.ProfileDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationEnableProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpEnableProfile{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpEnableProfile{}, 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 = addOpEnableProfileValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opEnableProfile(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_opEnableProfile(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "EnableProfile", + } +} diff --git a/service/rolesanywhere/api_op_EnableTrustAnchor.go b/service/rolesanywhere/api_op_EnableTrustAnchor.go new file mode 100644 index 00000000000..6e9acbeb848 --- /dev/null +++ b/service/rolesanywhere/api_op_EnableTrustAnchor.go @@ -0,0 +1,125 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Enables a trust anchor. When enabled, certificates in the trust anchor chain are +// authorized for trust validation. Required permissions: +// rolesanywhere:EnableTrustAnchor. +func (c *Client) EnableTrustAnchor(ctx context.Context, params *EnableTrustAnchorInput, optFns ...func(*Options)) (*EnableTrustAnchorOutput, error) { + if params == nil { + params = &EnableTrustAnchorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "EnableTrustAnchor", params, optFns, c.addOperationEnableTrustAnchorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*EnableTrustAnchorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type EnableTrustAnchorInput struct { + + // The unique identifier of the trust anchor. + // + // This member is required. + TrustAnchorId *string + + noSmithyDocumentSerde +} + +type EnableTrustAnchorOutput struct { + + // The state of the trust anchor after a read or write operation. + // + // This member is required. + TrustAnchor *types.TrustAnchorDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationEnableTrustAnchorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpEnableTrustAnchor{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpEnableTrustAnchor{}, 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 = addOpEnableTrustAnchorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opEnableTrustAnchor(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_opEnableTrustAnchor(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "EnableTrustAnchor", + } +} diff --git a/service/rolesanywhere/api_op_GetCrl.go b/service/rolesanywhere/api_op_GetCrl.go new file mode 100644 index 00000000000..22bc6f759d5 --- /dev/null +++ b/service/rolesanywhere/api_op_GetCrl.go @@ -0,0 +1,125 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a certificate revocation list (CRL). Required permissions: +// rolesanywhere:GetCrl. +func (c *Client) GetCrl(ctx context.Context, params *GetCrlInput, optFns ...func(*Options)) (*GetCrlOutput, error) { + if params == nil { + params = &GetCrlInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetCrl", params, optFns, c.addOperationGetCrlMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetCrlOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetCrlInput struct { + + // The unique identifier of the certificate revocation list (CRL). + // + // This member is required. + CrlId *string + + noSmithyDocumentSerde +} + +type GetCrlOutput struct { + + // The state of the certificate revocation list (CRL) after a read or write + // operation. + // + // This member is required. + Crl *types.CrlDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetCrlMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetCrl{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetCrl{}, 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 = addOpGetCrlValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetCrl(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_opGetCrl(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "GetCrl", + } +} diff --git a/service/rolesanywhere/api_op_GetProfile.go b/service/rolesanywhere/api_op_GetProfile.go new file mode 100644 index 00000000000..3ac57c9dd4f --- /dev/null +++ b/service/rolesanywhere/api_op_GetProfile.go @@ -0,0 +1,121 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a profile. Required permissions: rolesanywhere:GetProfile. +func (c *Client) GetProfile(ctx context.Context, params *GetProfileInput, optFns ...func(*Options)) (*GetProfileOutput, error) { + if params == nil { + params = &GetProfileInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetProfile", params, optFns, c.addOperationGetProfileMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetProfileOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetProfileInput struct { + + // The unique identifier of the profile. + // + // This member is required. + ProfileId *string + + noSmithyDocumentSerde +} + +type GetProfileOutput struct { + + // The state of the profile after a read or write operation. + Profile *types.ProfileDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetProfile{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetProfile{}, 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 = addOpGetProfileValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetProfile(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_opGetProfile(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "GetProfile", + } +} diff --git a/service/rolesanywhere/api_op_GetSubject.go b/service/rolesanywhere/api_op_GetSubject.go new file mode 100644 index 00000000000..7efe3522f87 --- /dev/null +++ b/service/rolesanywhere/api_op_GetSubject.go @@ -0,0 +1,125 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a Subject. A Subject associates a certificate identity with authentication +// attempts by CreateSession. The Subject resources stores audit information such +// as status of the last authentication attempt, the certificate data used in the +// attempt, and the last time the associated identity attempted authentication. +// Required permissions: rolesanywhere:GetSubject. +func (c *Client) GetSubject(ctx context.Context, params *GetSubjectInput, optFns ...func(*Options)) (*GetSubjectOutput, error) { + if params == nil { + params = &GetSubjectInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetSubject", params, optFns, c.addOperationGetSubjectMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetSubjectOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetSubjectInput struct { + + // The unique identifier of the subject. + // + // This member is required. + SubjectId *string + + noSmithyDocumentSerde +} + +type GetSubjectOutput struct { + + // The state of the subject after a read or write operation. + Subject *types.SubjectDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetSubjectMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetSubject{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetSubject{}, 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 = addOpGetSubjectValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSubject(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_opGetSubject(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "GetSubject", + } +} diff --git a/service/rolesanywhere/api_op_GetTrustAnchor.go b/service/rolesanywhere/api_op_GetTrustAnchor.go new file mode 100644 index 00000000000..173f1adc330 --- /dev/null +++ b/service/rolesanywhere/api_op_GetTrustAnchor.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a trust anchor. Required permissions: rolesanywhere:GetTrustAnchor. +func (c *Client) GetTrustAnchor(ctx context.Context, params *GetTrustAnchorInput, optFns ...func(*Options)) (*GetTrustAnchorOutput, error) { + if params == nil { + params = &GetTrustAnchorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetTrustAnchor", params, optFns, c.addOperationGetTrustAnchorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetTrustAnchorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetTrustAnchorInput struct { + + // The unique identifier of the trust anchor. + // + // This member is required. + TrustAnchorId *string + + noSmithyDocumentSerde +} + +type GetTrustAnchorOutput struct { + + // The state of the trust anchor after a read or write operation. + // + // This member is required. + TrustAnchor *types.TrustAnchorDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetTrustAnchorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetTrustAnchor{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetTrustAnchor{}, 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 = addOpGetTrustAnchorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTrustAnchor(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_opGetTrustAnchor(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "GetTrustAnchor", + } +} diff --git a/service/rolesanywhere/api_op_ImportCrl.go b/service/rolesanywhere/api_op_ImportCrl.go new file mode 100644 index 00000000000..36935e58055 --- /dev/null +++ b/service/rolesanywhere/api_op_ImportCrl.go @@ -0,0 +1,144 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Imports the certificate revocation list (CRL). CRl is a list of certificates +// that have been revoked by the issuing certificate Authority (CA). IAM Roles +// Anywhere validates against the crl list before issuing credentials. Required +// permissions: rolesanywhere:ImportCrl. +func (c *Client) ImportCrl(ctx context.Context, params *ImportCrlInput, optFns ...func(*Options)) (*ImportCrlOutput, error) { + if params == nil { + params = &ImportCrlInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ImportCrl", params, optFns, c.addOperationImportCrlMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ImportCrlOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ImportCrlInput struct { + + // The x509 v3 specified certificate revocation list + // + // This member is required. + CrlData []byte + + // The name of the certificate revocation list (CRL). + // + // This member is required. + Name *string + + // The ARN of the TrustAnchor the certificate revocation list (CRL) will provide + // revocation for. + // + // This member is required. + TrustAnchorArn *string + + // Specifies whether the certificate revocation list (CRL) is enabled. + Enabled *bool + + // A list of tags to attach to the certificate revocation list (CRL). + Tags []types.Tag + + noSmithyDocumentSerde +} + +type ImportCrlOutput struct { + + // The state of the certificate revocation list (CRL) after a read or write + // operation. + // + // This member is required. + Crl *types.CrlDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationImportCrlMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpImportCrl{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpImportCrl{}, 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 = addOpImportCrlValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opImportCrl(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_opImportCrl(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "ImportCrl", + } +} diff --git a/service/rolesanywhere/api_op_ListCrls.go b/service/rolesanywhere/api_op_ListCrls.go new file mode 100644 index 00000000000..d1c7966991f --- /dev/null +++ b/service/rolesanywhere/api_op_ListCrls.go @@ -0,0 +1,205 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists all Crls in the authenticated account and Amazon Web Services Region. +// Required permissions: rolesanywhere:ListCrls. +func (c *Client) ListCrls(ctx context.Context, params *ListCrlsInput, optFns ...func(*Options)) (*ListCrlsOutput, error) { + if params == nil { + params = &ListCrlsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListCrls", params, optFns, c.addOperationListCrlsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListCrlsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListCrlsInput struct { + + // A token that indicates where the output should continue from, if a previous + // operation did not show all results. To get the next results, call the operation + // again with this value. + NextToken *string + + // The number of resources in the paginated list. + PageSize *int32 + + noSmithyDocumentSerde +} + +type ListCrlsOutput struct { + + // A list of certificate revocation lists (CRL). + Crls []types.CrlDetail + + // A token that indicates where the output should continue from, if a previous + // operation did not show all results. To get the next results, call the operation + // again with this value. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListCrlsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListCrls{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListCrls{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListCrls(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 +} + +// ListCrlsAPIClient is a client that implements the ListCrls operation. +type ListCrlsAPIClient interface { + ListCrls(context.Context, *ListCrlsInput, ...func(*Options)) (*ListCrlsOutput, error) +} + +var _ ListCrlsAPIClient = (*Client)(nil) + +// ListCrlsPaginatorOptions is the paginator options for ListCrls +type ListCrlsPaginatorOptions struct { + // 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 +} + +// ListCrlsPaginator is a paginator for ListCrls +type ListCrlsPaginator struct { + options ListCrlsPaginatorOptions + client ListCrlsAPIClient + params *ListCrlsInput + nextToken *string + firstPage bool +} + +// NewListCrlsPaginator returns a new ListCrlsPaginator +func NewListCrlsPaginator(client ListCrlsAPIClient, params *ListCrlsInput, optFns ...func(*ListCrlsPaginatorOptions)) *ListCrlsPaginator { + if params == nil { + params = &ListCrlsInput{} + } + + options := ListCrlsPaginatorOptions{} + + for _, fn := range optFns { + fn(&options) + } + + return &ListCrlsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListCrlsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListCrls page. +func (p *ListCrlsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListCrlsOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + result, err := p.client.ListCrls(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_opListCrls(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "ListCrls", + } +} diff --git a/service/rolesanywhere/api_op_ListProfiles.go b/service/rolesanywhere/api_op_ListProfiles.go new file mode 100644 index 00000000000..dff51c1c905 --- /dev/null +++ b/service/rolesanywhere/api_op_ListProfiles.go @@ -0,0 +1,205 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists all profiles in the authenticated account and Amazon Web Services Region. +// Required permissions: rolesanywhere:ListProfiles. +func (c *Client) ListProfiles(ctx context.Context, params *ListProfilesInput, optFns ...func(*Options)) (*ListProfilesOutput, error) { + if params == nil { + params = &ListProfilesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListProfiles", params, optFns, c.addOperationListProfilesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListProfilesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListProfilesInput struct { + + // A token that indicates where the output should continue from, if a previous + // operation did not show all results. To get the next results, call the operation + // again with this value. + NextToken *string + + // The number of resources in the paginated list. + PageSize *int32 + + noSmithyDocumentSerde +} + +type ListProfilesOutput struct { + + // A token that indicates where the output should continue from, if a previous + // operation did not show all results. To get the next results, call the operation + // again with this value. + NextToken *string + + // A list of profiles. + Profiles []types.ProfileDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListProfilesMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListProfiles{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListProfiles{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListProfiles(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 +} + +// ListProfilesAPIClient is a client that implements the ListProfiles operation. +type ListProfilesAPIClient interface { + ListProfiles(context.Context, *ListProfilesInput, ...func(*Options)) (*ListProfilesOutput, error) +} + +var _ ListProfilesAPIClient = (*Client)(nil) + +// ListProfilesPaginatorOptions is the paginator options for ListProfiles +type ListProfilesPaginatorOptions struct { + // 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 +} + +// ListProfilesPaginator is a paginator for ListProfiles +type ListProfilesPaginator struct { + options ListProfilesPaginatorOptions + client ListProfilesAPIClient + params *ListProfilesInput + nextToken *string + firstPage bool +} + +// NewListProfilesPaginator returns a new ListProfilesPaginator +func NewListProfilesPaginator(client ListProfilesAPIClient, params *ListProfilesInput, optFns ...func(*ListProfilesPaginatorOptions)) *ListProfilesPaginator { + if params == nil { + params = &ListProfilesInput{} + } + + options := ListProfilesPaginatorOptions{} + + for _, fn := range optFns { + fn(&options) + } + + return &ListProfilesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListProfilesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListProfiles page. +func (p *ListProfilesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListProfilesOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + result, err := p.client.ListProfiles(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_opListProfiles(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "ListProfiles", + } +} diff --git a/service/rolesanywhere/api_op_ListSubjects.go b/service/rolesanywhere/api_op_ListSubjects.go new file mode 100644 index 00000000000..7db9fa36419 --- /dev/null +++ b/service/rolesanywhere/api_op_ListSubjects.go @@ -0,0 +1,205 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the subjects in the authenticated account and Amazon Web Services Region. +// Required permissions: rolesanywhere:ListSubjects. +func (c *Client) ListSubjects(ctx context.Context, params *ListSubjectsInput, optFns ...func(*Options)) (*ListSubjectsOutput, error) { + if params == nil { + params = &ListSubjectsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListSubjects", params, optFns, c.addOperationListSubjectsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListSubjectsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListSubjectsInput struct { + + // A token that indicates where the output should continue from, if a previous + // operation did not show all results. To get the next results, call the operation + // again with this value. + NextToken *string + + // The number of resources in the paginated list. + PageSize *int32 + + noSmithyDocumentSerde +} + +type ListSubjectsOutput struct { + + // A token that indicates where the output should continue from, if a previous + // operation did not show all results. To get the next results, call the operation + // again with this value. + NextToken *string + + // A list of subjects. + Subjects []types.SubjectSummary + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListSubjectsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListSubjects{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListSubjects{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListSubjects(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 +} + +// ListSubjectsAPIClient is a client that implements the ListSubjects operation. +type ListSubjectsAPIClient interface { + ListSubjects(context.Context, *ListSubjectsInput, ...func(*Options)) (*ListSubjectsOutput, error) +} + +var _ ListSubjectsAPIClient = (*Client)(nil) + +// ListSubjectsPaginatorOptions is the paginator options for ListSubjects +type ListSubjectsPaginatorOptions struct { + // 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 +} + +// ListSubjectsPaginator is a paginator for ListSubjects +type ListSubjectsPaginator struct { + options ListSubjectsPaginatorOptions + client ListSubjectsAPIClient + params *ListSubjectsInput + nextToken *string + firstPage bool +} + +// NewListSubjectsPaginator returns a new ListSubjectsPaginator +func NewListSubjectsPaginator(client ListSubjectsAPIClient, params *ListSubjectsInput, optFns ...func(*ListSubjectsPaginatorOptions)) *ListSubjectsPaginator { + if params == nil { + params = &ListSubjectsInput{} + } + + options := ListSubjectsPaginatorOptions{} + + for _, fn := range optFns { + fn(&options) + } + + return &ListSubjectsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListSubjectsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListSubjects page. +func (p *ListSubjectsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListSubjectsOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + result, err := p.client.ListSubjects(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_opListSubjects(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "ListSubjects", + } +} diff --git a/service/rolesanywhere/api_op_ListTagsForResource.go b/service/rolesanywhere/api_op_ListTagsForResource.go new file mode 100644 index 00000000000..2a0260d1b42 --- /dev/null +++ b/service/rolesanywhere/api_op_ListTagsForResource.go @@ -0,0 +1,122 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the tags attached to the resource. Required permissions: +// rolesanywhere:ListTagsForResource. +func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) { + if params == nil { + params = &ListTagsForResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListTagsForResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListTagsForResourceInput struct { + + // The ARN of the resource. + // + // This member is required. + ResourceArn *string + + noSmithyDocumentSerde +} + +type ListTagsForResourceOutput struct { + + // A list of tags attached to the resource. + Tags []types.Tag + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListTagsForResource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTagsForResource{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "ListTagsForResource", + } +} diff --git a/service/rolesanywhere/api_op_ListTrustAnchors.go b/service/rolesanywhere/api_op_ListTrustAnchors.go new file mode 100644 index 00000000000..4d91f9d38f4 --- /dev/null +++ b/service/rolesanywhere/api_op_ListTrustAnchors.go @@ -0,0 +1,206 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the trust anchors in the authenticated account and Amazon Web Services +// Region. Required permissions: rolesanywhere:ListTrustAnchors. +func (c *Client) ListTrustAnchors(ctx context.Context, params *ListTrustAnchorsInput, optFns ...func(*Options)) (*ListTrustAnchorsOutput, error) { + if params == nil { + params = &ListTrustAnchorsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListTrustAnchors", params, optFns, c.addOperationListTrustAnchorsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListTrustAnchorsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListTrustAnchorsInput struct { + + // A token that indicates where the output should continue from, if a previous + // operation did not show all results. To get the next results, call the operation + // again with this value. + NextToken *string + + // The number of resources in the paginated list. + PageSize *int32 + + noSmithyDocumentSerde +} + +type ListTrustAnchorsOutput struct { + + // A token that indicates where the output should continue from, if a previous + // operation did not show all results. To get the next results, call the operation + // again with this value. + NextToken *string + + // A list of trust anchors. + TrustAnchors []types.TrustAnchorDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListTrustAnchorsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListTrustAnchors{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTrustAnchors{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTrustAnchors(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 +} + +// ListTrustAnchorsAPIClient is a client that implements the ListTrustAnchors +// operation. +type ListTrustAnchorsAPIClient interface { + ListTrustAnchors(context.Context, *ListTrustAnchorsInput, ...func(*Options)) (*ListTrustAnchorsOutput, error) +} + +var _ ListTrustAnchorsAPIClient = (*Client)(nil) + +// ListTrustAnchorsPaginatorOptions is the paginator options for ListTrustAnchors +type ListTrustAnchorsPaginatorOptions struct { + // 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 +} + +// ListTrustAnchorsPaginator is a paginator for ListTrustAnchors +type ListTrustAnchorsPaginator struct { + options ListTrustAnchorsPaginatorOptions + client ListTrustAnchorsAPIClient + params *ListTrustAnchorsInput + nextToken *string + firstPage bool +} + +// NewListTrustAnchorsPaginator returns a new ListTrustAnchorsPaginator +func NewListTrustAnchorsPaginator(client ListTrustAnchorsAPIClient, params *ListTrustAnchorsInput, optFns ...func(*ListTrustAnchorsPaginatorOptions)) *ListTrustAnchorsPaginator { + if params == nil { + params = &ListTrustAnchorsInput{} + } + + options := ListTrustAnchorsPaginatorOptions{} + + for _, fn := range optFns { + fn(&options) + } + + return &ListTrustAnchorsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListTrustAnchorsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListTrustAnchors page. +func (p *ListTrustAnchorsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListTrustAnchorsOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + result, err := p.client.ListTrustAnchors(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_opListTrustAnchors(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "ListTrustAnchors", + } +} diff --git a/service/rolesanywhere/api_op_TagResource.go b/service/rolesanywhere/api_op_TagResource.go new file mode 100644 index 00000000000..3717c7c22e3 --- /dev/null +++ b/service/rolesanywhere/api_op_TagResource.go @@ -0,0 +1,122 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Attaches tags to a resource. Required permissions: rolesanywhere:TagResource. +func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) { + if params == nil { + params = &TagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*TagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type TagResourceInput struct { + + // The ARN of the resource. + // + // This member is required. + ResourceArn *string + + // The tags to attach to the resource. + // + // This member is required. + Tags []types.Tag + + noSmithyDocumentSerde +} + +type TagResourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpTagResource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTagResource{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpTagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "TagResource", + } +} diff --git a/service/rolesanywhere/api_op_UntagResource.go b/service/rolesanywhere/api_op_UntagResource.go new file mode 100644 index 00000000000..3ae1caa751f --- /dev/null +++ b/service/rolesanywhere/api_op_UntagResource.go @@ -0,0 +1,122 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes tags from the resource. Required permissions: +// rolesanywhere:UntagResource. +func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) { + if params == nil { + params = &UntagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UntagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UntagResourceInput struct { + + // The ARN of the resource. + // + // This member is required. + ResourceArn *string + + // A list of keys. Tag keys are the unique identifiers of tags. + // + // This member is required. + TagKeys []string + + noSmithyDocumentSerde +} + +type UntagResourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUntagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpUntagResource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUntagResource{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpUntagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "UntagResource", + } +} diff --git a/service/rolesanywhere/api_op_UpdateCrl.go b/service/rolesanywhere/api_op_UpdateCrl.go new file mode 100644 index 00000000000..e513c7e13bb --- /dev/null +++ b/service/rolesanywhere/api_op_UpdateCrl.go @@ -0,0 +1,133 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates the certificate revocation list (CRL). CRl is a list of certificates +// that have been revoked by the issuing certificate Authority (CA). IAM Roles +// Anywhere validates against the crl list before issuing credentials. Required +// permissions: rolesanywhere:UpdateCrl. +func (c *Client) UpdateCrl(ctx context.Context, params *UpdateCrlInput, optFns ...func(*Options)) (*UpdateCrlOutput, error) { + if params == nil { + params = &UpdateCrlInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateCrl", params, optFns, c.addOperationUpdateCrlMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateCrlOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateCrlInput struct { + + // The unique identifier of the certificate revocation list (CRL). + // + // This member is required. + CrlId *string + + // The x509 v3 specified certificate revocation list + CrlData []byte + + // The name of the Crl. + Name *string + + noSmithyDocumentSerde +} + +type UpdateCrlOutput struct { + + // The state of the certificate revocation list (CRL) after a read or write + // operation. + // + // This member is required. + Crl *types.CrlDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateCrlMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateCrl{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateCrl{}, 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 = addOpUpdateCrlValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateCrl(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_opUpdateCrl(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "UpdateCrl", + } +} diff --git a/service/rolesanywhere/api_op_UpdateProfile.go b/service/rolesanywhere/api_op_UpdateProfile.go new file mode 100644 index 00000000000..0d101bca994 --- /dev/null +++ b/service/rolesanywhere/api_op_UpdateProfile.go @@ -0,0 +1,142 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates the profile. A profile is configuration resource to list the roles that +// RolesAnywhere service is trusted to assume. In addition, by applying a profile +// you can scope-down permissions with IAM managed policies. Required permissions: +// rolesanywhere:UpdateProfile. +func (c *Client) UpdateProfile(ctx context.Context, params *UpdateProfileInput, optFns ...func(*Options)) (*UpdateProfileOutput, error) { + if params == nil { + params = &UpdateProfileInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateProfile", params, optFns, c.addOperationUpdateProfileMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateProfileOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateProfileInput struct { + + // The unique identifier of the profile. + // + // This member is required. + ProfileId *string + + // The number of seconds the vended session credentials are valid for. + DurationSeconds *int32 + + // A list of managed policy ARNs that apply to the vended session credentials. + ManagedPolicyArns []string + + // The name of the profile. + Name *string + + // A list of IAM roles that this profile can assume in a CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation. + RoleArns []string + + // A session policy that applies to the trust boundary of the vended session + // credentials. + SessionPolicy *string + + noSmithyDocumentSerde +} + +type UpdateProfileOutput struct { + + // The state of the profile after a read or write operation. + Profile *types.ProfileDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateProfileMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateProfile{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateProfile{}, 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 = addOpUpdateProfileValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateProfile(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_opUpdateProfile(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "UpdateProfile", + } +} diff --git a/service/rolesanywhere/api_op_UpdateTrustAnchor.go b/service/rolesanywhere/api_op_UpdateTrustAnchor.go new file mode 100644 index 00000000000..89a0ee246f6 --- /dev/null +++ b/service/rolesanywhere/api_op_UpdateTrustAnchor.go @@ -0,0 +1,135 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +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/rolesanywhere/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Updates the trust anchor.You establish trust between IAM Roles Anywhere and your +// certificate authority (CA) by configuring a trust anchor. A Trust Anchor is +// defined either as a reference to a AWS Certificate Manager Private Certificate +// Authority (ACM PCA), or by uploading a Certificate Authority (CA) certificate. +// Your AWS workloads can authenticate with the trust anchor using certificates +// issued by the trusted Certificate Authority (CA) in exchange for temporary AWS +// credentials. Required permissions: rolesanywhere:UpdateTrustAnchor. +func (c *Client) UpdateTrustAnchor(ctx context.Context, params *UpdateTrustAnchorInput, optFns ...func(*Options)) (*UpdateTrustAnchorOutput, error) { + if params == nil { + params = &UpdateTrustAnchorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateTrustAnchor", params, optFns, c.addOperationUpdateTrustAnchorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateTrustAnchorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateTrustAnchorInput struct { + + // The unique identifier of the trust anchor. + // + // This member is required. + TrustAnchorId *string + + // The name of the trust anchor. + Name *string + + // The trust anchor type and its related certificate data. + Source *types.Source + + noSmithyDocumentSerde +} + +type UpdateTrustAnchorOutput struct { + + // The state of the trust anchor after a read or write operation. + // + // This member is required. + TrustAnchor *types.TrustAnchorDetail + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateTrustAnchorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateTrustAnchor{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateTrustAnchor{}, 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 = addOpUpdateTrustAnchorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateTrustAnchor(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_opUpdateTrustAnchor(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "rolesanywhere", + OperationName: "UpdateTrustAnchor", + } +} diff --git a/service/rolesanywhere/deserializers.go b/service/rolesanywhere/deserializers.go new file mode 100644 index 00000000000..ea0c58a7306 --- /dev/null +++ b/service/rolesanywhere/deserializers.go @@ -0,0 +1,5373 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +import ( + "bytes" + "context" + "encoding/base64" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/rolesanywhere/types" + smithy "github.com/aws/smithy-go" + smithyio "github.com/aws/smithy-go/io" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithytime "github.com/aws/smithy-go/time" + smithyhttp "github.com/aws/smithy-go/transport/http" + "io" + "strings" +) + +type awsRestjson1_deserializeOpCreateProfile struct { +} + +func (*awsRestjson1_deserializeOpCreateProfile) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateProfile) 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_deserializeOpErrorCreateProfile(response, &metadata) + } + output := &CreateProfileOutput{} + 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_deserializeOpDocumentCreateProfileOutput(&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_deserializeOpErrorCreateProfile(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateProfileOutput(v **CreateProfileOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateProfileOutput + if *v == nil { + sv = &CreateProfileOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "profile": + if err := awsRestjson1_deserializeDocumentProfileDetail(&sv.Profile, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateTrustAnchor struct { +} + +func (*awsRestjson1_deserializeOpCreateTrustAnchor) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateTrustAnchor) 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_deserializeOpErrorCreateTrustAnchor(response, &metadata) + } + output := &CreateTrustAnchorOutput{} + 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_deserializeOpDocumentCreateTrustAnchorOutput(&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_deserializeOpErrorCreateTrustAnchor(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateTrustAnchorOutput(v **CreateTrustAnchorOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateTrustAnchorOutput + if *v == nil { + sv = &CreateTrustAnchorOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "trustAnchor": + if err := awsRestjson1_deserializeDocumentTrustAnchorDetail(&sv.TrustAnchor, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteCrl struct { +} + +func (*awsRestjson1_deserializeOpDeleteCrl) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteCrl) 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_deserializeOpErrorDeleteCrl(response, &metadata) + } + output := &DeleteCrlOutput{} + 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_deserializeOpDocumentDeleteCrlOutput(&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_deserializeOpErrorDeleteCrl(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDeleteCrlOutput(v **DeleteCrlOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteCrlOutput + if *v == nil { + sv = &DeleteCrlOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "crl": + if err := awsRestjson1_deserializeDocumentCrlDetail(&sv.Crl, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteProfile struct { +} + +func (*awsRestjson1_deserializeOpDeleteProfile) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteProfile) 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_deserializeOpErrorDeleteProfile(response, &metadata) + } + output := &DeleteProfileOutput{} + 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_deserializeOpDocumentDeleteProfileOutput(&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_deserializeOpErrorDeleteProfile(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDeleteProfileOutput(v **DeleteProfileOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteProfileOutput + if *v == nil { + sv = &DeleteProfileOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "profile": + if err := awsRestjson1_deserializeDocumentProfileDetail(&sv.Profile, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteTrustAnchor struct { +} + +func (*awsRestjson1_deserializeOpDeleteTrustAnchor) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteTrustAnchor) 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_deserializeOpErrorDeleteTrustAnchor(response, &metadata) + } + output := &DeleteTrustAnchorOutput{} + 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_deserializeOpDocumentDeleteTrustAnchorOutput(&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_deserializeOpErrorDeleteTrustAnchor(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDeleteTrustAnchorOutput(v **DeleteTrustAnchorOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteTrustAnchorOutput + if *v == nil { + sv = &DeleteTrustAnchorOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "trustAnchor": + if err := awsRestjson1_deserializeDocumentTrustAnchorDetail(&sv.TrustAnchor, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDisableCrl struct { +} + +func (*awsRestjson1_deserializeOpDisableCrl) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisableCrl) 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_deserializeOpErrorDisableCrl(response, &metadata) + } + output := &DisableCrlOutput{} + 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_deserializeOpDocumentDisableCrlOutput(&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_deserializeOpErrorDisableCrl(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDisableCrlOutput(v **DisableCrlOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DisableCrlOutput + if *v == nil { + sv = &DisableCrlOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "crl": + if err := awsRestjson1_deserializeDocumentCrlDetail(&sv.Crl, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDisableProfile struct { +} + +func (*awsRestjson1_deserializeOpDisableProfile) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisableProfile) 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_deserializeOpErrorDisableProfile(response, &metadata) + } + output := &DisableProfileOutput{} + 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_deserializeOpDocumentDisableProfileOutput(&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_deserializeOpErrorDisableProfile(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDisableProfileOutput(v **DisableProfileOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DisableProfileOutput + if *v == nil { + sv = &DisableProfileOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "profile": + if err := awsRestjson1_deserializeDocumentProfileDetail(&sv.Profile, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDisableTrustAnchor struct { +} + +func (*awsRestjson1_deserializeOpDisableTrustAnchor) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisableTrustAnchor) 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_deserializeOpErrorDisableTrustAnchor(response, &metadata) + } + output := &DisableTrustAnchorOutput{} + 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_deserializeOpDocumentDisableTrustAnchorOutput(&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_deserializeOpErrorDisableTrustAnchor(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDisableTrustAnchorOutput(v **DisableTrustAnchorOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DisableTrustAnchorOutput + if *v == nil { + sv = &DisableTrustAnchorOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "trustAnchor": + if err := awsRestjson1_deserializeDocumentTrustAnchorDetail(&sv.TrustAnchor, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpEnableCrl struct { +} + +func (*awsRestjson1_deserializeOpEnableCrl) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpEnableCrl) 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_deserializeOpErrorEnableCrl(response, &metadata) + } + output := &EnableCrlOutput{} + 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_deserializeOpDocumentEnableCrlOutput(&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_deserializeOpErrorEnableCrl(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentEnableCrlOutput(v **EnableCrlOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *EnableCrlOutput + if *v == nil { + sv = &EnableCrlOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "crl": + if err := awsRestjson1_deserializeDocumentCrlDetail(&sv.Crl, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpEnableProfile struct { +} + +func (*awsRestjson1_deserializeOpEnableProfile) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpEnableProfile) 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_deserializeOpErrorEnableProfile(response, &metadata) + } + output := &EnableProfileOutput{} + 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_deserializeOpDocumentEnableProfileOutput(&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_deserializeOpErrorEnableProfile(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentEnableProfileOutput(v **EnableProfileOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *EnableProfileOutput + if *v == nil { + sv = &EnableProfileOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "profile": + if err := awsRestjson1_deserializeDocumentProfileDetail(&sv.Profile, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpEnableTrustAnchor struct { +} + +func (*awsRestjson1_deserializeOpEnableTrustAnchor) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpEnableTrustAnchor) 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_deserializeOpErrorEnableTrustAnchor(response, &metadata) + } + output := &EnableTrustAnchorOutput{} + 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_deserializeOpDocumentEnableTrustAnchorOutput(&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_deserializeOpErrorEnableTrustAnchor(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentEnableTrustAnchorOutput(v **EnableTrustAnchorOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *EnableTrustAnchorOutput + if *v == nil { + sv = &EnableTrustAnchorOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "trustAnchor": + if err := awsRestjson1_deserializeDocumentTrustAnchorDetail(&sv.TrustAnchor, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetCrl struct { +} + +func (*awsRestjson1_deserializeOpGetCrl) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetCrl) 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_deserializeOpErrorGetCrl(response, &metadata) + } + output := &GetCrlOutput{} + 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_deserializeOpDocumentGetCrlOutput(&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_deserializeOpErrorGetCrl(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetCrlOutput(v **GetCrlOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetCrlOutput + if *v == nil { + sv = &GetCrlOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "crl": + if err := awsRestjson1_deserializeDocumentCrlDetail(&sv.Crl, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetProfile struct { +} + +func (*awsRestjson1_deserializeOpGetProfile) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetProfile) 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_deserializeOpErrorGetProfile(response, &metadata) + } + output := &GetProfileOutput{} + 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_deserializeOpDocumentGetProfileOutput(&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_deserializeOpErrorGetProfile(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetProfileOutput(v **GetProfileOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetProfileOutput + if *v == nil { + sv = &GetProfileOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "profile": + if err := awsRestjson1_deserializeDocumentProfileDetail(&sv.Profile, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetSubject struct { +} + +func (*awsRestjson1_deserializeOpGetSubject) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetSubject) 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_deserializeOpErrorGetSubject(response, &metadata) + } + output := &GetSubjectOutput{} + 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_deserializeOpDocumentGetSubjectOutput(&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_deserializeOpErrorGetSubject(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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetSubjectOutput(v **GetSubjectOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetSubjectOutput + if *v == nil { + sv = &GetSubjectOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "subject": + if err := awsRestjson1_deserializeDocumentSubjectDetail(&sv.Subject, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetTrustAnchor struct { +} + +func (*awsRestjson1_deserializeOpGetTrustAnchor) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetTrustAnchor) 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_deserializeOpErrorGetTrustAnchor(response, &metadata) + } + output := &GetTrustAnchorOutput{} + 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_deserializeOpDocumentGetTrustAnchorOutput(&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_deserializeOpErrorGetTrustAnchor(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("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_deserializeOpDocumentGetTrustAnchorOutput(v **GetTrustAnchorOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetTrustAnchorOutput + if *v == nil { + sv = &GetTrustAnchorOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "trustAnchor": + if err := awsRestjson1_deserializeDocumentTrustAnchorDetail(&sv.TrustAnchor, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpImportCrl struct { +} + +func (*awsRestjson1_deserializeOpImportCrl) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpImportCrl) 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_deserializeOpErrorImportCrl(response, &metadata) + } + output := &ImportCrlOutput{} + 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_deserializeOpDocumentImportCrlOutput(&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_deserializeOpErrorImportCrl(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentImportCrlOutput(v **ImportCrlOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ImportCrlOutput + if *v == nil { + sv = &ImportCrlOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "crl": + if err := awsRestjson1_deserializeDocumentCrlDetail(&sv.Crl, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListCrls struct { +} + +func (*awsRestjson1_deserializeOpListCrls) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListCrls) 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_deserializeOpErrorListCrls(response, &metadata) + } + output := &ListCrlsOutput{} + 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_deserializeOpDocumentListCrlsOutput(&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_deserializeOpErrorListCrls(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListCrlsOutput(v **ListCrlsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListCrlsOutput + if *v == nil { + sv = &ListCrlsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "crls": + if err := awsRestjson1_deserializeDocumentCrlDetails(&sv.Crls, value); err != nil { + return err + } + + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListProfiles struct { +} + +func (*awsRestjson1_deserializeOpListProfiles) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListProfiles) 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_deserializeOpErrorListProfiles(response, &metadata) + } + output := &ListProfilesOutput{} + 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_deserializeOpDocumentListProfilesOutput(&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_deserializeOpErrorListProfiles(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListProfilesOutput(v **ListProfilesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListProfilesOutput + if *v == nil { + sv = &ListProfilesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "profiles": + if err := awsRestjson1_deserializeDocumentProfileDetails(&sv.Profiles, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListSubjects struct { +} + +func (*awsRestjson1_deserializeOpListSubjects) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListSubjects) 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_deserializeOpErrorListSubjects(response, &metadata) + } + output := &ListSubjectsOutput{} + 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_deserializeOpDocumentListSubjectsOutput(&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_deserializeOpErrorListSubjects(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListSubjectsOutput(v **ListSubjectsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListSubjectsOutput + if *v == nil { + sv = &ListSubjectsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "subjects": + if err := awsRestjson1_deserializeDocumentSubjectSummaries(&sv.Subjects, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListTagsForResource struct { +} + +func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) + } + output := &ListTagsForResourceOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + 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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListTagsForResourceOutput + if *v == nil { + sv = &ListTagsForResourceOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "tags": + if err := awsRestjson1_deserializeDocumentTagList(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListTrustAnchors struct { +} + +func (*awsRestjson1_deserializeOpListTrustAnchors) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListTrustAnchors) 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_deserializeOpErrorListTrustAnchors(response, &metadata) + } + output := &ListTrustAnchorsOutput{} + 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_deserializeOpDocumentListTrustAnchorsOutput(&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_deserializeOpErrorListTrustAnchors(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("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListTrustAnchorsOutput(v **ListTrustAnchorsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListTrustAnchorsOutput + if *v == nil { + sv = &ListTrustAnchorsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "nextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "trustAnchors": + if err := awsRestjson1_deserializeDocumentTrustAnchorDetails(&sv.TrustAnchors, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpTagResource struct { +} + +func (*awsRestjson1_deserializeOpTagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorTagResource(response, &metadata) + } + output := &TagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + 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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("TooManyTagsException", errorCode): + return awsRestjson1_deserializeErrorTooManyTagsException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUntagResource struct { +} + +func (*awsRestjson1_deserializeOpUntagResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorUntagResource(response, &metadata) + } + output := &UntagResourceOutput{} + out.Result = output + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + 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("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUpdateCrl struct { +} + +func (*awsRestjson1_deserializeOpUpdateCrl) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateCrl) 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_deserializeOpErrorUpdateCrl(response, &metadata) + } + output := &UpdateCrlOutput{} + 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_deserializeOpDocumentUpdateCrlOutput(&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_deserializeOpErrorUpdateCrl(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("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_deserializeOpDocumentUpdateCrlOutput(v **UpdateCrlOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateCrlOutput + if *v == nil { + sv = &UpdateCrlOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "crl": + if err := awsRestjson1_deserializeDocumentCrlDetail(&sv.Crl, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateProfile struct { +} + +func (*awsRestjson1_deserializeOpUpdateProfile) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateProfile) 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_deserializeOpErrorUpdateProfile(response, &metadata) + } + output := &UpdateProfileOutput{} + 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_deserializeOpDocumentUpdateProfileOutput(&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_deserializeOpErrorUpdateProfile(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("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_deserializeOpDocumentUpdateProfileOutput(v **UpdateProfileOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateProfileOutput + if *v == nil { + sv = &UpdateProfileOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "profile": + if err := awsRestjson1_deserializeDocumentProfileDetail(&sv.Profile, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpUpdateTrustAnchor struct { +} + +func (*awsRestjson1_deserializeOpUpdateTrustAnchor) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateTrustAnchor) 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_deserializeOpErrorUpdateTrustAnchor(response, &metadata) + } + output := &UpdateTrustAnchorOutput{} + 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_deserializeOpDocumentUpdateTrustAnchorOutput(&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_deserializeOpErrorUpdateTrustAnchor(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("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_deserializeOpDocumentUpdateTrustAnchorOutput(v **UpdateTrustAnchorOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *UpdateTrustAnchorOutput + if *v == nil { + sv = &UpdateTrustAnchorOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "trustAnchor": + if err := awsRestjson1_deserializeDocumentTrustAnchorDetail(&sv.TrustAnchor, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.AccessDeniedException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ResourceNotFoundException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorTooManyTagsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.TooManyTagsException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentTooManyTagsException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ValidationException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentValidationException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.AccessDeniedException + if *v == nil { + sv = &types.AccessDeniedException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentCredentialSummaries(v *[]types.CredentialSummary, 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.CredentialSummary + if *v == nil { + cv = []types.CredentialSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.CredentialSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentCredentialSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentCredentialSummary(v **types.CredentialSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.CredentialSummary + if *v == nil { + sv = &types.CredentialSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "enabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Enabled = ptr.Bool(jtv) + } + + case "failed": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Failed = ptr.Bool(jtv) + } + + case "issuer": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Issuer = ptr.String(jtv) + } + + case "seenAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.SeenAt = ptr.Time(t) + } + + case "serialNumber": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.SerialNumber = ptr.String(jtv) + } + + case "x509CertificateData": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.X509CertificateData = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentCrlDetail(v **types.CrlDetail, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.CrlDetail + if *v == nil { + sv = &types.CrlDetail{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "crlArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.CrlArn = ptr.String(jtv) + } + + case "crlData": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Blob to be []byte, got %T instead", value) + } + dv, err := base64.StdEncoding.DecodeString(jtv) + if err != nil { + return fmt.Errorf("failed to base64 decode Blob, %w", err) + } + sv.CrlData = dv + } + + case "crlId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.CrlId = ptr.String(jtv) + } + + case "enabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Enabled = ptr.Bool(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "trustAnchorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.TrustAnchorArn = ptr.String(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentCrlDetails(v *[]types.CrlDetail, 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.CrlDetail + if *v == nil { + cv = []types.CrlDetail{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.CrlDetail + destAddr := &col + if err := awsRestjson1_deserializeDocumentCrlDetail(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentInstanceProperties(v *[]types.InstanceProperty, 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.InstanceProperty + if *v == nil { + cv = []types.InstanceProperty{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.InstanceProperty + destAddr := &col + if err := awsRestjson1_deserializeDocumentInstanceProperty(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentInstanceProperty(v **types.InstanceProperty, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.InstanceProperty + if *v == nil { + sv = &types.InstanceProperty{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "failed": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Failed = ptr.Bool(jtv) + } + + case "properties": + if err := awsRestjson1_deserializeDocumentInstancePropertyMap(&sv.Properties, value); err != nil { + return err + } + + case "seenAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.SeenAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentInstancePropertyMap(v *map[string]string, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var mv map[string]string + if *v == nil { + mv = map[string]string{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + parsedVal = jtv + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentManagedPolicyList(v *[]string, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []string + if *v == nil { + cv = []string{} + } else { + cv = *v + } + + for _, value := range shape { + var col string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentProfileDetail(v **types.ProfileDetail, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ProfileDetail + if *v == nil { + sv = &types.ProfileDetail{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "createdBy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.CreatedBy = ptr.String(jtv) + } + + case "durationSeconds": + 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.DurationSeconds = ptr.Int32(int32(i64)) + } + + case "enabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Enabled = ptr.Bool(jtv) + } + + case "managedPolicyArns": + if err := awsRestjson1_deserializeDocumentManagedPolicyList(&sv.ManagedPolicyArns, value); err != nil { + return err + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "profileArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ProfileArn to be of type string, got %T instead", value) + } + sv.ProfileArn = ptr.String(jtv) + } + + case "profileId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.ProfileId = ptr.String(jtv) + } + + case "requireInstanceProperties": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireInstanceProperties = ptr.Bool(jtv) + } + + case "roleArns": + if err := awsRestjson1_deserializeDocumentRoleArnList(&sv.RoleArns, value); err != nil { + return err + } + + case "sessionPolicy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.SessionPolicy = ptr.String(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentProfileDetails(v *[]types.ProfileDetail, 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.ProfileDetail + if *v == nil { + cv = []types.ProfileDetail{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ProfileDetail + destAddr := &col + if err := awsRestjson1_deserializeDocumentProfileDetail(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ResourceNotFoundException + if *v == nil { + sv = &types.ResourceNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRoleArnList(v *[]string, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []string + if *v == nil { + cv = []string{} + } else { + cv = *v + } + + for _, value := range shape { + var col string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentSource(v **types.Source, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Source + if *v == nil { + sv = &types.Source{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "sourceData": + if err := awsRestjson1_deserializeDocumentSourceData(&sv.SourceData, value); err != nil { + return err + } + + case "sourceType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TrustAnchorType to be of type string, got %T instead", value) + } + sv.SourceType = types.TrustAnchorType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSourceData(v *types.SourceData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var uv types.SourceData +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "acmPcaArn": + var mv string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + mv = jtv + } + uv = &types.SourceDataMemberAcmPcaArn{Value: mv} + break loop + + case "x509CertificateData": + var mv string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + mv = jtv + } + uv = &types.SourceDataMemberX509CertificateData{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentSubjectDetail(v **types.SubjectDetail, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SubjectDetail + if *v == nil { + sv = &types.SubjectDetail{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "credentials": + if err := awsRestjson1_deserializeDocumentCredentialSummaries(&sv.Credentials, value); err != nil { + return err + } + + case "enabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Enabled = ptr.Bool(jtv) + } + + case "instanceProperties": + if err := awsRestjson1_deserializeDocumentInstanceProperties(&sv.InstanceProperties, value); err != nil { + return err + } + + case "lastSeenAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.LastSeenAt = ptr.Time(t) + } + + case "subjectArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.SubjectArn = ptr.String(jtv) + } + + case "subjectId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.SubjectId = ptr.String(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + case "x509Subject": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.X509Subject = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSubjectSummaries(v *[]types.SubjectSummary, 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.SubjectSummary + if *v == nil { + cv = []types.SubjectSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.SubjectSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentSubjectSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentSubjectSummary(v **types.SubjectSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SubjectSummary + if *v == nil { + sv = &types.SubjectSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "enabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Enabled = ptr.Bool(jtv) + } + + case "lastSeenAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.LastSeenAt = ptr.Time(t) + } + + case "subjectArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.SubjectArn = ptr.String(jtv) + } + + case "subjectId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.SubjectId = ptr.String(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + case "x509Subject": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.X509Subject = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTag(v **types.Tag, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.Tag + if *v == nil { + sv = &types.Tag{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "key": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TagKey to be of type string, got %T instead", value) + } + sv.Key = ptr.String(jtv) + } + + case "value": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) + } + sv.Value = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTagList(v *[]types.Tag, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.Tag + if *v == nil { + cv = []types.Tag{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Tag + destAddr := &col + if err := awsRestjson1_deserializeDocumentTag(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentTooManyTagsException(v **types.TooManyTagsException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.TooManyTagsException + if *v == nil { + sv = &types.TooManyTagsException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTrustAnchorDetail(v **types.TrustAnchorDetail, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TrustAnchorDetail + if *v == nil { + sv = &types.TrustAnchorDetail{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "createdAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(t) + } + + case "enabled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Enabled = ptr.Bool(jtv) + } + + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourceName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "source": + if err := awsRestjson1_deserializeDocumentSource(&sv.Source, value); err != nil { + return err + } + + case "trustAnchorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.TrustAnchorArn = ptr.String(jtv) + } + + case "trustAnchorId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Uuid to be of type string, got %T instead", value) + } + sv.TrustAnchorId = ptr.String(jtv) + } + + case "updatedAt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected Timestamp to be of type string, got %T instead", value) + } + t, err := smithytime.ParseDateTime(jtv) + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(t) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTrustAnchorDetails(v *[]types.TrustAnchorDetail, 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.TrustAnchorDetail + if *v == nil { + cv = []types.TrustAnchorDetail{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.TrustAnchorDetail + destAddr := &col + if err := awsRestjson1_deserializeDocumentTrustAnchorDetail(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ValidationException + if *v == nil { + sv = &types.ValidationException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} diff --git a/service/rolesanywhere/doc.go b/service/rolesanywhere/doc.go new file mode 100644 index 00000000000..381e7446b63 --- /dev/null +++ b/service/rolesanywhere/doc.go @@ -0,0 +1,21 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package rolesanywhere provides the API client, operations, and parameter types +// for IAM Roles Anywhere. +// +// AWS Identity and Access Management Roles Anywhere provides a secure way for your +// workloads such as servers, containers, and applications running outside of AWS +// to obtain Temporary AWS credentials. Your workloads can use the same IAM +// policies and roles that you have configured with native AWS applications to +// access AWS resources. Using IAM Roles Anywhere will eliminate the need to manage +// long term credentials for workloads running outside of AWS. To use IAM Roles +// Anywhere customer workloads will need to use X.509 certificates issued by their +// Certificate Authority (CA) . The Certificate Authority (CA) needs to be +// registered with IAM Roles Anywhere as a trust anchor to establish trust between +// customer PKI and IAM Roles Anywhere. Customers who do not manage their own PKI +// system can use AWS Certificate Manager Private Certificate Authority (ACM PCA) +// to create a Certificate Authority and use that to establish trust with IAM Roles +// Anywhere This guide describes the IAM rolesanywhere operations that you can call +// programmatically. For general information about IAM Roles Anywhere see +// https://docs.aws.amazon.com/ (https://docs.aws.amazon.com/) +package rolesanywhere diff --git a/service/rolesanywhere/endpoints.go b/service/rolesanywhere/endpoints.go new file mode 100644 index 00000000000..1e4f9eb4d4d --- /dev/null +++ b/service/rolesanywhere/endpoints.go @@ -0,0 +1,200 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/rolesanywhere/internal/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/url" + "strings" +) + +// EndpointResolverOptions is the service endpoint resolver options +type EndpointResolverOptions = internalendpoints.Options + +// EndpointResolver interface for resolving service endpoints. +type EndpointResolver interface { + ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error) +} + +var _ EndpointResolver = &internalendpoints.Resolver{} + +// NewDefaultEndpointResolver constructs a new service endpoint resolver +func NewDefaultEndpointResolver() *internalendpoints.Resolver { + return internalendpoints.New() +} + +// EndpointResolverFunc is a helper utility that wraps a function so it satisfies +// the EndpointResolver interface. This is useful when you want to add additional +// endpoint resolving logic, or stub out specific endpoints with custom values. +type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error) + +func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { + return fn(region, options) +} + +func resolveDefaultEndpointConfiguration(o *Options) { + if o.EndpointResolver != nil { + return + } + o.EndpointResolver = NewDefaultEndpointResolver() +} + +// EndpointResolverFromURL returns an EndpointResolver configured using the +// provided endpoint url. By default, the resolved endpoint resolver uses the +// client region as signing region, and the endpoint source is set to +// EndpointSourceCustom.You can provide functional options to configure endpoint +// values for the resolved endpoint. +func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver { + e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom} + for _, fn := range optFns { + fn(&e) + } + + return EndpointResolverFunc( + func(region string, options EndpointResolverOptions) (aws.Endpoint, error) { + if len(e.SigningRegion) == 0 { + e.SigningRegion = region + } + return e, nil + }, + ) +} + +type ResolveEndpoint struct { + Resolver EndpointResolver + Options EndpointResolverOptions +} + +func (*ResolveEndpoint) ID() string { + return "ResolveEndpoint" +} + +func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.Resolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + eo := m.Options + eo.Logger = middleware.GetLogger(ctx) + + var endpoint aws.Endpoint + endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL, err = url.Parse(endpoint.URL) + if err != nil { + return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err) + } + + if len(awsmiddleware.GetSigningName(ctx)) == 0 { + signingName := endpoint.SigningName + if len(signingName) == 0 { + signingName = "rolesanywhere" + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + } + ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source) + ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable) + ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) + ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID) + return next.HandleSerialize(ctx, in) +} +func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { + return stack.Serialize.Insert(&ResolveEndpoint{ + Resolver: o.EndpointResolver, + Options: o.EndpointOptions, + }, "OperationSerializer", middleware.Before) +} + +func removeResolveEndpointMiddleware(stack *middleware.Stack) error { + _, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID()) + return err +} + +type wrappedEndpointResolver struct { + awsResolver aws.EndpointResolverWithOptions + resolver EndpointResolver +} + +func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { + if w.awsResolver == nil { + goto fallback + } + endpoint, err = w.awsResolver.ResolveEndpoint(ServiceID, region, options) + if err == nil { + return endpoint, nil + } + + if nf := (&aws.EndpointNotFoundError{}); !errors.As(err, &nf) { + return endpoint, err + } + +fallback: + if w.resolver == nil { + return endpoint, fmt.Errorf("default endpoint resolver provided was nil") + } + return w.resolver.ResolveEndpoint(region, options) +} + +type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error) + +func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) { + return a(service, region) +} + +var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil) + +// withEndpointResolver returns an EndpointResolver that first delegates endpoint resolution to the awsResolver. +// If awsResolver returns aws.EndpointNotFoundError error, the resolver will use the the provided +// fallbackResolver for resolution. +// +// fallbackResolver must not be nil +func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions, fallbackResolver EndpointResolver) EndpointResolver { + var resolver aws.EndpointResolverWithOptions + + if awsResolverWithOptions != nil { + resolver = awsResolverWithOptions + } else if awsResolver != nil { + resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint) + } + + return &wrappedEndpointResolver{ + awsResolver: resolver, + resolver: fallbackResolver, + } +} + +func finalizeClientEndpointResolverOptions(options *Options) { + options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage() + + if len(options.EndpointOptions.ResolvedRegion) == 0 { + const fipsInfix = "-fips-" + const fipsPrefix = "fips-" + const fipsSuffix = "-fips" + + if strings.Contains(options.Region, fipsInfix) || + strings.Contains(options.Region, fipsPrefix) || + strings.Contains(options.Region, fipsSuffix) { + options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll( + options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "") + options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled + } + } + +} diff --git a/service/rolesanywhere/generated.json b/service/rolesanywhere/generated.json new file mode 100644 index 00000000000..875a81418cd --- /dev/null +++ b/service/rolesanywhere/generated.json @@ -0,0 +1,54 @@ +{ + "dependencies": { + "github.com/aws/aws-sdk-go-v2": "v1.4.0", + "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", + "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2": "v2.0.0-00010101000000-000000000000", + "github.com/aws/smithy-go": "v1.4.0" + }, + "files": [ + "api_client.go", + "api_client_test.go", + "api_op_CreateProfile.go", + "api_op_CreateTrustAnchor.go", + "api_op_DeleteCrl.go", + "api_op_DeleteProfile.go", + "api_op_DeleteTrustAnchor.go", + "api_op_DisableCrl.go", + "api_op_DisableProfile.go", + "api_op_DisableTrustAnchor.go", + "api_op_EnableCrl.go", + "api_op_EnableProfile.go", + "api_op_EnableTrustAnchor.go", + "api_op_GetCrl.go", + "api_op_GetProfile.go", + "api_op_GetSubject.go", + "api_op_GetTrustAnchor.go", + "api_op_ImportCrl.go", + "api_op_ListCrls.go", + "api_op_ListProfiles.go", + "api_op_ListSubjects.go", + "api_op_ListTagsForResource.go", + "api_op_ListTrustAnchors.go", + "api_op_TagResource.go", + "api_op_UntagResource.go", + "api_op_UpdateCrl.go", + "api_op_UpdateProfile.go", + "api_op_UpdateTrustAnchor.go", + "deserializers.go", + "doc.go", + "endpoints.go", + "generated.json", + "internal/endpoints/endpoints.go", + "internal/endpoints/endpoints_test.go", + "protocol_test.go", + "serializers.go", + "types/enums.go", + "types/errors.go", + "types/types.go", + "types/types_exported_test.go", + "validators.go" + ], + "go": "1.15", + "module": "github.com/aws/aws-sdk-go-v2/service/rolesanywhere", + "unstable": false +} diff --git a/service/rolesanywhere/go.mod b/service/rolesanywhere/go.mod new file mode 100644 index 00000000000..014131af191 --- /dev/null +++ b/service/rolesanywhere/go.mod @@ -0,0 +1,16 @@ +module github.com/aws/aws-sdk-go-v2/service/rolesanywhere + +go 1.15 + +require ( + github.com/aws/aws-sdk-go-v2 v1.16.6 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.13 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.7 + github.com/aws/smithy-go v1.12.0 +) + +replace github.com/aws/aws-sdk-go-v2 => ../../ + +replace github.com/aws/aws-sdk-go-v2/internal/configsources => ../../internal/configsources/ + +replace github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 => ../../internal/endpoints/v2/ diff --git a/service/rolesanywhere/go.sum b/service/rolesanywhere/go.sum new file mode 100644 index 00000000000..6e074bd88ad --- /dev/null +++ b/service/rolesanywhere/go.sum @@ -0,0 +1,11 @@ +github.com/aws/smithy-go v1.12.0 h1:gXpeZel/jPoWQ7OEmLIgCUnhkFftqNfwWUwAHSlp1v0= +github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/service/rolesanywhere/go_module_metadata.go b/service/rolesanywhere/go_module_metadata.go new file mode 100644 index 00000000000..ca5ee8d32a2 --- /dev/null +++ b/service/rolesanywhere/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package rolesanywhere + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/rolesanywhere/internal/endpoints/endpoints.go b/service/rolesanywhere/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..577e93cef2f --- /dev/null +++ b/service/rolesanywhere/internal/endpoints/endpoints.go @@ -0,0 +1,309 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package endpoints + +import ( + "github.com/aws/aws-sdk-go-v2/aws" + endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2" + "github.com/aws/smithy-go/logging" + "regexp" +) + +// Options is the endpoint resolver configuration options +type Options struct { + // Logger is a logging implementation that log events should be sent to. + Logger logging.Logger + + // LogDeprecated indicates that deprecated endpoints should be logged to the + // provided logger. + LogDeprecated bool + + // ResolvedRegion is used to override the region to be resolved, rather then the + // using the value passed to the ResolveEndpoint method. This value is used by the + // SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative + // name. You must not set this value directly in your application. + ResolvedRegion string + + // DisableHTTPS informs the resolver to return an endpoint that does not use the + // HTTPS scheme. + DisableHTTPS bool + + // UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint. + UseDualStackEndpoint aws.DualStackEndpointState + + // UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint. + UseFIPSEndpoint aws.FIPSEndpointState +} + +func (o Options) GetResolvedRegion() string { + return o.ResolvedRegion +} + +func (o Options) GetDisableHTTPS() bool { + return o.DisableHTTPS +} + +func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState { + return o.UseDualStackEndpoint +} + +func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState { + return o.UseFIPSEndpoint +} + +func transformToSharedOptions(options Options) endpoints.Options { + return endpoints.Options{ + Logger: options.Logger, + LogDeprecated: options.LogDeprecated, + ResolvedRegion: options.ResolvedRegion, + DisableHTTPS: options.DisableHTTPS, + UseDualStackEndpoint: options.UseDualStackEndpoint, + UseFIPSEndpoint: options.UseFIPSEndpoint, + } +} + +// Resolver RolesAnywhere endpoint resolver +type Resolver struct { + partitions endpoints.Partitions +} + +// ResolveEndpoint resolves the service endpoint for the given region and options +func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) { + if len(region) == 0 { + return endpoint, &aws.MissingRegionError{} + } + + opt := transformToSharedOptions(options) + return r.partitions.ResolveEndpoint(region, opt) +} + +// New returns a new Resolver +func New() *Resolver { + return &Resolver{ + partitions: defaultPartitions, + } +} + +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + +var defaultPartitions = endpoints.Partitions{ + { + ID: "aws", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "rolesanywhere.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "rolesanywhere-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "rolesanywhere-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "rolesanywhere.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.Aws, + IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "ap-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-northeast-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-northeast-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-northeast-3", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-south-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-southeast-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ap-southeast-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-central-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-north-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-west-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-west-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "eu-west-3", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "me-south-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "sa-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-2", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-2", + }: endpoints.Endpoint{}, + }, + }, + { + ID: "aws-cn", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "rolesanywhere.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "rolesanywhere-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "rolesanywhere-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "rolesanywhere.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsCn, + IsRegionalized: true, + }, + { + ID: "aws-iso", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "rolesanywhere-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "rolesanywhere.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIso, + IsRegionalized: true, + }, + { + ID: "aws-iso-b", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "rolesanywhere-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "rolesanywhere.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoB, + IsRegionalized: true, + }, + { + ID: "aws-us-gov", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "rolesanywhere.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "rolesanywhere-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "rolesanywhere-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "rolesanywhere.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + }, +} diff --git a/service/rolesanywhere/internal/endpoints/endpoints_test.go b/service/rolesanywhere/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/rolesanywhere/internal/endpoints/endpoints_test.go @@ -0,0 +1,11 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package endpoints + +import ( + "testing" +) + +func TestRegexCompile(t *testing.T) { + _ = defaultPartitions +} diff --git a/service/rolesanywhere/protocol_test.go b/service/rolesanywhere/protocol_test.go new file mode 100644 index 00000000000..9578464c2b9 --- /dev/null +++ b/service/rolesanywhere/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere diff --git a/service/rolesanywhere/serializers.go b/service/rolesanywhere/serializers.go new file mode 100644 index 00000000000..6950863e7fc --- /dev/null +++ b/service/rolesanywhere/serializers.go @@ -0,0 +1,1867 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/rolesanywhere/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/encoding/httpbinding" + smithyjson "github.com/aws/smithy-go/encoding/json" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +type awsRestjson1_serializeOpCreateProfile struct { +} + +func (*awsRestjson1_serializeOpCreateProfile) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateProfile) 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.(*CreateProfileInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/profiles") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateProfileInput(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_serializeOpHttpBindingsCreateProfileInput(v *CreateProfileInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateProfileInput(v *CreateProfileInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DurationSeconds != nil { + ok := object.Key("durationSeconds") + ok.Integer(*v.DurationSeconds) + } + + if v.Enabled != nil { + ok := object.Key("enabled") + ok.Boolean(*v.Enabled) + } + + if v.ManagedPolicyArns != nil { + ok := object.Key("managedPolicyArns") + if err := awsRestjson1_serializeDocumentManagedPolicyList(v.ManagedPolicyArns, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.RequireInstanceProperties != nil { + ok := object.Key("requireInstanceProperties") + ok.Boolean(*v.RequireInstanceProperties) + } + + if v.RoleArns != nil { + ok := object.Key("roleArns") + if err := awsRestjson1_serializeDocumentRoleArnList(v.RoleArns, ok); err != nil { + return err + } + } + + if v.SessionPolicy != nil { + ok := object.Key("sessionPolicy") + ok.String(*v.SessionPolicy) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTagList(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateTrustAnchor struct { +} + +func (*awsRestjson1_serializeOpCreateTrustAnchor) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateTrustAnchor) 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.(*CreateTrustAnchorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/trustanchors") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateTrustAnchorInput(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_serializeOpHttpBindingsCreateTrustAnchorInput(v *CreateTrustAnchorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateTrustAnchorInput(v *CreateTrustAnchorInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Enabled != nil { + ok := object.Key("enabled") + ok.Boolean(*v.Enabled) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.Source != nil { + ok := object.Key("source") + if err := awsRestjson1_serializeDocumentSource(v.Source, ok); err != nil { + return err + } + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTagList(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteCrl struct { +} + +func (*awsRestjson1_serializeOpDeleteCrl) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteCrl) 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.(*DeleteCrlInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/crl/{crlId}") + 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_serializeOpHttpBindingsDeleteCrlInput(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_serializeOpHttpBindingsDeleteCrlInput(v *DeleteCrlInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.CrlId == nil || len(*v.CrlId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member crlId must not be empty")} + } + if v.CrlId != nil { + if err := encoder.SetURI("crlId").String(*v.CrlId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteProfile struct { +} + +func (*awsRestjson1_serializeOpDeleteProfile) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteProfile) 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.(*DeleteProfileInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/profile/{profileId}") + 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_serializeOpHttpBindingsDeleteProfileInput(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_serializeOpHttpBindingsDeleteProfileInput(v *DeleteProfileInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ProfileId == nil || len(*v.ProfileId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member profileId must not be empty")} + } + if v.ProfileId != nil { + if err := encoder.SetURI("profileId").String(*v.ProfileId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteTrustAnchor struct { +} + +func (*awsRestjson1_serializeOpDeleteTrustAnchor) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteTrustAnchor) 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.(*DeleteTrustAnchorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/trustanchor/{trustAnchorId}") + 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_serializeOpHttpBindingsDeleteTrustAnchorInput(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_serializeOpHttpBindingsDeleteTrustAnchorInput(v *DeleteTrustAnchorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TrustAnchorId == nil || len(*v.TrustAnchorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member trustAnchorId must not be empty")} + } + if v.TrustAnchorId != nil { + if err := encoder.SetURI("trustAnchorId").String(*v.TrustAnchorId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDisableCrl struct { +} + +func (*awsRestjson1_serializeOpDisableCrl) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisableCrl) 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.(*DisableCrlInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/crl/{crlId}/disable") + 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_serializeOpHttpBindingsDisableCrlInput(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_serializeOpHttpBindingsDisableCrlInput(v *DisableCrlInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.CrlId == nil || len(*v.CrlId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member crlId must not be empty")} + } + if v.CrlId != nil { + if err := encoder.SetURI("crlId").String(*v.CrlId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDisableProfile struct { +} + +func (*awsRestjson1_serializeOpDisableProfile) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisableProfile) 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.(*DisableProfileInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/profile/{profileId}/disable") + 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_serializeOpHttpBindingsDisableProfileInput(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_serializeOpHttpBindingsDisableProfileInput(v *DisableProfileInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ProfileId == nil || len(*v.ProfileId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member profileId must not be empty")} + } + if v.ProfileId != nil { + if err := encoder.SetURI("profileId").String(*v.ProfileId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDisableTrustAnchor struct { +} + +func (*awsRestjson1_serializeOpDisableTrustAnchor) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisableTrustAnchor) 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.(*DisableTrustAnchorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/trustanchor/{trustAnchorId}/disable") + 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_serializeOpHttpBindingsDisableTrustAnchorInput(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_serializeOpHttpBindingsDisableTrustAnchorInput(v *DisableTrustAnchorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TrustAnchorId == nil || len(*v.TrustAnchorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member trustAnchorId must not be empty")} + } + if v.TrustAnchorId != nil { + if err := encoder.SetURI("trustAnchorId").String(*v.TrustAnchorId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpEnableCrl struct { +} + +func (*awsRestjson1_serializeOpEnableCrl) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpEnableCrl) 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.(*EnableCrlInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/crl/{crlId}/enable") + 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_serializeOpHttpBindingsEnableCrlInput(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_serializeOpHttpBindingsEnableCrlInput(v *EnableCrlInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.CrlId == nil || len(*v.CrlId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member crlId must not be empty")} + } + if v.CrlId != nil { + if err := encoder.SetURI("crlId").String(*v.CrlId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpEnableProfile struct { +} + +func (*awsRestjson1_serializeOpEnableProfile) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpEnableProfile) 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.(*EnableProfileInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/profile/{profileId}/enable") + 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_serializeOpHttpBindingsEnableProfileInput(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_serializeOpHttpBindingsEnableProfileInput(v *EnableProfileInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ProfileId == nil || len(*v.ProfileId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member profileId must not be empty")} + } + if v.ProfileId != nil { + if err := encoder.SetURI("profileId").String(*v.ProfileId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpEnableTrustAnchor struct { +} + +func (*awsRestjson1_serializeOpEnableTrustAnchor) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpEnableTrustAnchor) 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.(*EnableTrustAnchorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/trustanchor/{trustAnchorId}/enable") + 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_serializeOpHttpBindingsEnableTrustAnchorInput(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_serializeOpHttpBindingsEnableTrustAnchorInput(v *EnableTrustAnchorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TrustAnchorId == nil || len(*v.TrustAnchorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member trustAnchorId must not be empty")} + } + if v.TrustAnchorId != nil { + if err := encoder.SetURI("trustAnchorId").String(*v.TrustAnchorId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetCrl struct { +} + +func (*awsRestjson1_serializeOpGetCrl) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetCrl) 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.(*GetCrlInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/crl/{crlId}") + 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_serializeOpHttpBindingsGetCrlInput(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_serializeOpHttpBindingsGetCrlInput(v *GetCrlInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.CrlId == nil || len(*v.CrlId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member crlId must not be empty")} + } + if v.CrlId != nil { + if err := encoder.SetURI("crlId").String(*v.CrlId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetProfile struct { +} + +func (*awsRestjson1_serializeOpGetProfile) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetProfile) 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.(*GetProfileInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/profile/{profileId}") + 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_serializeOpHttpBindingsGetProfileInput(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_serializeOpHttpBindingsGetProfileInput(v *GetProfileInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ProfileId == nil || len(*v.ProfileId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member profileId must not be empty")} + } + if v.ProfileId != nil { + if err := encoder.SetURI("profileId").String(*v.ProfileId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetSubject struct { +} + +func (*awsRestjson1_serializeOpGetSubject) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetSubject) 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.(*GetSubjectInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/subject/{subjectId}") + 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_serializeOpHttpBindingsGetSubjectInput(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_serializeOpHttpBindingsGetSubjectInput(v *GetSubjectInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.SubjectId == nil || len(*v.SubjectId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member subjectId must not be empty")} + } + if v.SubjectId != nil { + if err := encoder.SetURI("subjectId").String(*v.SubjectId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetTrustAnchor struct { +} + +func (*awsRestjson1_serializeOpGetTrustAnchor) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetTrustAnchor) 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.(*GetTrustAnchorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/trustanchor/{trustAnchorId}") + 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_serializeOpHttpBindingsGetTrustAnchorInput(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_serializeOpHttpBindingsGetTrustAnchorInput(v *GetTrustAnchorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TrustAnchorId == nil || len(*v.TrustAnchorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member trustAnchorId must not be empty")} + } + if v.TrustAnchorId != nil { + if err := encoder.SetURI("trustAnchorId").String(*v.TrustAnchorId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpImportCrl struct { +} + +func (*awsRestjson1_serializeOpImportCrl) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpImportCrl) 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.(*ImportCrlInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/crls") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentImportCrlInput(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_serializeOpHttpBindingsImportCrlInput(v *ImportCrlInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentImportCrlInput(v *ImportCrlInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CrlData != nil { + ok := object.Key("crlData") + ok.Base64EncodeBytes(v.CrlData) + } + + if v.Enabled != nil { + ok := object.Key("enabled") + ok.Boolean(*v.Enabled) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTagList(v.Tags, ok); err != nil { + return err + } + } + + if v.TrustAnchorArn != nil { + ok := object.Key("trustAnchorArn") + ok.String(*v.TrustAnchorArn) + } + + return nil +} + +type awsRestjson1_serializeOpListCrls struct { +} + +func (*awsRestjson1_serializeOpListCrls) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListCrls) 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.(*ListCrlsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/crls") + 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_serializeOpHttpBindingsListCrlsInput(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_serializeOpHttpBindingsListCrlsInput(v *ListCrlsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.PageSize != nil { + encoder.SetQuery("pageSize").Integer(*v.PageSize) + } + + return nil +} + +type awsRestjson1_serializeOpListProfiles struct { +} + +func (*awsRestjson1_serializeOpListProfiles) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListProfiles) 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.(*ListProfilesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/profiles") + 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_serializeOpHttpBindingsListProfilesInput(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_serializeOpHttpBindingsListProfilesInput(v *ListProfilesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.PageSize != nil { + encoder.SetQuery("pageSize").Integer(*v.PageSize) + } + + return nil +} + +type awsRestjson1_serializeOpListSubjects struct { +} + +func (*awsRestjson1_serializeOpListSubjects) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListSubjects) 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.(*ListSubjectsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/subjects") + 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_serializeOpHttpBindingsListSubjectsInput(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_serializeOpHttpBindingsListSubjectsInput(v *ListSubjectsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.PageSize != nil { + encoder.SetQuery("pageSize").Integer(*v.PageSize) + } + + return nil +} + +type awsRestjson1_serializeOpListTagsForResource struct { +} + +func (*awsRestjson1_serializeOpListTagsForResource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListTagsForResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*ListTagsForResourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ListTagsForResource") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListTagsForResourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsListTagsForResourceInput(v *ListTagsForResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ResourceArn != nil { + encoder.SetQuery("resourceArn").String(*v.ResourceArn) + } + + return nil +} + +type awsRestjson1_serializeOpListTrustAnchors struct { +} + +func (*awsRestjson1_serializeOpListTrustAnchors) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListTrustAnchors) 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.(*ListTrustAnchorsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/trustanchors") + 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_serializeOpHttpBindingsListTrustAnchorsInput(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_serializeOpHttpBindingsListTrustAnchorsInput(v *ListTrustAnchorsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.NextToken != nil { + encoder.SetQuery("nextToken").String(*v.NextToken) + } + + if v.PageSize != nil { + encoder.SetQuery("pageSize").Integer(*v.PageSize) + } + + return nil +} + +type awsRestjson1_serializeOpTagResource struct { +} + +func (*awsRestjson1_serializeOpTagResource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpTagResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*TagResourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/TagResource") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentTagResourceInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsTagResourceInput(v *TagResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentTagResourceInput(v *TagResourceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ResourceArn != nil { + ok := object.Key("resourceArn") + ok.String(*v.ResourceArn) + } + + if v.Tags != nil { + ok := object.Key("tags") + if err := awsRestjson1_serializeDocumentTagList(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUntagResource struct { +} + +func (*awsRestjson1_serializeOpUntagResource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUntagResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*UntagResourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/UntagResource") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUntagResourceInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsUntagResourceInput(v *UntagResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUntagResourceInput(v *UntagResourceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ResourceArn != nil { + ok := object.Key("resourceArn") + ok.String(*v.ResourceArn) + } + + if v.TagKeys != nil { + ok := object.Key("tagKeys") + if err := awsRestjson1_serializeDocumentTagKeyList(v.TagKeys, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateCrl struct { +} + +func (*awsRestjson1_serializeOpUpdateCrl) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateCrl) 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.(*UpdateCrlInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/crl/{crlId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PATCH" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsUpdateCrlInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateCrlInput(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_serializeOpHttpBindingsUpdateCrlInput(v *UpdateCrlInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.CrlId == nil || len(*v.CrlId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member crlId must not be empty")} + } + if v.CrlId != nil { + if err := encoder.SetURI("crlId").String(*v.CrlId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateCrlInput(v *UpdateCrlInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CrlData != nil { + ok := object.Key("crlData") + ok.Base64EncodeBytes(v.CrlData) + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateProfile struct { +} + +func (*awsRestjson1_serializeOpUpdateProfile) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateProfile) 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.(*UpdateProfileInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/profile/{profileId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PATCH" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsUpdateProfileInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateProfileInput(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_serializeOpHttpBindingsUpdateProfileInput(v *UpdateProfileInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ProfileId == nil || len(*v.ProfileId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member profileId must not be empty")} + } + if v.ProfileId != nil { + if err := encoder.SetURI("profileId").String(*v.ProfileId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateProfileInput(v *UpdateProfileInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DurationSeconds != nil { + ok := object.Key("durationSeconds") + ok.Integer(*v.DurationSeconds) + } + + if v.ManagedPolicyArns != nil { + ok := object.Key("managedPolicyArns") + if err := awsRestjson1_serializeDocumentManagedPolicyList(v.ManagedPolicyArns, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.RoleArns != nil { + ok := object.Key("roleArns") + if err := awsRestjson1_serializeDocumentRoleArnList(v.RoleArns, ok); err != nil { + return err + } + } + + if v.SessionPolicy != nil { + ok := object.Key("sessionPolicy") + ok.String(*v.SessionPolicy) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateTrustAnchor struct { +} + +func (*awsRestjson1_serializeOpUpdateTrustAnchor) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateTrustAnchor) 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.(*UpdateTrustAnchorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/trustanchor/{trustAnchorId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PATCH" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsUpdateTrustAnchorInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateTrustAnchorInput(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_serializeOpHttpBindingsUpdateTrustAnchorInput(v *UpdateTrustAnchorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TrustAnchorId == nil || len(*v.TrustAnchorId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member trustAnchorId must not be empty")} + } + if v.TrustAnchorId != nil { + if err := encoder.SetURI("trustAnchorId").String(*v.TrustAnchorId); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateTrustAnchorInput(v *UpdateTrustAnchorInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Name != nil { + ok := object.Key("name") + ok.String(*v.Name) + } + + if v.Source != nil { + ok := object.Key("source") + if err := awsRestjson1_serializeDocumentSource(v.Source, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentManagedPolicyList(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + +func awsRestjson1_serializeDocumentRoleArnList(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + +func awsRestjson1_serializeDocumentSource(v *types.Source, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.SourceData != nil { + ok := object.Key("sourceData") + if err := awsRestjson1_serializeDocumentSourceData(v.SourceData, ok); err != nil { + return err + } + } + + if len(v.SourceType) > 0 { + ok := object.Key("sourceType") + ok.String(string(v.SourceType)) + } + + return nil +} + +func awsRestjson1_serializeDocumentSourceData(v types.SourceData, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.SourceDataMemberAcmPcaArn: + av := object.Key("acmPcaArn") + av.String(uv.Value) + + case *types.SourceDataMemberX509CertificateData: + av := object.Key("x509CertificateData") + av.String(uv.Value) + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentTag(v *types.Tag, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Key != nil { + ok := object.Key("key") + ok.String(*v.Key) + } + + if v.Value != nil { + ok := object.Key("value") + ok.String(*v.Value) + } + + return nil +} + +func awsRestjson1_serializeDocumentTagKeyList(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + +func awsRestjson1_serializeDocumentTagList(v []types.Tag, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsRestjson1_serializeDocumentTag(&v[i], av); err != nil { + return err + } + } + return nil +} diff --git a/service/rolesanywhere/types/enums.go b/service/rolesanywhere/types/enums.go new file mode 100644 index 00000000000..b9e45b35c4c --- /dev/null +++ b/service/rolesanywhere/types/enums.go @@ -0,0 +1,23 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type TrustAnchorType string + +// Enum values for TrustAnchorType +const ( + TrustAnchorTypeAwsAcmPca TrustAnchorType = "AWS_ACM_PCA" + TrustAnchorTypeCertificateBundle TrustAnchorType = "CERTIFICATE_BUNDLE" + TrustAnchorTypeSelfSignedRepository TrustAnchorType = "SELF_SIGNED_REPOSITORY" +) + +// Values returns all known values for TrustAnchorType. 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 (TrustAnchorType) Values() []TrustAnchorType { + return []TrustAnchorType{ + "AWS_ACM_PCA", + "CERTIFICATE_BUNDLE", + "SELF_SIGNED_REPOSITORY", + } +} diff --git a/service/rolesanywhere/types/errors.go b/service/rolesanywhere/types/errors.go new file mode 100644 index 00000000000..6428b494e7d --- /dev/null +++ b/service/rolesanywhere/types/errors.go @@ -0,0 +1,84 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// You do not have sufficient access to perform this action. +type AccessDeniedException struct { + Message *string + + noSmithyDocumentSerde +} + +func (e *AccessDeniedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *AccessDeniedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *AccessDeniedException) ErrorCode() string { return "AccessDeniedException" } +func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The resource could not be found. +type ResourceNotFoundException struct { + Message *string + + noSmithyDocumentSerde +} + +func (e *ResourceNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ResourceNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ResourceNotFoundException) ErrorCode() string { return "ResourceNotFoundException" } +func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Too many tags. +type TooManyTagsException struct { + Message *string + + noSmithyDocumentSerde +} + +func (e *TooManyTagsException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *TooManyTagsException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *TooManyTagsException) ErrorCode() string { return "TooManyTagsException" } +func (e *TooManyTagsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Validation exception error. +type ValidationException struct { + Message *string + + noSmithyDocumentSerde +} + +func (e *ValidationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ValidationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ValidationException) ErrorCode() string { return "ValidationException" } +func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } diff --git a/service/rolesanywhere/types/types.go b/service/rolesanywhere/types/types.go new file mode 100644 index 00000000000..36558940795 --- /dev/null +++ b/service/rolesanywhere/types/types.go @@ -0,0 +1,306 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + smithydocument "github.com/aws/smithy-go/document" + "time" +) + +// A record of a presented X509 credential to CreateSession +// (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html). +type CredentialSummary struct { + + // Indicates whether the credential is enabled. + Enabled *bool + + // Indicates whether the CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation was successful. + Failed *bool + + // The fully qualified domain name of the issuing certificate for the presented + // end-entity certificate. + Issuer *string + + // The ISO-8601 time stamp of when the certificate was last used in a CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation. + SeenAt *time.Time + + // The serial number of the certificate. + SerialNumber *string + + // The PEM-encoded data of the certificate. + X509CertificateData *string + + noSmithyDocumentSerde +} + +// The state of the certificate revocation list (CRL) after a read or write +// operation. +type CrlDetail struct { + + // The ISO-8601 timestamp when the certificate revocation list (CRL) was created. + CreatedAt *time.Time + + // The ARN of the certificate revocation list (CRL). + CrlArn *string + + // The state of the certificate revocation list (CRL) after a read or write + // operation. + CrlData []byte + + // The unique identifier of the certificate revocation list (CRL). + CrlId *string + + // Indicates whether the certificate revocation list (CRL) is enabled. + Enabled *bool + + // The name of the certificate revocation list (CRL). + Name *string + + // The ARN of the TrustAnchor the certificate revocation list (CRL) will provide + // revocation for. + TrustAnchorArn *string + + // The ISO-8601 timestamp when the certificate revocation list (CRL) was last + // updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// A key-value pair you set that identifies a property of the authenticating +// instance. +type InstanceProperty struct { + + // Indicates whether the CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation was successful. + Failed *bool + + // A list of instanceProperty objects. + Properties map[string]string + + // The ISO-8601 time stamp of when the certificate was last used in a CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation. + SeenAt *time.Time + + noSmithyDocumentSerde +} + +// The state of the profile after a read or write operation. +type ProfileDetail struct { + + // The ISO-8601 timestamp when the profile was created. + CreatedAt *time.Time + + // The Amazon Web Services account that created the profile. + CreatedBy *string + + // The number of seconds the vended session credentials are valid for. + DurationSeconds *int32 + + // Indicates whether the profile is enabled. + Enabled *bool + + // A list of managed policy ARNs that apply to the vended session credentials. + ManagedPolicyArns []string + + // The name of the profile. + Name *string + + // The ARN of the profile. + ProfileArn *string + + // The unique identifier of the profile. + ProfileId *string + + // Specifies whether instance properties are required in CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // requests with this profile. + RequireInstanceProperties *bool + + // A list of IAM roles that this profile can assume in a CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation. + RoleArns []string + + // A session policy that applies to the trust boundary of the vended session + // credentials. + SessionPolicy *string + + // The ISO-8601 timestamp when the profile was last updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// The trust anchor type and its related certificate data. +type Source struct { + + // The data field of the trust anchor depending on its type. + SourceData SourceData + + // The type of the trust anchor. + SourceType TrustAnchorType + + noSmithyDocumentSerde +} + +// The data field of the trust anchor depending on its type. +// +// The following types satisfy this interface: +// SourceDataMemberAcmPcaArn +// SourceDataMemberX509CertificateData +type SourceData interface { + isSourceData() +} + +// The root certificate of the Certificate Manager Private Certificate Authority +// specified by this ARN is used in trust validation for CreateSession +// (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) +// operations. Included for trust anchors of type AWS_ACM_PCA. +type SourceDataMemberAcmPcaArn struct { + Value string + + noSmithyDocumentSerde +} + +func (*SourceDataMemberAcmPcaArn) isSourceData() {} + +// The PEM-encoded data for the certificate anchor. Included for trust anchors of +// type CERTIFICATE_BUNDLE. +type SourceDataMemberX509CertificateData struct { + Value string + + noSmithyDocumentSerde +} + +func (*SourceDataMemberX509CertificateData) isSourceData() {} + +// The state of the subject after a read or write operation. +type SubjectDetail struct { + + // The ISO-8601 timestamp when the subject was created. + CreatedAt *time.Time + + // The temporary session credentials vended at the last authenticating call with + // this Subject. + Credentials []CredentialSummary + + // The enabled status of the subject. + Enabled *bool + + // The specified instance properties associated with the request. + InstanceProperties []InstanceProperty + + // The ISO-8601 timestamp of the last time this Subject requested temporary session + // credentials. + LastSeenAt *time.Time + + // The ARN of the resource. + SubjectArn *string + + // The id of the resource + SubjectId *string + + // The ISO-8601 timestamp when the subject was last updated. + UpdatedAt *time.Time + + // The x509 principal identifier of the authenticating certificate. + X509Subject *string + + noSmithyDocumentSerde +} + +// A summary representation of Subject resources returned in read operations; +// primarily ListSubjects. +type SubjectSummary struct { + + // The ISO-8601 time stamp of when the certificate was first used in a + // CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation. + CreatedAt *time.Time + + // The enabled status of the Subject. + Enabled *bool + + // The ISO-8601 time stamp of when the certificate was last used in a CreateSession + // (https://docs.aws.amazon.com/rolesanywhere/latest/APIReference/API_CreateSession.html) + // operation. + LastSeenAt *time.Time + + // The ARN of the resource. + SubjectArn *string + + // The id of the resource. + SubjectId *string + + // The ISO-8601 timestamp when the subject was last updated. + UpdatedAt *time.Time + + // The x509 principal identifier of the authenticating certificate. + X509Subject *string + + noSmithyDocumentSerde +} + +// A label that consists of a key and value you define. +type Tag struct { + + // The tag key. + // + // This member is required. + Key *string + + // The tag value. + // + // This member is required. + Value *string + + noSmithyDocumentSerde +} + +// The state of the trust anchor after a read or write operation. +type TrustAnchorDetail struct { + + // The ISO-8601 timestamp when the trust anchor was created. + CreatedAt *time.Time + + // Indicates whether the trust anchor is enabled. + Enabled *bool + + // The name of the trust anchor. + Name *string + + // The trust anchor type and its related certificate data. + Source *Source + + // The ARN of the trust anchor. + TrustAnchorArn *string + + // The unique identifier of the trust anchor. + TrustAnchorId *string + + // The ISO-8601 timestamp when the trust anchor was last updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +type noSmithyDocumentSerde = smithydocument.NoSerde + +// UnknownUnionMember is returned when a union member is returned over the wire, +// but has an unknown tag. +type UnknownUnionMember struct { + Tag string + Value []byte + + noSmithyDocumentSerde +} + +func (*UnknownUnionMember) isSourceData() {} diff --git a/service/rolesanywhere/types/types_exported_test.go b/service/rolesanywhere/types/types_exported_test.go new file mode 100644 index 00000000000..e1b2daf3222 --- /dev/null +++ b/service/rolesanywhere/types/types_exported_test.go @@ -0,0 +1,29 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types_test + +import ( + "fmt" + "github.com/aws/aws-sdk-go-v2/service/rolesanywhere/types" +) + +func ExampleSourceData_outputUsage() { + var union types.SourceData + // type switches can be used to check the union value + switch v := union.(type) { + case *types.SourceDataMemberAcmPcaArn: + _ = v.Value // Value is string + + case *types.SourceDataMemberX509CertificateData: + _ = v.Value // Value is string + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *string diff --git a/service/rolesanywhere/validators.go b/service/rolesanywhere/validators.go new file mode 100644 index 00000000000..552b09b033c --- /dev/null +++ b/service/rolesanywhere/validators.go @@ -0,0 +1,941 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package rolesanywhere + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/rolesanywhere/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpCreateProfile struct { +} + +func (*validateOpCreateProfile) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateProfile) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateProfileInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateProfileInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateTrustAnchor struct { +} + +func (*validateOpCreateTrustAnchor) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateTrustAnchor) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateTrustAnchorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateTrustAnchorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteCrl struct { +} + +func (*validateOpDeleteCrl) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteCrl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteCrlInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteCrlInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteProfile struct { +} + +func (*validateOpDeleteProfile) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteProfile) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteProfileInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteProfileInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteTrustAnchor struct { +} + +func (*validateOpDeleteTrustAnchor) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteTrustAnchor) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteTrustAnchorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteTrustAnchorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDisableCrl struct { +} + +func (*validateOpDisableCrl) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisableCrl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisableCrlInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisableCrlInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDisableProfile struct { +} + +func (*validateOpDisableProfile) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisableProfile) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisableProfileInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisableProfileInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDisableTrustAnchor struct { +} + +func (*validateOpDisableTrustAnchor) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisableTrustAnchor) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisableTrustAnchorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisableTrustAnchorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpEnableCrl struct { +} + +func (*validateOpEnableCrl) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpEnableCrl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*EnableCrlInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpEnableCrlInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpEnableProfile struct { +} + +func (*validateOpEnableProfile) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpEnableProfile) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*EnableProfileInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpEnableProfileInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpEnableTrustAnchor struct { +} + +func (*validateOpEnableTrustAnchor) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpEnableTrustAnchor) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*EnableTrustAnchorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpEnableTrustAnchorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetCrl struct { +} + +func (*validateOpGetCrl) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetCrl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetCrlInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetCrlInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetProfile struct { +} + +func (*validateOpGetProfile) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetProfile) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetProfileInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetProfileInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetSubject struct { +} + +func (*validateOpGetSubject) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetSubject) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetSubjectInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetSubjectInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetTrustAnchor struct { +} + +func (*validateOpGetTrustAnchor) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetTrustAnchor) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetTrustAnchorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetTrustAnchorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpImportCrl struct { +} + +func (*validateOpImportCrl) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpImportCrl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ImportCrlInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpImportCrlInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListTagsForResource struct { +} + +func (*validateOpListTagsForResource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListTagsForResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListTagsForResourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListTagsForResourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpTagResource struct { +} + +func (*validateOpTagResource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpTagResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*TagResourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpTagResourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUntagResource struct { +} + +func (*validateOpUntagResource) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUntagResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UntagResourceInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUntagResourceInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateCrl struct { +} + +func (*validateOpUpdateCrl) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateCrl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateCrlInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateCrlInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateProfile struct { +} + +func (*validateOpUpdateProfile) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateProfile) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateProfileInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateProfileInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateTrustAnchor struct { +} + +func (*validateOpUpdateTrustAnchor) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateTrustAnchor) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateTrustAnchorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateTrustAnchorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpCreateProfileValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateProfile{}, middleware.After) +} + +func addOpCreateTrustAnchorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateTrustAnchor{}, middleware.After) +} + +func addOpDeleteCrlValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteCrl{}, middleware.After) +} + +func addOpDeleteProfileValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteProfile{}, middleware.After) +} + +func addOpDeleteTrustAnchorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteTrustAnchor{}, middleware.After) +} + +func addOpDisableCrlValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisableCrl{}, middleware.After) +} + +func addOpDisableProfileValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisableProfile{}, middleware.After) +} + +func addOpDisableTrustAnchorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisableTrustAnchor{}, middleware.After) +} + +func addOpEnableCrlValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpEnableCrl{}, middleware.After) +} + +func addOpEnableProfileValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpEnableProfile{}, middleware.After) +} + +func addOpEnableTrustAnchorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpEnableTrustAnchor{}, middleware.After) +} + +func addOpGetCrlValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetCrl{}, middleware.After) +} + +func addOpGetProfileValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetProfile{}, middleware.After) +} + +func addOpGetSubjectValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetSubject{}, middleware.After) +} + +func addOpGetTrustAnchorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetTrustAnchor{}, middleware.After) +} + +func addOpImportCrlValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpImportCrl{}, middleware.After) +} + +func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) +} + +func addOpTagResourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpTagResource{}, middleware.After) +} + +func addOpUntagResourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUntagResource{}, middleware.After) +} + +func addOpUpdateCrlValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateCrl{}, middleware.After) +} + +func addOpUpdateProfileValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateProfile{}, middleware.After) +} + +func addOpUpdateTrustAnchorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateTrustAnchor{}, middleware.After) +} + +func validateTag(v *types.Tag) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "Tag"} + if v.Key == nil { + invalidParams.Add(smithy.NewErrParamRequired("Key")) + } + if v.Value == nil { + invalidParams.Add(smithy.NewErrParamRequired("Value")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTagList(v []types.Tag) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TagList"} + for i := range v { + if err := validateTag(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateProfileInput(v *CreateProfileInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateProfileInput"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.RoleArns == nil { + invalidParams.Add(smithy.NewErrParamRequired("RoleArns")) + } + if v.Tags != nil { + if err := validateTagList(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateTrustAnchorInput(v *CreateTrustAnchorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateTrustAnchorInput"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.Source == nil { + invalidParams.Add(smithy.NewErrParamRequired("Source")) + } + if v.Tags != nil { + if err := validateTagList(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteCrlInput(v *DeleteCrlInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteCrlInput"} + if v.CrlId == nil { + invalidParams.Add(smithy.NewErrParamRequired("CrlId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteProfileInput(v *DeleteProfileInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteProfileInput"} + if v.ProfileId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ProfileId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteTrustAnchorInput(v *DeleteTrustAnchorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteTrustAnchorInput"} + if v.TrustAnchorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("TrustAnchorId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDisableCrlInput(v *DisableCrlInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisableCrlInput"} + if v.CrlId == nil { + invalidParams.Add(smithy.NewErrParamRequired("CrlId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDisableProfileInput(v *DisableProfileInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisableProfileInput"} + if v.ProfileId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ProfileId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDisableTrustAnchorInput(v *DisableTrustAnchorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisableTrustAnchorInput"} + if v.TrustAnchorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("TrustAnchorId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpEnableCrlInput(v *EnableCrlInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "EnableCrlInput"} + if v.CrlId == nil { + invalidParams.Add(smithy.NewErrParamRequired("CrlId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpEnableProfileInput(v *EnableProfileInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "EnableProfileInput"} + if v.ProfileId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ProfileId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpEnableTrustAnchorInput(v *EnableTrustAnchorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "EnableTrustAnchorInput"} + if v.TrustAnchorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("TrustAnchorId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetCrlInput(v *GetCrlInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetCrlInput"} + if v.CrlId == nil { + invalidParams.Add(smithy.NewErrParamRequired("CrlId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetProfileInput(v *GetProfileInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetProfileInput"} + if v.ProfileId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ProfileId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetSubjectInput(v *GetSubjectInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetSubjectInput"} + if v.SubjectId == nil { + invalidParams.Add(smithy.NewErrParamRequired("SubjectId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetTrustAnchorInput(v *GetTrustAnchorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetTrustAnchorInput"} + if v.TrustAnchorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("TrustAnchorId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpImportCrlInput(v *ImportCrlInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ImportCrlInput"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.CrlData == nil { + invalidParams.Add(smithy.NewErrParamRequired("CrlData")) + } + if v.Tags != nil { + if err := validateTagList(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if v.TrustAnchorArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TrustAnchorArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListTagsForResourceInput(v *ListTagsForResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListTagsForResourceInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpTagResourceInput(v *TagResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TagResourceInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if v.Tags == nil { + invalidParams.Add(smithy.NewErrParamRequired("Tags")) + } else if v.Tags != nil { + if err := validateTagList(v.Tags); err != nil { + invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUntagResourceInput(v *UntagResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UntagResourceInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if v.TagKeys == nil { + invalidParams.Add(smithy.NewErrParamRequired("TagKeys")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateCrlInput(v *UpdateCrlInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateCrlInput"} + if v.CrlId == nil { + invalidParams.Add(smithy.NewErrParamRequired("CrlId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateProfileInput(v *UpdateProfileInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateProfileInput"} + if v.ProfileId == nil { + invalidParams.Add(smithy.NewErrParamRequired("ProfileId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateTrustAnchorInput(v *UpdateTrustAnchorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateTrustAnchorInput"} + if v.TrustAnchorId == nil { + invalidParams.Add(smithy.NewErrParamRequired("TrustAnchorId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/ssmincidents/api_op_UpdateResponsePlan.go b/service/ssmincidents/api_op_UpdateResponsePlan.go index 91b1674f16c..67e2c3baf5b 100644 --- a/service/ssmincidents/api_op_UpdateResponsePlan.go +++ b/service/ssmincidents/api_op_UpdateResponsePlan.go @@ -80,6 +80,11 @@ type UpdateResponsePlanInput struct { // what's currently happening, and next steps. IncidentTemplateSummary *string + // Tags to apply to an incident when calling the StartIncident API action. To call + // this action, you must also have permission to call the TagResource API action + // for the incident record resource. + IncidentTemplateTags map[string]string + // The short format name of the incident. The title can't contain spaces. IncidentTemplateTitle *string diff --git a/service/ssmincidents/deserializers.go b/service/ssmincidents/deserializers.go index 026a5dd0c28..9b6ccea6473 100644 --- a/service/ssmincidents/deserializers.go +++ b/service/ssmincidents/deserializers.go @@ -5217,6 +5217,11 @@ func awsRestjson1_deserializeDocumentIncidentTemplate(v **types.IncidentTemplate sv.Impact = ptr.Int32(int32(i64)) } + case "incidentTags": + if err := awsRestjson1_deserializeDocumentTagMap(&sv.IncidentTags, value); err != nil { + return err + } + case "notificationTargets": if err := awsRestjson1_deserializeDocumentNotificationTargetSet(&sv.NotificationTargets, value); err != nil { return err diff --git a/service/ssmincidents/serializers.go b/service/ssmincidents/serializers.go index ae792e922a6..e0918d8f6a2 100644 --- a/service/ssmincidents/serializers.go +++ b/service/ssmincidents/serializers.go @@ -2160,6 +2160,13 @@ func awsRestjson1_serializeOpDocumentUpdateResponsePlanInput(v *UpdateResponsePl ok.String(*v.IncidentTemplateSummary) } + if v.IncidentTemplateTags != nil { + ok := object.Key("incidentTemplateTags") + if err := awsRestjson1_serializeDocumentTagMapUpdate(v.IncidentTemplateTags, ok); err != nil { + return err + } + } + if v.IncidentTemplateTitle != nil { ok := object.Key("incidentTemplateTitle") ok.String(*v.IncidentTemplateTitle) @@ -2505,6 +2512,13 @@ func awsRestjson1_serializeDocumentIncidentTemplate(v *types.IncidentTemplate, v ok.Integer(*v.Impact) } + if v.IncidentTags != nil { + ok := object.Key("incidentTags") + if err := awsRestjson1_serializeDocumentTagMap(v.IncidentTags, ok); err != nil { + return err + } + } + if v.NotificationTargets != nil { ok := object.Key("notificationTargets") if err := awsRestjson1_serializeDocumentNotificationTargetSet(v.NotificationTargets, ok); err != nil { @@ -2783,6 +2797,17 @@ func awsRestjson1_serializeDocumentTagMap(v map[string]string, value smithyjson. return nil } +func awsRestjson1_serializeDocumentTagMapUpdate(v map[string]string, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + for key := range v { + om := object.Key(key) + om.String(v[key]) + } + return nil +} + func awsRestjson1_serializeDocumentTriggerDetails(v *types.TriggerDetails, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/ssmincidents/types/types.go b/service/ssmincidents/types/types.go index 15c1f608a8c..83f26b2c502 100644 --- a/service/ssmincidents/types/types.go +++ b/service/ssmincidents/types/types.go @@ -391,6 +391,9 @@ type IncidentTemplate struct { // same incident. DedupeString *string + // Tags to apply to an incident when calling the StartIncident API action. + IncidentTags map[string]string + // The Amazon SNS targets that are notified when updates are made to an incident. NotificationTargets []NotificationTargetItem