diff --git a/.changelog/08e7f692733a482d943f17dbb4b018d3.json b/.changelog/08e7f692733a482d943f17dbb4b018d3.json new file mode 100644 index 00000000000..590c7c9759f --- /dev/null +++ b/.changelog/08e7f692733a482d943f17dbb4b018d3.json @@ -0,0 +1,8 @@ +{ + "id": "08e7f692-733a-482d-943f-17dbb4b018d3", + "type": "feature", + "description": "AWS DataSync introduces Task Reports, a new feature that provides detailed reports of data transfer operations for each task execution.", + "modules": [ + "service/datasync" + ] +} \ No newline at end of file diff --git a/.changelog/41575353444b40ffbf474f4155544f00.json b/.changelog/41575353444b40ffbf474f4155544f00.json new file mode 100644 index 00000000000..5a09bee9813 --- /dev/null +++ b/.changelog/41575353444b40ffbf474f4155544f00.json @@ -0,0 +1,9 @@ +{ + "id": "41575353-444b-40ff-bf47-4f4155544f00", + "type": "release", + "description": "New AWS service client module", + "modules": [ + "service/neptunedata", + "service/pcaconnectorad" + ] +} \ No newline at end of file diff --git a/.changelog/43784b930e794f22b1dd771e7e8078de.json b/.changelog/43784b930e794f22b1dd771e7e8078de.json new file mode 100644 index 00000000000..9731094f5d5 --- /dev/null +++ b/.changelog/43784b930e794f22b1dd771e7e8078de.json @@ -0,0 +1,8 @@ +{ + "id": "43784b93-0e79-4f22-b1dd-771e7e8078de", + "type": "feature", + "description": "This release marks some assessment metadata as sensitive. We added a sensitive trait to the following attributes: assessmentName, emailAddress, scope, createdBy, lastUpdatedBy, and userName.", + "modules": [ + "service/auditmanager" + ] +} \ No newline at end of file diff --git a/.changelog/56b3ef14bfec40dfbc78cddc57c07abb.json b/.changelog/56b3ef14bfec40dfbc78cddc57c07abb.json new file mode 100644 index 00000000000..90568cfc113 --- /dev/null +++ b/.changelog/56b3ef14bfec40dfbc78cddc57c07abb.json @@ -0,0 +1,8 @@ +{ + "id": "56b3ef14-bfec-40df-bc78-cddc57c07abb", + "type": "feature", + "description": "Allows customers to execute data plane actions like bulk loading graphs, issuing graph queries using Gremlin and openCypher directly from the SDK.", + "modules": [ + "service/neptunedata" + ] +} \ No newline at end of file diff --git a/.changelog/752f8fe57ebd4abf82a3800169cccce5.json b/.changelog/752f8fe57ebd4abf82a3800169cccce5.json new file mode 100644 index 00000000000..f8a02c71e99 --- /dev/null +++ b/.changelog/752f8fe57ebd4abf82a3800169cccce5.json @@ -0,0 +1,8 @@ +{ + "id": "752f8fe5-7ebd-4abf-82a3-800169cccce5", + "type": "feature", + "description": "This release decouples member abilities in a collaboration. With this change, the member who can run queries no longer needs to be the same as the member who can receive results.", + "modules": [ + "service/cleanrooms" + ] +} \ No newline at end of file diff --git a/.changelog/86cca09635134c50862995a0a4ff6d96.json b/.changelog/86cca09635134c50862995a0a4ff6d96.json new file mode 100644 index 00000000000..592a3656cec --- /dev/null +++ b/.changelog/86cca09635134c50862995a0a4ff6d96.json @@ -0,0 +1,8 @@ +{ + "id": "86cca096-3513-4c50-8629-95a0a4ff6d96", + "type": "feature", + "description": "Network Firewall increasing pagination token string length", + "modules": [ + "service/networkfirewall" + ] +} \ No newline at end of file diff --git a/.changelog/878931b3806d4c11bb312ebc9e820138.json b/.changelog/878931b3806d4c11bb312ebc9e820138.json new file mode 100644 index 00000000000..39bbc63ff56 --- /dev/null +++ b/.changelog/878931b3806d4c11bb312ebc9e820138.json @@ -0,0 +1,8 @@ +{ + "id": "878931b3-806d-4c11-bb31-2ebc9e820138", + "type": "feature", + "description": "Amazon SageMaker Canvas adds IdentityProviderOAuthSettings support for CanvasAppSettings", + "modules": [ + "service/sagemaker" + ] +} \ No newline at end of file diff --git a/.changelog/a86db4b453d44666b9012dd565a42338.json b/.changelog/a86db4b453d44666b9012dd565a42338.json new file mode 100644 index 00000000000..daff864233c --- /dev/null +++ b/.changelog/a86db4b453d44666b9012dd565a42338.json @@ -0,0 +1,8 @@ +{ + "id": "a86db4b4-53d4-4666-b901-2dd565a42338", + "type": "feature", + "description": "App Runner adds support for Bitbucket. You can now create App Runner connection that connects to your Bitbucket repositories and deploy App Runner service with the source code stored in a Bitbucket repository.", + "modules": [ + "service/apprunner" + ] +} \ No newline at end of file diff --git a/.changelog/b4b1637b11104d2c9228da905e5e4ccd.json b/.changelog/b4b1637b11104d2c9228da905e5e4ccd.json new file mode 100644 index 00000000000..d3e6683a3ea --- /dev/null +++ b/.changelog/b4b1637b11104d2c9228da905e5e4ccd.json @@ -0,0 +1,8 @@ +{ + "id": "b4b1637b-1110-4d2c-9228-da905e5e4ccd", + "type": "feature", + "description": "Add SAP source connector parallel and pagination feature", + "modules": [ + "service/appflow" + ] +} \ No newline at end of file diff --git a/.changelog/bd37b005f4a44feeb6d9d18d7f68fb5a.json b/.changelog/bd37b005f4a44feeb6d9d18d7f68fb5a.json new file mode 100644 index 00000000000..caa649cea37 --- /dev/null +++ b/.changelog/bd37b005f4a44feeb6d9d18d7f68fb5a.json @@ -0,0 +1,8 @@ +{ + "id": "bd37b005-f4a4-4fee-b6d9-d18d7f68fb5a", + "type": "feature", + "description": "The Connector for AD allows you to use a fully-managed AWS Private CA as a drop-in replacement for your self-managed enterprise CAs without local agents or proxy servers. Enterprises that use AD to manage Windows environments can reduce their private certificate authority (CA) costs and complexity.", + "modules": [ + "service/pcaconnectorad" + ] +} \ No newline at end of file diff --git a/service/appflow/deserializers.go b/service/appflow/deserializers.go index 536a93e957c..8ee5ead0a1b 100644 --- a/service/appflow/deserializers.go +++ b/service/appflow/deserializers.go @@ -440,6 +440,9 @@ func awsRestjson1_deserializeOpErrorCreateFlow(response *smithyhttp.Response, me } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("ConflictException", errorCode): return awsRestjson1_deserializeErrorConflictException(response, errorBody) @@ -3753,6 +3756,9 @@ func awsRestjson1_deserializeOpErrorUpdateFlow(response *smithyhttp.Response, me } switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + case strings.EqualFold("ConflictException", errorCode): return awsRestjson1_deserializeErrorConflictException(response, errorBody) @@ -7721,6 +7727,32 @@ func awsRestjson1_deserializeDocumentExecutionResult(v **types.ExecutionResult, return err } + case "maxPageSize": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaxPageSize = ptr.Int64(i64) + } + + case "numParallelProcesses": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumParallelProcesses = ptr.Int64(i64) + } + case "recordsProcessed": if value != nil { jtv, ok := value.(json.Number) @@ -10780,6 +10812,94 @@ func awsRestjson1_deserializeDocumentSAPODataMetadata(v **types.SAPODataMetadata return nil } +func awsRestjson1_deserializeDocumentSAPODataPaginationConfig(v **types.SAPODataPaginationConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SAPODataPaginationConfig + if *v == nil { + sv = &types.SAPODataPaginationConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "maxPageSize": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected SAPODataMaxPageSize to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaxPageSize = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSAPODataParallelismConfig(v **types.SAPODataParallelismConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SAPODataParallelismConfig + if *v == nil { + sv = &types.SAPODataParallelismConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "maxParallelism": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected SAPODataMaxParallelism to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.MaxParallelism = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentSAPODataSourceProperties(v **types.SAPODataSourceProperties, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -10811,6 +10931,16 @@ func awsRestjson1_deserializeDocumentSAPODataSourceProperties(v **types.SAPOData sv.ObjectPath = ptr.String(jtv) } + case "paginationConfig": + if err := awsRestjson1_deserializeDocumentSAPODataPaginationConfig(&sv.PaginationConfig, value); err != nil { + return err + } + + case "parallelismConfig": + if err := awsRestjson1_deserializeDocumentSAPODataParallelismConfig(&sv.ParallelismConfig, value); err != nil { + return err + } + default: _, _ = key, value diff --git a/service/appflow/serializers.go b/service/appflow/serializers.go index d1849bac5b8..a732755bfc1 100644 --- a/service/appflow/serializers.go +++ b/service/appflow/serializers.go @@ -4190,6 +4190,30 @@ func awsRestjson1_serializeDocumentSAPODataDestinationProperties(v *types.SAPODa return nil } +func awsRestjson1_serializeDocumentSAPODataPaginationConfig(v *types.SAPODataPaginationConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxPageSize != nil { + ok := object.Key("maxPageSize") + ok.Integer(*v.MaxPageSize) + } + + return nil +} + +func awsRestjson1_serializeDocumentSAPODataParallelismConfig(v *types.SAPODataParallelismConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.MaxParallelism != nil { + ok := object.Key("maxParallelism") + ok.Integer(*v.MaxParallelism) + } + + return nil +} + func awsRestjson1_serializeDocumentSAPODataSourceProperties(v *types.SAPODataSourceProperties, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -4199,6 +4223,20 @@ func awsRestjson1_serializeDocumentSAPODataSourceProperties(v *types.SAPODataSou ok.String(*v.ObjectPath) } + if v.PaginationConfig != nil { + ok := object.Key("paginationConfig") + if err := awsRestjson1_serializeDocumentSAPODataPaginationConfig(v.PaginationConfig, ok); err != nil { + return err + } + } + + if v.ParallelismConfig != nil { + ok := object.Key("parallelismConfig") + if err := awsRestjson1_serializeDocumentSAPODataParallelismConfig(v.ParallelismConfig, ok); err != nil { + return err + } + } + return nil } diff --git a/service/appflow/types/types.go b/service/appflow/types/types.go index 6e3e64d5bf4..6bde199852b 100644 --- a/service/appflow/types/types.go +++ b/service/appflow/types/types.go @@ -1165,6 +1165,14 @@ type ExecutionResult struct { // Provides any error message information related to the flow run. ErrorInfo *ErrorInfo + // The maximum number of records that Amazon AppFlow receives in each page of the + // response from your SAP application. + MaxPageSize *int64 + + // The number of processes that Amazon AppFlow ran at the same time when it + // retrieved your data. + NumParallelProcesses *int64 + // The number of records processed in the flow run. RecordsProcessed *int64 @@ -2329,12 +2337,52 @@ type SAPODataMetadata struct { noSmithyDocumentSerde } +// Sets the page size for each concurrent process that transfers OData records +// from your SAP instance. A concurrent process is query that retrieves a batch of +// records as part of a flow run. Amazon AppFlow can run multiple concurrent +// processes in parallel to transfer data faster. +type SAPODataPaginationConfig struct { + + // The maximum number of records that Amazon AppFlow receives in each page of the + // response from your SAP application. For transfers of OData records, the maximum + // page size is 3,000. For transfers of data that comes from an ODP provider, the + // maximum page size is 10,000. + // + // This member is required. + MaxPageSize *int32 + + noSmithyDocumentSerde +} + +// Sets the number of concurrent processes that transfer OData records from your +// SAP instance. A concurrent process is query that retrieves a batch of records as +// part of a flow run. Amazon AppFlow can run multiple concurrent processes in +// parallel to transfer data faster. +type SAPODataParallelismConfig struct { + + // The maximum number of processes that Amazon AppFlow runs at the same time when + // it retrieves your data from your SAP application. + // + // This member is required. + MaxParallelism *int32 + + noSmithyDocumentSerde +} + // The properties that are applied when using SAPOData as a flow source. type SAPODataSourceProperties struct { // The object path specified in the SAPOData flow source. ObjectPath *string + // Sets the page size for each concurrent process that transfers OData records + // from your SAP instance. + PaginationConfig *SAPODataPaginationConfig + + // Sets the number of concurrent processes that transfers OData records from your + // SAP instance. + ParallelismConfig *SAPODataParallelismConfig + noSmithyDocumentSerde } diff --git a/service/appflow/validators.go b/service/appflow/validators.go index 41a37cf6ab6..0bbf16c8ec8 100644 --- a/service/appflow/validators.go +++ b/service/appflow/validators.go @@ -1510,6 +1510,58 @@ func validateSAPODataDestinationProperties(v *types.SAPODataDestinationPropertie } } +func validateSAPODataPaginationConfig(v *types.SAPODataPaginationConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SAPODataPaginationConfig"} + if v.MaxPageSize == nil { + invalidParams.Add(smithy.NewErrParamRequired("MaxPageSize")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateSAPODataParallelismConfig(v *types.SAPODataParallelismConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SAPODataParallelismConfig"} + if v.MaxParallelism == nil { + invalidParams.Add(smithy.NewErrParamRequired("MaxParallelism")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateSAPODataSourceProperties(v *types.SAPODataSourceProperties) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "SAPODataSourceProperties"} + if v.ParallelismConfig != nil { + if err := validateSAPODataParallelismConfig(v.ParallelismConfig); err != nil { + invalidParams.AddNested("ParallelismConfig", err.(smithy.InvalidParamsError)) + } + } + if v.PaginationConfig != nil { + if err := validateSAPODataPaginationConfig(v.PaginationConfig); err != nil { + invalidParams.AddNested("PaginationConfig", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateScheduledTriggerProperties(v *types.ScheduledTriggerProperties) error { if v == nil { return nil @@ -1783,6 +1835,11 @@ func validateSourceConnectorProperties(v *types.SourceConnectorProperties) error invalidParams.AddNested("Zendesk", err.(smithy.InvalidParamsError)) } } + if v.SAPOData != nil { + if err := validateSAPODataSourceProperties(v.SAPOData); err != nil { + invalidParams.AddNested("SAPOData", err.(smithy.InvalidParamsError)) + } + } if v.CustomConnector != nil { if err := validateCustomConnectorSourceProperties(v.CustomConnector); err != nil { invalidParams.AddNested("CustomConnector", err.(smithy.InvalidParamsError)) diff --git a/service/apprunner/api_op_CreateConnection.go b/service/apprunner/api_op_CreateConnection.go index e64be568461..6667f74afc4 100644 --- a/service/apprunner/api_op_CreateConnection.go +++ b/service/apprunner/api_op_CreateConnection.go @@ -19,9 +19,9 @@ import ( // Create an App Runner connection resource. App Runner requires a connection // resource when you create App Runner services that access private repositories // from certain third-party providers. You can share a connection across multiple -// services. A connection resource is needed to access GitHub repositories. GitHub -// requires a user interface approval process through the App Runner console before -// you can use the connection. +// services. A connection resource is needed to access GitHub and Bitbucket +// repositories. Both require a user interface approval process through the App +// Runner console before you can use the connection. func (c *Client) CreateConnection(ctx context.Context, params *CreateConnectionInput, optFns ...func(*Options)) (*CreateConnectionOutput, error) { if params == nil { params = &CreateConnectionInput{} diff --git a/service/apprunner/types/enums.go b/service/apprunner/types/enums.go index af60f4a7918..f6b215a840e 100644 --- a/service/apprunner/types/enums.go +++ b/service/apprunner/types/enums.go @@ -242,7 +242,8 @@ type ProviderType string // Enum values for ProviderType const ( - ProviderTypeGithub ProviderType = "GITHUB" + ProviderTypeGithub ProviderType = "GITHUB" + ProviderTypeBitbucket ProviderType = "BITBUCKET" ) // Values returns all known values for ProviderType. Note that this can be @@ -251,6 +252,7 @@ const ( func (ProviderType) Values() []ProviderType { return []ProviderType{ "GITHUB", + "BITBUCKET", } } diff --git a/service/apprunner/types/types.go b/service/apprunner/types/types.go index 6052487d41a..c6d61e639e8 100644 --- a/service/apprunner/types/types.go +++ b/service/apprunner/types/types.go @@ -630,11 +630,10 @@ type Service struct { // The current state of the App Runner service. These particular values mean the // following. - // - CREATE_FAILED – The service failed to create. To troubleshoot this failure, - // read the failure events and logs, change any parameters that need to be fixed, - // and retry the call to create the service. The failed service isn't usable, and - // still counts towards your service quota. When you're done analyzing the failure, - // delete the service. + // - CREATE_FAILED – The service failed to create. The failed service isn't + // usable, and still counts towards your service quota. To troubleshoot this + // failure, read the failure events and logs, change any parameters that need to be + // fixed, and rebuild your service using UpdateService . // - DELETE_FAILED – The service failed to delete and can't be successfully // recovered. Retry the service deletion call to ensure that all related resources // are removed. @@ -725,10 +724,10 @@ type ServiceSummary struct { // The current state of the App Runner service. These particular values mean the // following. - // - CREATE_FAILED – The service failed to create. Read the failure events and - // logs, change any parameters that need to be fixed, and retry the call to create - // the service. The failed service isn't usable, and still counts towards your - // service quota. When you're done analyzing the failure, delete the service. + // - CREATE_FAILED – The service failed to create. The failed service isn't + // usable, and still counts towards your service quota. To troubleshoot this + // failure, read the failure events and logs, change any parameters that need to be + // fixed, and rebuild your service using UpdateService . // - DELETE_FAILED – The service failed to delete and can't be successfully // recovered. Retry the service deletion call to ensure that all related resources // are removed. diff --git a/service/cleanrooms/api_op_CreateMembership.go b/service/cleanrooms/api_op_CreateMembership.go index df2f1c32faa..f551083b1e2 100644 --- a/service/cleanrooms/api_op_CreateMembership.go +++ b/service/cleanrooms/api_op_CreateMembership.go @@ -46,6 +46,10 @@ type CreateMembershipInput struct { // This member is required. QueryLogStatus types.MembershipQueryLogStatus + // The default protected query result configuration as specified by the member who + // can receive results. + DefaultResultConfiguration *types.MembershipProtectedQueryResultConfiguration + // An optional label that you can assign to a resource when you create it. Each // tag consists of a key and an optional value, both of which you define. When you // use tagging, you can also use tag-based access control in IAM policies to diff --git a/service/cleanrooms/api_op_StartProtectedQuery.go b/service/cleanrooms/api_op_StartProtectedQuery.go index 53d1d198449..5f9315972e9 100644 --- a/service/cleanrooms/api_op_StartProtectedQuery.go +++ b/service/cleanrooms/api_op_StartProtectedQuery.go @@ -16,7 +16,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Creates a protected query that is started by Clean Rooms . +// Creates a protected query that is started by Clean Rooms. func (c *Client) StartProtectedQuery(ctx context.Context, params *StartProtectedQueryInput, optFns ...func(*Options)) (*StartProtectedQueryOutput, error) { if params == nil { params = &StartProtectedQueryInput{} @@ -40,11 +40,6 @@ type StartProtectedQueryInput struct { // This member is required. MembershipIdentifier *string - // The details needed to write the query results. - // - // This member is required. - ResultConfiguration *types.ProtectedQueryResultConfiguration - // The protected SQL query parameters. // // This member is required. @@ -55,6 +50,9 @@ type StartProtectedQueryInput struct { // This member is required. Type types.ProtectedQueryType + // The details needed to write the query results. + ResultConfiguration *types.ProtectedQueryResultConfiguration + noSmithyDocumentSerde } diff --git a/service/cleanrooms/api_op_UpdateMembership.go b/service/cleanrooms/api_op_UpdateMembership.go index 33e41583c36..9de0bf32e3d 100644 --- a/service/cleanrooms/api_op_UpdateMembership.go +++ b/service/cleanrooms/api_op_UpdateMembership.go @@ -39,6 +39,10 @@ type UpdateMembershipInput struct { // This member is required. MembershipIdentifier *string + // The default protected query result configuration as specified by the member who + // can receive results. + DefaultResultConfiguration *types.MembershipProtectedQueryResultConfiguration + // An indicator as to whether query logging has been enabled or disabled for the // collaboration. QueryLogStatus types.MembershipQueryLogStatus diff --git a/service/cleanrooms/deserializers.go b/service/cleanrooms/deserializers.go index 1ff1aff5d15..8a089a0ed2a 100644 --- a/service/cleanrooms/deserializers.go +++ b/service/cleanrooms/deserializers.go @@ -10355,6 +10355,11 @@ func awsRestjson1_deserializeDocumentMembership(v **types.Membership, value inte } } + case "defaultResultConfiguration": + if err := awsRestjson1_deserializeDocumentMembershipProtectedQueryResultConfiguration(&sv.DefaultResultConfiguration, value); err != nil { + return err + } + case "id": if value != nil { jtv, ok := value.(string) @@ -10412,6 +10417,91 @@ func awsRestjson1_deserializeDocumentMembership(v **types.Membership, value inte return nil } +func awsRestjson1_deserializeDocumentMembershipProtectedQueryOutputConfiguration(v *types.MembershipProtectedQueryOutputConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.MembershipProtectedQueryOutputConfiguration +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "s3": + var mv types.ProtectedQueryS3OutputConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentProtectedQueryS3OutputConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.MembershipProtectedQueryOutputConfigurationMemberS3{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentMembershipProtectedQueryResultConfiguration(v **types.MembershipProtectedQueryResultConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MembershipProtectedQueryResultConfiguration + if *v == nil { + sv = &types.MembershipProtectedQueryResultConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "outputConfiguration": + if err := awsRestjson1_deserializeDocumentMembershipProtectedQueryOutputConfiguration(&sv.OutputConfiguration, value); err != nil { + return err + } + + case "roleArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RoleArn to be of type string, got %T instead", value) + } + sv.RoleArn = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentMembershipSummary(v **types.MembershipSummary, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -10926,6 +11016,40 @@ func awsRestjson1_deserializeDocumentProtectedQueryError(v **types.ProtectedQuer return nil } +func awsRestjson1_deserializeDocumentProtectedQueryMemberOutputList(v *[]types.ProtectedQuerySingleMemberOutput, 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.ProtectedQuerySingleMemberOutput + if *v == nil { + cv = []types.ProtectedQuerySingleMemberOutput{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ProtectedQuerySingleMemberOutput + destAddr := &col + if err := awsRestjson1_deserializeDocumentProtectedQuerySingleMemberOutput(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentProtectedQueryOutput(v *types.ProtectedQueryOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -10946,6 +11070,14 @@ loop: continue } switch key { + case "memberList": + var mv []types.ProtectedQuerySingleMemberOutput + if err := awsRestjson1_deserializeDocumentProtectedQueryMemberOutputList(&mv, value); err != nil { + return err + } + uv = &types.ProtectedQueryOutputMemberMemberList{Value: mv} + break loop + case "s3": var mv types.ProtectedQueryS3Output destAddr := &mv @@ -11176,6 +11308,46 @@ func awsRestjson1_deserializeDocumentProtectedQueryS3OutputConfiguration(v **typ return nil } +func awsRestjson1_deserializeDocumentProtectedQuerySingleMemberOutput(v **types.ProtectedQuerySingleMemberOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ProtectedQuerySingleMemberOutput + if *v == nil { + sv = &types.ProtectedQuerySingleMemberOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "accountId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AccountId to be of type string, got %T instead", value) + } + sv.AccountId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentProtectedQuerySQLParameters(v **types.ProtectedQuerySQLParameters, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/cleanrooms/doc.go b/service/cleanrooms/doc.go index c32f4d463e8..bb0090724ab 100644 --- a/service/cleanrooms/doc.go +++ b/service/cleanrooms/doc.go @@ -9,5 +9,7 @@ // results can get insights into the collective datasets without either party // getting access to the other party's raw data. To learn more about Clean Rooms // concepts, procedures, and best practices, see the Clean Rooms User Guide (https://docs.aws.amazon.com/clean-rooms/latest/userguide/what-is.html) +// . To learn more about SQL commands, functions, and conditions supported in Clean +// Rooms, see the Clean Rooms SQL Reference (https://docs.aws.amazon.com/clean-rooms/latest/sql-reference/sql-reference.html) // . package cleanrooms diff --git a/service/cleanrooms/endpoints_test.go b/service/cleanrooms/endpoints_test.go index 8d74b02587f..6298ef3a85f 100644 --- a/service/cleanrooms/endpoints_test.go +++ b/service/cleanrooms/endpoints_test.go @@ -14,10 +14,10 @@ import ( "testing" ) -// For region us-gov-east-1 with FIPS enabled and DualStack enabled +// For region us-east-1 with FIPS enabled and DualStack enabled func TestEndpointCase0(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-gov-east-1"), + Region: ptr.String("us-east-1"), UseFIPS: ptr.Bool(true), UseDualStack: ptr.Bool(true), } @@ -30,7 +30,7 @@ func TestEndpointCase0(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms-fips.us-gov-east-1.api.aws") + uri, _ := url.Parse("https://cleanrooms-fips.us-east-1.api.aws") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -53,10 +53,10 @@ func TestEndpointCase0(t *testing.T) { } } -// For region us-gov-east-1 with FIPS enabled and DualStack disabled +// For region us-east-1 with FIPS enabled and DualStack disabled func TestEndpointCase1(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-gov-east-1"), + Region: ptr.String("us-east-1"), UseFIPS: ptr.Bool(true), UseDualStack: ptr.Bool(false), } @@ -69,7 +69,7 @@ func TestEndpointCase1(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms-fips.us-gov-east-1.amazonaws.com") + uri, _ := url.Parse("https://cleanrooms-fips.us-east-1.amazonaws.com") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -92,10 +92,10 @@ func TestEndpointCase1(t *testing.T) { } } -// For region us-gov-east-1 with FIPS disabled and DualStack enabled +// For region us-east-1 with FIPS disabled and DualStack enabled func TestEndpointCase2(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-gov-east-1"), + Region: ptr.String("us-east-1"), UseFIPS: ptr.Bool(false), UseDualStack: ptr.Bool(true), } @@ -108,7 +108,7 @@ func TestEndpointCase2(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms.us-gov-east-1.api.aws") + uri, _ := url.Parse("https://cleanrooms.us-east-1.api.aws") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -131,10 +131,10 @@ func TestEndpointCase2(t *testing.T) { } } -// For region us-gov-east-1 with FIPS disabled and DualStack disabled +// For region us-east-1 with FIPS disabled and DualStack disabled func TestEndpointCase3(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-gov-east-1"), + Region: ptr.String("us-east-1"), UseFIPS: ptr.Bool(false), UseDualStack: ptr.Bool(false), } @@ -147,7 +147,7 @@ func TestEndpointCase3(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms.us-gov-east-1.amazonaws.com") + uri, _ := url.Parse("https://cleanrooms.us-east-1.amazonaws.com") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -326,10 +326,10 @@ func TestEndpointCase7(t *testing.T) { } } -// For region us-iso-east-1 with FIPS enabled and DualStack enabled +// For region us-gov-east-1 with FIPS enabled and DualStack enabled func TestEndpointCase8(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-iso-east-1"), + Region: ptr.String("us-gov-east-1"), UseFIPS: ptr.Bool(true), UseDualStack: ptr.Bool(true), } @@ -338,31 +338,11 @@ func TestEndpointCase8(t *testing.T) { result, err := resolver.ResolveEndpoint(context.Background(), params) _, _ = result, err - if err == nil { - t.Fatalf("expect error, got none") - } - if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { - t.Errorf("expect %v error in %v", e, a) - } -} - -// For region us-iso-east-1 with FIPS enabled and DualStack disabled -func TestEndpointCase9(t *testing.T) { - var params = EndpointParameters{ - Region: ptr.String("us-iso-east-1"), - UseFIPS: ptr.Bool(true), - UseDualStack: ptr.Bool(false), - } - - resolver := NewDefaultEndpointResolverV2() - result, err := resolver.ResolveEndpoint(context.Background(), params) - _, _ = result, err - if err != nil { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms-fips.us-iso-east-1.c2s.ic.gov") + uri, _ := url.Parse("https://cleanrooms-fips.us-gov-east-1.api.aws") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -385,31 +365,11 @@ func TestEndpointCase9(t *testing.T) { } } -// For region us-iso-east-1 with FIPS disabled and DualStack enabled -func TestEndpointCase10(t *testing.T) { - var params = EndpointParameters{ - Region: ptr.String("us-iso-east-1"), - UseFIPS: ptr.Bool(false), - UseDualStack: ptr.Bool(true), - } - - resolver := NewDefaultEndpointResolverV2() - result, err := resolver.ResolveEndpoint(context.Background(), params) - _, _ = result, err - - if err == nil { - t.Fatalf("expect error, got none") - } - if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) { - t.Errorf("expect %v error in %v", e, a) - } -} - -// For region us-iso-east-1 with FIPS disabled and DualStack disabled -func TestEndpointCase11(t *testing.T) { +// For region us-gov-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase9(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-iso-east-1"), - UseFIPS: ptr.Bool(false), + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(true), UseDualStack: ptr.Bool(false), } @@ -421,7 +381,7 @@ func TestEndpointCase11(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms.us-iso-east-1.c2s.ic.gov") + uri, _ := url.Parse("https://cleanrooms-fips.us-gov-east-1.amazonaws.com") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -444,11 +404,11 @@ func TestEndpointCase11(t *testing.T) { } } -// For region us-east-1 with FIPS enabled and DualStack enabled -func TestEndpointCase12(t *testing.T) { +// For region us-gov-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase10(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-east-1"), - UseFIPS: ptr.Bool(true), + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(false), UseDualStack: ptr.Bool(true), } @@ -460,7 +420,7 @@ func TestEndpointCase12(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms-fips.us-east-1.api.aws") + uri, _ := url.Parse("https://cleanrooms.us-gov-east-1.api.aws") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -483,11 +443,11 @@ func TestEndpointCase12(t *testing.T) { } } -// For region us-east-1 with FIPS enabled and DualStack disabled -func TestEndpointCase13(t *testing.T) { +// For region us-gov-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase11(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-east-1"), - UseFIPS: ptr.Bool(true), + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(false), UseDualStack: ptr.Bool(false), } @@ -499,7 +459,7 @@ func TestEndpointCase13(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms-fips.us-east-1.amazonaws.com") + uri, _ := url.Parse("https://cleanrooms.us-gov-east-1.amazonaws.com") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -522,11 +482,11 @@ func TestEndpointCase13(t *testing.T) { } } -// For region us-east-1 with FIPS disabled and DualStack enabled -func TestEndpointCase14(t *testing.T) { +// For region us-iso-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase12(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-east-1"), - UseFIPS: ptr.Bool(false), + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), UseDualStack: ptr.Bool(true), } @@ -534,11 +494,31 @@ func TestEndpointCase14(t *testing.T) { result, err := resolver.ResolveEndpoint(context.Background(), params) _, _ = result, err + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-iso-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase13(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + if err != nil { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms.us-east-1.api.aws") + uri, _ := url.Parse("https://cleanrooms-fips.us-iso-east-1.c2s.ic.gov") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -561,10 +541,30 @@ func TestEndpointCase14(t *testing.T) { } } -// For region us-east-1 with FIPS disabled and DualStack disabled +// For region us-iso-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase14(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-iso-east-1 with FIPS disabled and DualStack disabled func TestEndpointCase15(t *testing.T) { var params = EndpointParameters{ - Region: ptr.String("us-east-1"), + Region: ptr.String("us-iso-east-1"), UseFIPS: ptr.Bool(false), UseDualStack: ptr.Bool(false), } @@ -577,7 +577,7 @@ func TestEndpointCase15(t *testing.T) { t.Fatalf("expect no error, got %v", err) } - uri, _ := url.Parse("https://cleanrooms.us-east-1.amazonaws.com") + uri, _ := url.Parse("https://cleanrooms.us-iso-east-1.c2s.ic.gov") expectEndpoint := smithyendpoints.Endpoint{ URI: *uri, @@ -718,7 +718,7 @@ func TestEndpointCase19(t *testing.T) { } } -// For custom endpoint with fips disabled and dualstack disabled +// For custom endpoint with region set and fips disabled and dualstack disabled func TestEndpointCase20(t *testing.T) { var params = EndpointParameters{ Region: ptr.String("us-east-1"), @@ -758,8 +758,47 @@ func TestEndpointCase20(t *testing.T) { } } -// For custom endpoint with fips enabled and dualstack disabled +// For custom endpoint with region not set and fips disabled and dualstack disabled func TestEndpointCase21(t *testing.T) { + var params = EndpointParameters{ + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For custom endpoint with fips enabled and dualstack disabled +func TestEndpointCase22(t *testing.T) { var params = EndpointParameters{ Region: ptr.String("us-east-1"), UseFIPS: ptr.Bool(true), @@ -780,7 +819,7 @@ func TestEndpointCase21(t *testing.T) { } // For custom endpoint with fips disabled and dualstack enabled -func TestEndpointCase22(t *testing.T) { +func TestEndpointCase23(t *testing.T) { var params = EndpointParameters{ Region: ptr.String("us-east-1"), UseFIPS: ptr.Bool(false), @@ -799,3 +838,19 @@ func TestEndpointCase22(t *testing.T) { t.Errorf("expect %v error in %v", e, a) } } + +// Missing region +func TestEndpointCase24(t *testing.T) { + var params = EndpointParameters{} + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: Missing Region", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} diff --git a/service/cleanrooms/serializers.go b/service/cleanrooms/serializers.go index 6feff657a6e..996ede1b7e4 100644 --- a/service/cleanrooms/serializers.go +++ b/service/cleanrooms/serializers.go @@ -814,6 +814,13 @@ func awsRestjson1_serializeOpDocumentCreateMembershipInput(v *CreateMembershipIn ok.String(*v.CollaborationIdentifier) } + if v.DefaultResultConfiguration != nil { + ok := object.Key("defaultResultConfiguration") + if err := awsRestjson1_serializeDocumentMembershipProtectedQueryResultConfiguration(v.DefaultResultConfiguration, ok); err != nil { + return err + } + } + if len(v.QueryLogStatus) > 0 { ok := object.Key("queryLogStatus") ok.String(string(v.QueryLogStatus)) @@ -3580,6 +3587,13 @@ func awsRestjson1_serializeOpDocumentUpdateMembershipInput(v *UpdateMembershipIn object := value.Object() defer object.Close() + if v.DefaultResultConfiguration != nil { + ok := object.Key("defaultResultConfiguration") + if err := awsRestjson1_serializeDocumentMembershipProtectedQueryResultConfiguration(v.DefaultResultConfiguration, ok); err != nil { + return err + } + } + if len(v.QueryLogStatus) > 0 { ok := object.Key("queryLogStatus") ok.String(string(v.QueryLogStatus)) @@ -4099,6 +4113,43 @@ func awsRestjson1_serializeDocumentMemberList(v []types.MemberSpecification, val return nil } +func awsRestjson1_serializeDocumentMembershipProtectedQueryOutputConfiguration(v types.MembershipProtectedQueryOutputConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.MembershipProtectedQueryOutputConfigurationMemberS3: + av := object.Key("s3") + if err := awsRestjson1_serializeDocumentProtectedQueryS3OutputConfiguration(&uv.Value, av); err != nil { + return err + } + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentMembershipProtectedQueryResultConfiguration(v *types.MembershipProtectedQueryResultConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.OutputConfiguration != nil { + ok := object.Key("outputConfiguration") + if err := awsRestjson1_serializeDocumentMembershipProtectedQueryOutputConfiguration(v.OutputConfiguration, ok); err != nil { + return err + } + } + + if v.RoleArn != nil { + ok := object.Key("roleArn") + ok.String(*v.RoleArn) + } + + return nil +} + func awsRestjson1_serializeDocumentMemberSpecification(v *types.MemberSpecification, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/cleanrooms/types/types.go b/service/cleanrooms/types/types.go index c30a0479969..aded3d2cbc9 100644 --- a/service/cleanrooms/types/types.go +++ b/service/cleanrooms/types/types.go @@ -1117,6 +1117,45 @@ type Membership struct { // This member is required. UpdateTime *time.Time + // The default protected query result configuration as specified by the member who + // can receive results. + DefaultResultConfiguration *MembershipProtectedQueryResultConfiguration + + noSmithyDocumentSerde +} + +// Contains configurations for protected query results. +// +// The following types satisfy this interface: +// +// MembershipProtectedQueryOutputConfigurationMemberS3 +type MembershipProtectedQueryOutputConfiguration interface { + isMembershipProtectedQueryOutputConfiguration() +} + +// Contains the configuration to write the query results to S3. +type MembershipProtectedQueryOutputConfigurationMemberS3 struct { + Value ProtectedQueryS3OutputConfiguration + + noSmithyDocumentSerde +} + +func (*MembershipProtectedQueryOutputConfigurationMemberS3) isMembershipProtectedQueryOutputConfiguration() { +} + +// Contains configurations for protected query results. +type MembershipProtectedQueryResultConfiguration struct { + + // Configuration for protected query results. + // + // This member is required. + OutputConfiguration MembershipProtectedQueryOutputConfiguration + + // The unique ARN for an IAM role that is used by Clean Rooms to write protected + // query results to the result location, given by the member who can receive + // results. + RoleArn *string + noSmithyDocumentSerde } @@ -1272,16 +1311,6 @@ type ProtectedQuery struct { // This member is required. MembershipId *string - // Contains any details needed to write the query results. - // - // This member is required. - ResultConfiguration *ProtectedQueryResultConfiguration - - // The protected query SQL parameters. - // - // This member is required. - SqlParameters *ProtectedQuerySQLParameters - // The status of the query. // // This member is required. @@ -1293,6 +1322,12 @@ type ProtectedQuery struct { // The result of the protected query. Result *ProtectedQueryResult + // Contains any details needed to write the query results. + ResultConfiguration *ProtectedQueryResultConfiguration + + // The protected query SQL parameters. + SqlParameters *ProtectedQuerySQLParameters + // Statistics about protected query execution. Statistics *ProtectedQueryStatistics @@ -1319,11 +1354,22 @@ type ProtectedQueryError struct { // // The following types satisfy this interface: // +// ProtectedQueryOutputMemberMemberList // ProtectedQueryOutputMemberS3 type ProtectedQueryOutput interface { isProtectedQueryOutput() } +// The list of member Amazon Web Services account(s) that received the results of +// the query. +type ProtectedQueryOutputMemberMemberList struct { + Value []ProtectedQuerySingleMemberOutput + + noSmithyDocumentSerde +} + +func (*ProtectedQueryOutputMemberMemberList) isProtectedQueryOutput() {} + // If present, the output for a protected query with an `S3` output type. type ProtectedQueryOutputMemberS3 struct { Value ProtectedQueryS3Output @@ -1403,6 +1449,18 @@ type ProtectedQueryS3OutputConfiguration struct { noSmithyDocumentSerde } +// Details about the member who received the query result. +type ProtectedQuerySingleMemberOutput struct { + + // The Amazon Web Services account ID of the member in the collaboration who can + // receive results for the query. + // + // This member is required. + AccountId *string + + noSmithyDocumentSerde +} + // The parameters for the SQL type Protected Query. type ProtectedQuerySQLParameters struct { @@ -1623,11 +1681,12 @@ type UnknownUnionMember struct { noSmithyDocumentSerde } -func (*UnknownUnionMember) isAnalysisRulePolicy() {} -func (*UnknownUnionMember) isAnalysisRulePolicyV1() {} -func (*UnknownUnionMember) isAnalysisSource() {} -func (*UnknownUnionMember) isConfiguredTableAnalysisRulePolicy() {} -func (*UnknownUnionMember) isConfiguredTableAnalysisRulePolicyV1() {} -func (*UnknownUnionMember) isProtectedQueryOutput() {} -func (*UnknownUnionMember) isProtectedQueryOutputConfiguration() {} -func (*UnknownUnionMember) isTableReference() {} +func (*UnknownUnionMember) isAnalysisRulePolicy() {} +func (*UnknownUnionMember) isAnalysisRulePolicyV1() {} +func (*UnknownUnionMember) isAnalysisSource() {} +func (*UnknownUnionMember) isConfiguredTableAnalysisRulePolicy() {} +func (*UnknownUnionMember) isConfiguredTableAnalysisRulePolicyV1() {} +func (*UnknownUnionMember) isMembershipProtectedQueryOutputConfiguration() {} +func (*UnknownUnionMember) isProtectedQueryOutput() {} +func (*UnknownUnionMember) isProtectedQueryOutputConfiguration() {} +func (*UnknownUnionMember) isTableReference() {} diff --git a/service/cleanrooms/types/types_exported_test.go b/service/cleanrooms/types/types_exported_test.go index caf1fe1b79b..31c438dda63 100644 --- a/service/cleanrooms/types/types_exported_test.go +++ b/service/cleanrooms/types/types_exported_test.go @@ -113,10 +113,31 @@ var _ *types.AnalysisRuleAggregation var _ *types.AnalysisRuleCustom var _ *types.AnalysisRuleList +func ExampleMembershipProtectedQueryOutputConfiguration_outputUsage() { + var union types.MembershipProtectedQueryOutputConfiguration + // type switches can be used to check the union value + switch v := union.(type) { + case *types.MembershipProtectedQueryOutputConfigurationMemberS3: + _ = v.Value // Value is types.ProtectedQueryS3OutputConfiguration + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.ProtectedQueryS3OutputConfiguration + func ExampleProtectedQueryOutput_outputUsage() { var union types.ProtectedQueryOutput // type switches can be used to check the union value switch v := union.(type) { + case *types.ProtectedQueryOutputMemberMemberList: + _ = v.Value // Value is []types.ProtectedQuerySingleMemberOutput + case *types.ProtectedQueryOutputMemberS3: _ = v.Value // Value is types.ProtectedQueryS3Output @@ -129,6 +150,7 @@ func ExampleProtectedQueryOutput_outputUsage() { } } +var _ []types.ProtectedQuerySingleMemberOutput var _ *types.ProtectedQueryS3Output func ExampleProtectedQueryOutputConfiguration_outputUsage() { diff --git a/service/cleanrooms/validators.go b/service/cleanrooms/validators.go index 6b95bf79fe3..cd8f6e3db5f 100644 --- a/service/cleanrooms/validators.go +++ b/service/cleanrooms/validators.go @@ -1301,6 +1301,44 @@ func validateMemberList(v []types.MemberSpecification) error { } } +func validateMembershipProtectedQueryOutputConfiguration(v types.MembershipProtectedQueryOutputConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "MembershipProtectedQueryOutputConfiguration"} + switch uv := v.(type) { + case *types.MembershipProtectedQueryOutputConfigurationMemberS3: + if err := validateProtectedQueryS3OutputConfiguration(&uv.Value); err != nil { + invalidParams.AddNested("[s3]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateMembershipProtectedQueryResultConfiguration(v *types.MembershipProtectedQueryResultConfiguration) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "MembershipProtectedQueryResultConfiguration"} + if v.OutputConfiguration == nil { + invalidParams.Add(smithy.NewErrParamRequired("OutputConfiguration")) + } else if v.OutputConfiguration != nil { + if err := validateMembershipProtectedQueryOutputConfiguration(v.OutputConfiguration); err != nil { + invalidParams.AddNested("OutputConfiguration", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateMemberSpecification(v *types.MemberSpecification) error { if v == nil { return nil @@ -1589,6 +1627,11 @@ func validateOpCreateMembershipInput(v *CreateMembershipInput) error { if len(v.QueryLogStatus) == 0 { invalidParams.Add(smithy.NewErrParamRequired("QueryLogStatus")) } + if v.DefaultResultConfiguration != nil { + if err := validateMembershipProtectedQueryResultConfiguration(v.DefaultResultConfiguration); err != nil { + invalidParams.AddNested("DefaultResultConfiguration", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else { @@ -2006,9 +2049,7 @@ func validateOpStartProtectedQueryInput(v *StartProtectedQueryInput) error { if v.SqlParameters == nil { invalidParams.Add(smithy.NewErrParamRequired("SqlParameters")) } - if v.ResultConfiguration == nil { - invalidParams.Add(smithy.NewErrParamRequired("ResultConfiguration")) - } else if v.ResultConfiguration != nil { + if v.ResultConfiguration != nil { if err := validateProtectedQueryResultConfiguration(v.ResultConfiguration); err != nil { invalidParams.AddNested("ResultConfiguration", err.(smithy.InvalidParamsError)) } @@ -2155,6 +2196,11 @@ func validateOpUpdateMembershipInput(v *UpdateMembershipInput) error { if v.MembershipIdentifier == nil { invalidParams.Add(smithy.NewErrParamRequired("MembershipIdentifier")) } + if v.DefaultResultConfiguration != nil { + if err := validateMembershipProtectedQueryResultConfiguration(v.DefaultResultConfiguration); err != nil { + invalidParams.AddNested("DefaultResultConfiguration", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else { diff --git a/service/controltower/internal/endpoints/endpoints.go b/service/controltower/internal/endpoints/endpoints.go index 4d2bf4254bd..175061f7a01 100644 --- a/service/controltower/internal/endpoints/endpoints.go +++ b/service/controltower/internal/endpoints/endpoints.go @@ -202,6 +202,9 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "eu-west-3", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "il-central-1", + }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "me-south-1", }: endpoints.Endpoint{}, diff --git a/service/datasync/api_op_CreateTask.go b/service/datasync/api_op_CreateTask.go index 9fc9b70c71c..8b971cb20b7 100644 --- a/service/datasync/api_op_CreateTask.go +++ b/service/datasync/api_op_CreateTask.go @@ -16,9 +16,9 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Configures a task, which defines where and how DataSync transfers your data. A -// task includes a source location, a destination location, and the preferences for -// how and when you want to transfer your data (such as bandwidth limits, +// Configures a transfer task, which defines where and how DataSync moves your +// data. A task includes a source location, destination location, and the options +// for how and when you want to transfer your data (such as bandwidth limits, // scheduling, among other options). If you're planning to transfer data to or from // an Amazon S3 location, review how DataSync can affect your S3 request charges (https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#create-s3-location-s3-requests) // and the DataSync pricing page (http://aws.amazon.com/datasync/pricing/) before @@ -88,6 +88,10 @@ type CreateTaskInput struct { // and search for your DataSync resources. Tags []types.TagListEntry + // Specifies how you want to configure a task report, which provides detailed + // information about for your DataSync transfer. + TaskReportConfig *types.TaskReportConfig + noSmithyDocumentSerde } diff --git a/service/datasync/api_op_DeleteTask.go b/service/datasync/api_op_DeleteTask.go index 9571221bd3b..c1a8997150a 100644 --- a/service/datasync/api_op_DeleteTask.go +++ b/service/datasync/api_op_DeleteTask.go @@ -15,7 +15,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Deletes an DataSync task. +// Deletes an DataSync transfer task. func (c *Client) DeleteTask(ctx context.Context, params *DeleteTaskInput, optFns ...func(*Options)) (*DeleteTaskOutput, error) { if params == nil { params = &DeleteTaskInput{} diff --git a/service/datasync/api_op_DescribeTask.go b/service/datasync/api_op_DescribeTask.go index 83ab0f4837a..7594f548523 100644 --- a/service/datasync/api_op_DescribeTask.go +++ b/service/datasync/api_op_DescribeTask.go @@ -114,6 +114,11 @@ type DescribeTaskOutput struct { // The Amazon Resource Name (ARN) of the task that was described. TaskArn *string + // The configuration of your task report. For more information, see Creating a + // task report (https://docs.aws.amazon.com/https:/docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) + // . + TaskReportConfig *types.TaskReportConfig + // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata diff --git a/service/datasync/api_op_DescribeTaskExecution.go b/service/datasync/api_op_DescribeTaskExecution.go index 15a3c62d253..f16421c5659 100644 --- a/service/datasync/api_op_DescribeTaskExecution.go +++ b/service/datasync/api_op_DescribeTaskExecution.go @@ -17,7 +17,9 @@ import ( "time" ) -// Provides information about an DataSync transfer task that's running. +// Provides information about an execution of your DataSync task. You can use this +// operation to help monitor the progress of an ongoing transfer or check the +// results of the transfer. func (c *Client) DescribeTaskExecution(ctx context.Context, params *DescribeTaskExecutionInput, optFns ...func(*Options)) (*DescribeTaskExecutionOutput, error) { if params == nil { params = &DescribeTaskExecutionInput{} @@ -36,7 +38,8 @@ func (c *Client) DescribeTaskExecution(ctx context.Context, params *DescribeTask // DescribeTaskExecutionRequest type DescribeTaskExecutionInput struct { - // Specifies the Amazon Resource Name (ARN) of the transfer task that's running. + // Specifies the Amazon Resource Name (ARN) of the task execution that you want + // information about. // // This member is required. TaskExecutionArn *string @@ -56,19 +59,23 @@ type DescribeTaskExecutionOutput struct { // bytes sent over the network, see BytesCompressed . BytesTransferred int64 - // The number of logical bytes written to the destination Amazon Web Services - // storage resource. + // The number of logical bytes written to the destination location. BytesWritten int64 - // The estimated physical number of bytes that is to be transferred over the - // network. + // The estimated physical number of bytes that will transfer over the network. EstimatedBytesToTransfer int64 - // The expected number of files that is to be transferred over the network. This - // value is calculated during the PREPARING phase before the TRANSFERRING phase of - // the task execution. This value is the expected number of files to be - // transferred. It's calculated based on comparing the content of the source and - // destination locations and finding the delta that needs to be transferred. + // The expected number of files, objects, and directories that DataSync will + // delete in your destination location. If you don't configure your task (https://docs.aws.amazon.com/datasync/latest/userguide/configure-metadata.html) + // to delete data in the destination that isn't in the source, the value is always + // 0 . + EstimatedFilesToDelete int64 + + // The expected number of files, objects, and directories that DataSync will + // transfer over the network. This value is calculated during the task execution's + // PREPARING phase before the TRANSFERRING phase. The calculation is based on + // comparing the content of the source and destination locations and finding the + // difference that needs to be transferred. EstimatedFilesToTransfer int64 // A list of filter rules that exclude specific data during your transfer. For @@ -76,39 +83,57 @@ type DescribeTaskExecutionOutput struct { // . Excludes []types.FilterRule - // The actual number of files that was transferred over the network. This value is - // calculated and updated on an ongoing basis during the TRANSFERRING phase of the - // task execution. It's updated periodically when each file is read from the source - // and sent over the network. If failures occur during a transfer, this value can - // be less than EstimatedFilesToTransfer . In some cases, this value can also be - // greater than EstimatedFilesToTransfer . This element is implementation-specific - // for some location types, so don't use it as an indicator for a correct file - // number or to monitor your task execution. + // The number of files, objects, and directories that DataSync deleted in your + // destination location. If you don't configure your task (https://docs.aws.amazon.com/datasync/latest/userguide/configure-metadata.html) + // to delete data in the destination that isn't in the source, the value is always + // 0 . + FilesDeleted int64 + + // The number of files, objects, and directories that DataSync skipped during your + // transfer. + FilesSkipped int64 + + // The actual number of files, objects, and directories that DataSync transferred + // over the network. This value is updated periodically during the task execution's + // TRANSFERRING phase when something is read from the source and sent over the + // network. If DataSync fails to transfer something, this value can be less than + // EstimatedFilesToTransfer . In some cases, this value can also be greater than + // EstimatedFilesToTransfer . This element is implementation-specific for some + // location types, so don't use it as an exact indication of what transferred or to + // monitor your task execution. FilesTransferred int64 + // The number of files, objects, and directories that DataSync verified during + // your transfer. + FilesVerified int64 + // A list of filter rules that include specific data during your transfer. For // more information and examples, see Filtering data transferred by DataSync (https://docs.aws.amazon.com/datasync/latest/userguide/filtering.html) // . Includes []types.FilterRule - // Configures your DataSync task settings. These options include how DataSync - // handles files, objects, and their associated metadata. You also can specify how - // DataSync verifies data integrity, set bandwidth limits for your task, among - // other options. Each task setting has a default value. Unless you need to, you - // don't have to configure any of these Options before starting your task. + // Indicates how your transfer task is configured. These options include how + // DataSync handles files, objects, and their associated metadata during your + // transfer. You also can specify how to verify data integrity, set bandwidth + // limits for your task, among other options. Each option has a default value. + // Unless you need to, you don't have to configure any of these options before + // starting your task. Options *types.Options + // Indicates whether DataSync generated a complete task report (https://docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) + // for your transfer. + ReportResult *types.ReportResult + // The result of the task execution. Result *types.TaskExecutionResultDetail - // The time that the task execution was started. + // The time when the task execution started. StartTime *time.Time - // The status of the task execution. For detailed information about task execution - // statuses, see Understanding Task Statuses in the DataSync User Guide. + // The status of the task execution. Status types.TaskExecutionStatus - // The Amazon Resource Name (ARN) of the task execution that was described. + // The ARN of the task execution that you wanted information about. // TaskExecutionArn is hierarchical and includes TaskArn for the task that was // executed. For example, a TaskExecution value with the ARN // arn:aws:datasync:us-east-1:111222333444:task/task-0208075f79cedf4a2/execution/exec-08ef1e88ec491019b @@ -116,6 +141,10 @@ type DescribeTaskExecutionOutput struct { // arn:aws:datasync:us-east-1:111222333444:task/task-0208075f79cedf4a2 . TaskExecutionArn *string + // The configuration of your task report, which provides detailed information + // about for your DataSync transfer. + TaskReportConfig *types.TaskReportConfig + // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata diff --git a/service/datasync/api_op_StartTaskExecution.go b/service/datasync/api_op_StartTaskExecution.go index 9711338792a..2c984d7aa39 100644 --- a/service/datasync/api_op_StartTaskExecution.go +++ b/service/datasync/api_op_StartTaskExecution.go @@ -16,9 +16,9 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Starts an DataSync task. For each task, you can only run one task execution at -// a time. There are several phases to a task execution. For more information, see -// Task execution statuses (https://docs.aws.amazon.com/datasync/latest/userguide/working-with-task-executions.html#understand-task-execution-statuses) +// Starts an DataSync transfer task. For each task, you can only run one task +// execution at a time. There are several phases to a task execution. For more +// information, see Task execution statuses (https://docs.aws.amazon.com/datasync/latest/userguide/working-with-task-executions.html#understand-task-execution-statuses) // . If you're planning to transfer data to or from an Amazon S3 location, review // how DataSync can affect your S3 request charges (https://docs.aws.amazon.com/datasync/latest/userguide/create-s3-location.html#create-s3-location-s3-requests) // and the DataSync pricing page (http://aws.amazon.com/datasync/pricing/) before @@ -58,11 +58,12 @@ type StartTaskExecutionInput struct { // for example, "/folder1|/folder2" . Includes []types.FilterRule - // Configures your DataSync task settings. These options include how DataSync - // handles files, objects, and their associated metadata. You also can specify how - // DataSync verifies data integrity, set bandwidth limits for your task, among - // other options. Each task setting has a default value. Unless you need to, you - // don't have to configure any of these Options before starting your task. + // Indicates how your transfer task is configured. These options include how + // DataSync handles files, objects, and their associated metadata during your + // transfer. You also can specify how to verify data integrity, set bandwidth + // limits for your task, among other options. Each option has a default value. + // Unless you need to, you don't have to configure any of these options before + // starting your task. OverrideOptions *types.Options // Specifies the tags that you want to apply to the Amazon Resource Name (ARN) @@ -70,6 +71,10 @@ type StartTaskExecutionInput struct { // filter, and search for your DataSync resources. Tags []types.TagListEntry + // Specifies how you want to configure a task report, which provides detailed + // information about for your DataSync transfer. + TaskReportConfig *types.TaskReportConfig + noSmithyDocumentSerde } diff --git a/service/datasync/api_op_UpdateTask.go b/service/datasync/api_op_UpdateTask.go index d57ab4624d1..a8ce72f6b32 100644 --- a/service/datasync/api_op_UpdateTask.go +++ b/service/datasync/api_op_UpdateTask.go @@ -16,7 +16,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Updates the metadata associated with a task. +// Updates the configuration of a DataSync transfer task. func (c *Client) UpdateTask(ctx context.Context, params *UpdateTaskInput, optFns ...func(*Options)) (*UpdateTaskOutput, error) { if params == nil { params = &UpdateTaskInput{} @@ -57,11 +57,12 @@ type UpdateTaskInput struct { // The name of the task to update. Name *string - // Configures your DataSync task settings. These options include how DataSync - // handles files, objects, and their associated metadata. You also can specify how - // DataSync verifies data integrity, set bandwidth limits for your task, among - // other options. Each task setting has a default value. Unless you need to, you - // don't have to configure any of these Options before starting your task. + // Indicates how your transfer task is configured. These options include how + // DataSync handles files, objects, and their associated metadata during your + // transfer. You also can specify how to verify data integrity, set bandwidth + // limits for your task, among other options. Each option has a default value. + // Unless you need to, you don't have to configure any of these options before + // starting your task. Options *types.Options // Specifies a schedule used to periodically transfer files from a source to a @@ -72,6 +73,10 @@ type UpdateTaskInput struct { // . Schedule *types.TaskSchedule + // Specifies how you want to configure a task report, which provides detailed + // information about for your DataSync transfer. + TaskReportConfig *types.TaskReportConfig + noSmithyDocumentSerde } diff --git a/service/datasync/api_op_UpdateTaskExecution.go b/service/datasync/api_op_UpdateTaskExecution.go index cc540e51d08..5ecbb068741 100644 --- a/service/datasync/api_op_UpdateTaskExecution.go +++ b/service/datasync/api_op_UpdateTaskExecution.go @@ -16,9 +16,9 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Modifies a running DataSync task. Currently, the only Option that you can -// modify with UpdateTaskExecution is BytesPerSecond (https://docs.aws.amazon.com/datasync/latest/userguide/API_Options.html#DataSync-Type-Options-BytesPerSecond) -// , which throttles bandwidth for a running or queued task. +// Updates the configuration of a running DataSync task execution. Currently, the +// only Option that you can modify with UpdateTaskExecution is BytesPerSecond (https://docs.aws.amazon.com/datasync/latest/userguide/API_Options.html#DataSync-Type-Options-BytesPerSecond) +// , which throttles bandwidth for a running or queued task execution. func (c *Client) UpdateTaskExecution(ctx context.Context, params *UpdateTaskExecutionInput, optFns ...func(*Options)) (*UpdateTaskExecutionOutput, error) { if params == nil { params = &UpdateTaskExecutionInput{} @@ -36,11 +36,12 @@ func (c *Client) UpdateTaskExecution(ctx context.Context, params *UpdateTaskExec type UpdateTaskExecutionInput struct { - // Configures your DataSync task settings. These options include how DataSync - // handles files, objects, and their associated metadata. You also can specify how - // DataSync verifies data integrity, set bandwidth limits for your task, among - // other options. Each task setting has a default value. Unless you need to, you - // don't have to configure any of these Options before starting your task. + // Indicates how your transfer task is configured. These options include how + // DataSync handles files, objects, and their associated metadata during your + // transfer. You also can specify how to verify data integrity, set bandwidth + // limits for your task, among other options. Each option has a default value. + // Unless you need to, you don't have to configure any of these options before + // starting your task. // // This member is required. Options *types.Options diff --git a/service/datasync/deserializers.go b/service/datasync/deserializers.go index 9e73f700035..258bab2787c 100644 --- a/service/datasync/deserializers.go +++ b/service/datasync/deserializers.go @@ -9952,6 +9952,249 @@ func awsAwsjson11_deserializeDocumentRecommendationsConfigMap(v *map[string]stri return nil } +func awsAwsjson11_deserializeDocumentReportDestination(v **types.ReportDestination, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ReportDestination + if *v == nil { + sv = &types.ReportDestination{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "S3": + if err := awsAwsjson11_deserializeDocumentReportDestinationS3(&sv.S3, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentReportDestinationS3(v **types.ReportDestinationS3, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ReportDestinationS3 + if *v == nil { + sv = &types.ReportDestinationS3{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "BucketAccessRoleArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected IamRoleArn to be of type string, got %T instead", value) + } + sv.BucketAccessRoleArn = ptr.String(jtv) + } + + case "S3BucketArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected S3BucketArn to be of type string, got %T instead", value) + } + sv.S3BucketArn = ptr.String(jtv) + } + + case "Subdirectory": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected S3Subdirectory to be of type string, got %T instead", value) + } + sv.Subdirectory = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentReportOverride(v **types.ReportOverride, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ReportOverride + if *v == nil { + sv = &types.ReportOverride{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ReportLevel": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ReportLevel to be of type string, got %T instead", value) + } + sv.ReportLevel = types.ReportLevel(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentReportOverrides(v **types.ReportOverrides, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ReportOverrides + if *v == nil { + sv = &types.ReportOverrides{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Deleted": + if err := awsAwsjson11_deserializeDocumentReportOverride(&sv.Deleted, value); err != nil { + return err + } + + case "Skipped": + if err := awsAwsjson11_deserializeDocumentReportOverride(&sv.Skipped, value); err != nil { + return err + } + + case "Transferred": + if err := awsAwsjson11_deserializeDocumentReportOverride(&sv.Transferred, value); err != nil { + return err + } + + case "Verified": + if err := awsAwsjson11_deserializeDocumentReportOverride(&sv.Verified, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentReportResult(v **types.ReportResult, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ReportResult + if *v == nil { + sv = &types.ReportResult{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ErrorCode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected string to be of type string, got %T instead", value) + } + sv.ErrorCode = ptr.String(jtv) + } + + case "ErrorDetail": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected string to be of type string, got %T instead", value) + } + sv.ErrorDetail = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PhaseStatus to be of type string, got %T instead", value) + } + sv.Status = types.PhaseStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeDocumentResourceDetails(v **types.ResourceDetails, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -10624,6 +10867,74 @@ func awsAwsjson11_deserializeDocumentTaskListEntry(v **types.TaskListEntry, valu return nil } +func awsAwsjson11_deserializeDocumentTaskReportConfig(v **types.TaskReportConfig, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TaskReportConfig + if *v == nil { + sv = &types.TaskReportConfig{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Destination": + if err := awsAwsjson11_deserializeDocumentReportDestination(&sv.Destination, value); err != nil { + return err + } + + case "ObjectVersionIds": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ObjectVersionIds to be of type string, got %T instead", value) + } + sv.ObjectVersionIds = types.ObjectVersionIds(jtv) + } + + case "OutputType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ReportOutputType to be of type string, got %T instead", value) + } + sv.OutputType = types.ReportOutputType(jtv) + } + + case "Overrides": + if err := awsAwsjson11_deserializeDocumentReportOverrides(&sv.Overrides, value); err != nil { + return err + } + + case "ReportLevel": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ReportLevel to be of type string, got %T instead", value) + } + sv.ReportLevel = types.ReportLevel(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeDocumentTaskSchedule(v **types.TaskSchedule, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -13034,6 +13345,19 @@ func awsAwsjson11_deserializeOpDocumentDescribeTaskExecutionOutput(v **DescribeT sv.EstimatedBytesToTransfer = i64 } + case "EstimatedFilesToDelete": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.EstimatedFilesToDelete = i64 + } + case "EstimatedFilesToTransfer": if value != nil { jtv, ok := value.(json.Number) @@ -13052,6 +13376,32 @@ func awsAwsjson11_deserializeOpDocumentDescribeTaskExecutionOutput(v **DescribeT return err } + case "FilesDeleted": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.FilesDeleted = i64 + } + + case "FilesSkipped": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.FilesSkipped = i64 + } + case "FilesTransferred": if value != nil { jtv, ok := value.(json.Number) @@ -13065,6 +13415,19 @@ func awsAwsjson11_deserializeOpDocumentDescribeTaskExecutionOutput(v **DescribeT sv.FilesTransferred = i64 } + case "FilesVerified": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.FilesVerified = i64 + } + case "Includes": if err := awsAwsjson11_deserializeDocumentFilterList(&sv.Includes, value); err != nil { return err @@ -13075,6 +13438,11 @@ func awsAwsjson11_deserializeOpDocumentDescribeTaskExecutionOutput(v **DescribeT return err } + case "ReportResult": + if err := awsAwsjson11_deserializeDocumentReportResult(&sv.ReportResult, value); err != nil { + return err + } + case "Result": if err := awsAwsjson11_deserializeDocumentTaskExecutionResultDetail(&sv.Result, value); err != nil { return err @@ -13114,6 +13482,11 @@ func awsAwsjson11_deserializeOpDocumentDescribeTaskExecutionOutput(v **DescribeT sv.TaskExecutionArn = ptr.String(jtv) } + case "TaskReportConfig": + if err := awsAwsjson11_deserializeDocumentTaskReportConfig(&sv.TaskReportConfig, value); err != nil { + return err + } + default: _, _ = key, value @@ -13272,6 +13645,11 @@ func awsAwsjson11_deserializeOpDocumentDescribeTaskOutput(v **DescribeTaskOutput sv.TaskArn = ptr.String(jtv) } + case "TaskReportConfig": + if err := awsAwsjson11_deserializeDocumentTaskReportConfig(&sv.TaskReportConfig, value); err != nil { + return err + } + default: _, _ = key, value diff --git a/service/datasync/serializers.go b/service/datasync/serializers.go index cb840c3a15b..01163dca155 100644 --- a/service/datasync/serializers.go +++ b/service/datasync/serializers.go @@ -3756,6 +3756,89 @@ func awsAwsjson11_serializeDocumentQopConfiguration(v *types.QopConfiguration, v return nil } +func awsAwsjson11_serializeDocumentReportDestination(v *types.ReportDestination, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.S3 != nil { + ok := object.Key("S3") + if err := awsAwsjson11_serializeDocumentReportDestinationS3(v.S3, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentReportDestinationS3(v *types.ReportDestinationS3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BucketAccessRoleArn != nil { + ok := object.Key("BucketAccessRoleArn") + ok.String(*v.BucketAccessRoleArn) + } + + if v.S3BucketArn != nil { + ok := object.Key("S3BucketArn") + ok.String(*v.S3BucketArn) + } + + if v.Subdirectory != nil { + ok := object.Key("Subdirectory") + ok.String(*v.Subdirectory) + } + + return nil +} + +func awsAwsjson11_serializeDocumentReportOverride(v *types.ReportOverride, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.ReportLevel) > 0 { + ok := object.Key("ReportLevel") + ok.String(string(v.ReportLevel)) + } + + return nil +} + +func awsAwsjson11_serializeDocumentReportOverrides(v *types.ReportOverrides, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Deleted != nil { + ok := object.Key("Deleted") + if err := awsAwsjson11_serializeDocumentReportOverride(v.Deleted, ok); err != nil { + return err + } + } + + if v.Skipped != nil { + ok := object.Key("Skipped") + if err := awsAwsjson11_serializeDocumentReportOverride(v.Skipped, ok); err != nil { + return err + } + } + + if v.Transferred != nil { + ok := object.Key("Transferred") + if err := awsAwsjson11_serializeDocumentReportOverride(v.Transferred, ok); err != nil { + return err + } + } + + if v.Verified != nil { + ok := object.Key("Verified") + if err := awsAwsjson11_serializeDocumentReportOverride(v.Verified, ok); err != nil { + return err + } + } + + return nil +} + func awsAwsjson11_serializeDocumentResourceFilters(v map[string][]string, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -3872,6 +3955,42 @@ func awsAwsjson11_serializeDocumentTaskFilters(v []types.TaskFilter, value smith return nil } +func awsAwsjson11_serializeDocumentTaskReportConfig(v *types.TaskReportConfig, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Destination != nil { + ok := object.Key("Destination") + if err := awsAwsjson11_serializeDocumentReportDestination(v.Destination, ok); err != nil { + return err + } + } + + if len(v.ObjectVersionIds) > 0 { + ok := object.Key("ObjectVersionIds") + ok.String(string(v.ObjectVersionIds)) + } + + if len(v.OutputType) > 0 { + ok := object.Key("OutputType") + ok.String(string(v.OutputType)) + } + + if v.Overrides != nil { + ok := object.Key("Overrides") + if err := awsAwsjson11_serializeDocumentReportOverrides(v.Overrides, ok); err != nil { + return err + } + } + + if len(v.ReportLevel) > 0 { + ok := object.Key("ReportLevel") + ok.String(string(v.ReportLevel)) + } + + return nil +} + func awsAwsjson11_serializeDocumentTaskSchedule(v *types.TaskSchedule, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -4580,6 +4699,13 @@ func awsAwsjson11_serializeOpDocumentCreateTaskInput(v *CreateTaskInput, value s } } + if v.TaskReportConfig != nil { + ok := object.Key("TaskReportConfig") + if err := awsAwsjson11_serializeDocumentTaskReportConfig(v.TaskReportConfig, ok); err != nil { + return err + } + } + return nil } @@ -5144,6 +5270,13 @@ func awsAwsjson11_serializeOpDocumentStartTaskExecutionInput(v *StartTaskExecuti ok.String(*v.TaskArn) } + if v.TaskReportConfig != nil { + ok := object.Key("TaskReportConfig") + if err := awsAwsjson11_serializeDocumentTaskReportConfig(v.TaskReportConfig, ok); err != nil { + return err + } + } + return nil } @@ -5590,5 +5723,12 @@ func awsAwsjson11_serializeOpDocumentUpdateTaskInput(v *UpdateTaskInput, value s ok.String(*v.TaskArn) } + if v.TaskReportConfig != nil { + ok := object.Key("TaskReportConfig") + if err := awsAwsjson11_serializeDocumentTaskReportConfig(v.TaskReportConfig, ok); err != nil { + return err + } + } + return nil } diff --git a/service/datasync/types/enums.go b/service/datasync/types/enums.go index 0f3b39f4ac0..63aa94e5a4f 100644 --- a/service/datasync/types/enums.go +++ b/service/datasync/types/enums.go @@ -424,6 +424,24 @@ func (ObjectTags) Values() []ObjectTags { } } +type ObjectVersionIds string + +// Enum values for ObjectVersionIds +const ( + ObjectVersionIdsInclude ObjectVersionIds = "INCLUDE" + ObjectVersionIdsNone ObjectVersionIds = "NONE" +) + +// Values returns all known values for ObjectVersionIds. 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 (ObjectVersionIds) Values() []ObjectVersionIds { + return []ObjectVersionIds{ + "INCLUDE", + "NONE", + } +} + type Operator string // Enum values for Operator @@ -572,6 +590,42 @@ func (RecommendationStatus) Values() []RecommendationStatus { } } +type ReportLevel string + +// Enum values for ReportLevel +const ( + ReportLevelErrorsOnly ReportLevel = "ERRORS_ONLY" + ReportLevelSuccessesAndErrors ReportLevel = "SUCCESSES_AND_ERRORS" +) + +// Values returns all known values for ReportLevel. 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 (ReportLevel) Values() []ReportLevel { + return []ReportLevel{ + "ERRORS_ONLY", + "SUCCESSES_AND_ERRORS", + } +} + +type ReportOutputType string + +// Enum values for ReportOutputType +const ( + ReportOutputTypeSummaryOnly ReportOutputType = "SUMMARY_ONLY" + ReportOutputTypeStandard ReportOutputType = "STANDARD" +) + +// Values returns all known values for ReportOutputType. 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 (ReportOutputType) Values() []ReportOutputType { + return []ReportOutputType{ + "SUMMARY_ONLY", + "STANDARD", + } +} + type S3StorageClass string // Enum values for S3StorageClass diff --git a/service/datasync/types/types.go b/service/datasync/types/types.go index b15f6dfcab8..2865f29d86a 100644 --- a/service/datasync/types/types.go +++ b/service/datasync/types/types.go @@ -30,10 +30,9 @@ type AgentListEntry struct { // for accessing your Azure Blob Storage. type AzureBlobSasConfiguration struct { - // Specifies a SAS token that provides permissions at the Azure storage account, - // container, or folder level. The token is part of the SAS URI string that comes - // after the storage resource URI and a question mark. A token looks something like - // this: + // Specifies a SAS token that provides permissions to access your Azure Blob + // Storage. The token is part of the SAS URI string that comes after the storage + // resource URI and a question mark. A token looks something like this: // sp=r&st=2023-12-20T14:54:52Z&se=2023-12-20T22:54:52Z&spr=https&sv=2021-06-08&sr=c&sig=aBBKDWQvyuVcTPH9EBp%2FXTI9E%2F%2Fmq171%2BZU178wcwqU%3D // // This member is required. @@ -568,11 +567,12 @@ type OnPremConfig struct { noSmithyDocumentSerde } -// Configures your DataSync task settings. These options include how DataSync -// handles files, objects, and their associated metadata. You also can specify how -// DataSync verifies data integrity, set bandwidth limits for your task, among -// other options. Each task setting has a default value. Unless you need to, you -// don't have to configure any of these Options before starting your task. +// Indicates how your transfer task is configured. These options include how +// DataSync handles files, objects, and their associated metadata during your +// transfer. You also can specify how to verify data integrity, set bandwidth +// limits for your task, among other options. Each option has a default value. +// Unless you need to, you don't have to configure any of these options before +// starting your task. type Options struct { // Specifies whether to preserve metadata indicating the last time a file was read @@ -807,6 +807,101 @@ type Recommendation struct { noSmithyDocumentSerde } +// Specifies where DataSync uploads your task report (https://docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) +// . +type ReportDestination struct { + + // Specifies the Amazon S3 bucket where DataSync uploads your task report. + S3 *ReportDestinationS3 + + noSmithyDocumentSerde +} + +// Specifies the Amazon S3 bucket where DataSync uploads your task report (https://docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) +// . +type ReportDestinationS3 struct { + + // Specifies the Amazon Resource Name (ARN) of the IAM policy that allows DataSync + // to upload a task report to your S3 bucket. For more information, see Allowing + // DataSync to upload a task report to an Amazon S3 bucket (https://docs.aws.amazon.com/https:/docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) + // . + // + // This member is required. + BucketAccessRoleArn *string + + // Specifies the ARN of the S3 bucket where DataSync uploads your report. + // + // This member is required. + S3BucketArn *string + + // Specifies a bucket prefix for your report. + Subdirectory *string + + noSmithyDocumentSerde +} + +// Specifies the level of detail for a particular aspect of your DataSync task +// report (https://docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) +// . +type ReportOverride struct { + + // Specifies whether your task report includes errors only or successes and + // errors. For example, your report might mostly include only what didn't go well + // in your transfer ( ERRORS_ONLY ). At the same time, you want to verify that your + // task filter (https://docs.aws.amazon.com/datasync/latest/userguide/filtering.html) + // is working correctly. In this situation, you can get a list of what files + // DataSync successfully skipped and if something transferred that you didn't to + // transfer ( SUCCESSES_AND_ERRORS ). + ReportLevel ReportLevel + + noSmithyDocumentSerde +} + +// The level of detail included in each aspect of your DataSync task report (https://docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) +// . +type ReportOverrides struct { + + // Specifies the level of reporting for the files, objects, and directories that + // DataSync attempted to delete in your destination location. This only applies if + // you configure your task (https://docs.aws.amazon.com/datasync/latest/userguide/configure-metadata.html) + // to delete data in the destination that isn't in the source. + Deleted *ReportOverride + + // Specifies the level of reporting for the files, objects, and directories that + // DataSync attempted to skip during your transfer. + Skipped *ReportOverride + + // Specifies the level of reporting for the files, objects, and directories that + // DataSync attempted to transfer. + Transferred *ReportOverride + + // Specifies the level of reporting for the files, objects, and directories that + // DataSync attempted to verify at the end of your transfer. This only applies if + // you configure your task (https://docs.aws.amazon.com/datasync/latest/userguide/configure-data-verification-options.html) + // to verify data during and after the transfer (which DataSync does by default). + Verified *ReportOverride + + noSmithyDocumentSerde +} + +// Indicates whether DataSync created a complete task report (https://docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) +// for your transfer. +type ReportResult struct { + + // Indicates the code associated with the error if DataSync can't create a + // complete report. + ErrorCode *string + + // Provides details about issues creating a report. + ErrorDetail *string + + // Indicates whether DataSync is still working on your report, created a report, + // or can't create a complete report. + Status PhaseStatus + + noSmithyDocumentSerde +} + // Information provided by DataSync Discovery about the resources in your // on-premises storage system. type ResourceDetails struct { @@ -1015,6 +1110,49 @@ type TaskListEntry struct { noSmithyDocumentSerde } +// Specifies how you want to configure a task report, which provides detailed +// information about for your DataSync transfer. For more information, see Task +// reports (https://docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html) +// . +type TaskReportConfig struct { + + // Specifies the Amazon S3 bucket where DataSync uploads your task report. For + // more information, see Task reports (https://docs.aws.amazon.com/datasync/latest/userguide/creating-task-reports.html#task-report-access) + // . + Destination *ReportDestination + + // Specifies whether your task report includes the new version of each object + // transferred into an S3 bucket. This only applies if you enable versioning on + // your bucket (https://docs.aws.amazon.com/AmazonS3/latest/userguide/manage-versioning-examples.html) + // . Keep in mind that setting this to INCLUDE can increase the duration of your + // task execution. + ObjectVersionIds ObjectVersionIds + + // Specifies the type of task report that you want: + // - SUMMARY_ONLY : Provides necessary details about your task, including the + // number of files, objects, and directories transferred and transfer duration. + // - STANDARD : Provides complete details about your task, including a full list + // of files, objects, and directories that were transferred, skipped, verified, and + // more. + OutputType ReportOutputType + + // Customizes the reporting level for aspects of your task report. For example, + // your report might generally only include errors, but you could specify that you + // want a list of successes and errors just for the files that DataSync attempted + // to delete in your destination location. + Overrides *ReportOverrides + + // Specifies whether you want your task report to include only what went wrong + // with your transfer or a list of what succeeded and didn't. + // - ERRORS_ONLY : A report shows what DataSync was unable to transfer, skip, + // verify, and delete. + // - SUCCESSES_AND_ERRORS : A report shows what DataSync was able and unable to + // transfer, skip, verify, and delete. + ReportLevel ReportLevel + + noSmithyDocumentSerde +} + // Specifies the schedule you want your task to use for repeated executions. For // more information, see Schedule Expressions for Rules (https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html) // . diff --git a/service/datasync/validators.go b/service/datasync/validators.go index 28884dd55a4..ca96e58d518 100644 --- a/service/datasync/validators.go +++ b/service/datasync/validators.go @@ -1560,6 +1560,41 @@ func validateOnPremConfig(v *types.OnPremConfig) error { } } +func validateReportDestination(v *types.ReportDestination) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ReportDestination"} + if v.S3 != nil { + if err := validateReportDestinationS3(v.S3); err != nil { + invalidParams.AddNested("S3", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateReportDestinationS3(v *types.ReportDestinationS3) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ReportDestinationS3"} + if v.S3BucketArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("S3BucketArn")) + } + if v.BucketAccessRoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("BucketAccessRoleArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateS3Config(v *types.S3Config) error { if v == nil { return nil @@ -1628,6 +1663,23 @@ func validateTaskFilters(v []types.TaskFilter) error { } } +func validateTaskReportConfig(v *types.TaskReportConfig) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TaskReportConfig"} + if v.Destination != nil { + if err := validateReportDestination(v.Destination); err != nil { + invalidParams.AddNested("Destination", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateTaskSchedule(v *types.TaskSchedule) error { if v == nil { return nil @@ -2054,6 +2106,11 @@ func validateOpCreateTaskInput(v *CreateTaskInput) error { invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) } } + if v.TaskReportConfig != nil { + if err := validateTaskReportConfig(v.TaskReportConfig); err != nil { + invalidParams.AddNested("TaskReportConfig", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else { @@ -2509,6 +2566,11 @@ func validateOpStartTaskExecutionInput(v *StartTaskExecutionInput) error { invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) } } + if v.TaskReportConfig != nil { + if err := validateTaskReportConfig(v.TaskReportConfig); err != nil { + invalidParams.AddNested("TaskReportConfig", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else { @@ -2750,6 +2812,11 @@ func validateOpUpdateTaskInput(v *UpdateTaskInput) error { invalidParams.AddNested("Schedule", err.(smithy.InvalidParamsError)) } } + if v.TaskReportConfig != nil { + if err := validateTaskReportConfig(v.TaskReportConfig); err != nil { + invalidParams.AddNested("TaskReportConfig", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else { diff --git a/service/macie2/internal/endpoints/endpoints.go b/service/macie2/internal/endpoints/endpoints.go index 57f8d7bcfeb..a3f045bc1e3 100644 --- a/service/macie2/internal/endpoints/endpoints.go +++ b/service/macie2/internal/endpoints/endpoints.go @@ -220,6 +220,9 @@ var defaultPartitions = endpoints.Partitions{ }, Deprecated: aws.TrueTernary, }, + endpoints.EndpointKey{ + Region: "il-central-1", + }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "me-south-1", }: endpoints.Endpoint{}, diff --git a/service/neptunedata/LICENSE.txt b/service/neptunedata/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/neptunedata/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/neptunedata/api_client.go b/service/neptunedata/api_client.go new file mode 100644 index 00000000000..aa73d8b569b --- /dev/null +++ b/service/neptunedata/api_client.go @@ -0,0 +1,525 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "fmt" + "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 = "neptunedata" +const ServiceAPIVersion = "2023-08-01" + +// Client provides the API client to make operations call for Amazon NeptuneData. +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) + + 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 + + // The optional application specific identifier appended to the User-Agent header. + AppID string + + // This endpoint will be given as input to an EndpointResolverV2. It is used for + // providing a custom base endpoint that is subject to modifications by the + // processing EndpointResolverV2. + BaseEndpoint *string + + // 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. + // + // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a + // value for this field will likely prevent you from using any endpoint-related + // service features released after the introduction of EndpointResolverV2 and + // BaseEndpoint. To migrate an EndpointResolver implementation that uses a custom + // endpoint, set the client option BaseEndpoint instead. + EndpointResolver EndpointResolver + + // Resolves the endpoint used for a particular service. This should be used over + // the deprecated EndpointResolver + EndpointResolverV2 EndpointResolverV2 + + // 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...) + } +} + +// Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for +// this field will likely prevent you from using any endpoint-related service +// features released after the introduction of EndpointResolverV2 and BaseEndpoint. +// To migrate an EndpointResolver implementation that uses a custom endpoint, set +// the client option BaseEndpoint instead. +func WithEndpointResolver(v EndpointResolver) func(*Options) { + return func(o *Options) { + o.EndpointResolver = v + } +} + +// WithEndpointResolverV2 returns a functional option for setting the Client's +// EndpointResolverV2 option. +func WithEndpointResolverV2(v EndpointResolverV2) func(*Options) { + return func(o *Options) { + o.EndpointResolverV2 = 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() + resolveEndpointResolverV2(&options) + + 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 + +type legacyEndpointContextSetter struct { + LegacyResolver EndpointResolver +} + +func (*legacyEndpointContextSetter) ID() string { + return "legacyEndpointContextSetter" +} + +func (m *legacyEndpointContextSetter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.LegacyResolver != nil { + ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, true) + } + + return next.HandleInitialize(ctx, in) + +} +func addlegacyEndpointContextSetter(stack *middleware.Stack, o Options) error { + return stack.Initialize.Add(&legacyEndpointContextSetter{ + LegacyResolver: o.EndpointResolver, + }, middleware.Before) +} + +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, + AppID: cfg.AppID, + } + 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) +} + +func addClientUserAgent(stack *middleware.Stack, options Options) error { + if err := awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "neptunedata", goModuleVersion)(stack); err != nil { + return err + } + + if len(options.AppID) > 0 { + return awsmiddleware.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)(stack) + } + + return nil +} + +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) +} + +type endpointDisableHTTPSMiddleware struct { + EndpointDisableHTTPS bool +} + +func (*endpointDisableHTTPSMiddleware) ID() string { + return "endpointDisableHTTPSMiddleware" +} + +func (m *endpointDisableHTTPSMiddleware) 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.EndpointDisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) { + req.URL.Scheme = "http" + } + + return next.HandleSerialize(ctx, in) + +} +func addendpointDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error { + return stack.Serialize.Insert(&endpointDisableHTTPSMiddleware{ + EndpointDisableHTTPS: o.EndpointOptions.DisableHTTPS, + }, "OperationSerializer", middleware.Before) +} diff --git a/service/neptunedata/api_client_test.go b/service/neptunedata/api_client_test.go new file mode 100644 index 00000000000..88b5c0b9369 --- /dev/null +++ b/service/neptunedata/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +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/neptunedata/api_op_CancelGremlinQuery.go b/service/neptunedata/api_op_CancelGremlinQuery.go new file mode 100644 index 00000000000..8cd2d4a5f92 --- /dev/null +++ b/service/neptunedata/api_op_CancelGremlinQuery.go @@ -0,0 +1,261 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Cancels a Gremlin query. See Gremlin query cancellation (https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-api-status-cancel.html) +// for more information. +func (c *Client) CancelGremlinQuery(ctx context.Context, params *CancelGremlinQueryInput, optFns ...func(*Options)) (*CancelGremlinQueryOutput, error) { + if params == nil { + params = &CancelGremlinQueryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CancelGremlinQuery", params, optFns, c.addOperationCancelGremlinQueryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CancelGremlinQueryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CancelGremlinQueryInput struct { + + // The unique identifier that identifies the query to be canceled. + // + // This member is required. + QueryId *string + + noSmithyDocumentSerde +} + +type CancelGremlinQueryOutput struct { + + // The status of the cancelation + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCancelGremlinQueryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCancelGremlinQuery{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCancelGremlinQuery{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCancelGremlinQueryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpCancelGremlinQueryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelGremlinQuery(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCancelGremlinQuery(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "CancelGremlinQuery", + } +} + +type opCancelGremlinQueryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCancelGremlinQueryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCancelGremlinQueryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCancelGremlinQueryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCancelGremlinQueryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_CancelLoaderJob.go b/service/neptunedata/api_op_CancelLoaderJob.go new file mode 100644 index 00000000000..b00e0a5e7f6 --- /dev/null +++ b/service/neptunedata/api_op_CancelLoaderJob.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Cancels a specified load job. This is an HTTP DELETE request. See Neptune +// Loader Get-Status API (https://docs.aws.amazon.com/neptune/latest/userguide/load-api-reference-status.htm) +// for more information. +func (c *Client) CancelLoaderJob(ctx context.Context, params *CancelLoaderJobInput, optFns ...func(*Options)) (*CancelLoaderJobOutput, error) { + if params == nil { + params = &CancelLoaderJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CancelLoaderJob", params, optFns, c.addOperationCancelLoaderJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CancelLoaderJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CancelLoaderJobInput struct { + + // The ID of the load job to be deleted. + // + // This member is required. + LoadId *string + + noSmithyDocumentSerde +} + +type CancelLoaderJobOutput struct { + + // The cancellation status. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCancelLoaderJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCancelLoaderJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCancelLoaderJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCancelLoaderJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpCancelLoaderJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelLoaderJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCancelLoaderJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "CancelLoaderJob", + } +} + +type opCancelLoaderJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCancelLoaderJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCancelLoaderJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCancelLoaderJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCancelLoaderJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_CancelMLDataProcessingJob.go b/service/neptunedata/api_op_CancelMLDataProcessingJob.go new file mode 100644 index 00000000000..c717eb4b425 --- /dev/null +++ b/service/neptunedata/api_op_CancelMLDataProcessingJob.go @@ -0,0 +1,270 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Cancels a Neptune ML data processing job. See The dataprocessing command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-dataprocessing.html) +// . +func (c *Client) CancelMLDataProcessingJob(ctx context.Context, params *CancelMLDataProcessingJobInput, optFns ...func(*Options)) (*CancelMLDataProcessingJobOutput, error) { + if params == nil { + params = &CancelMLDataProcessingJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CancelMLDataProcessingJob", params, optFns, c.addOperationCancelMLDataProcessingJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CancelMLDataProcessingJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CancelMLDataProcessingJobInput struct { + + // The unique identifier of the data-processing job. + // + // This member is required. + Id *string + + // If set to TRUE , this flag specifies that all Neptune ML S3 artifacts should be + // deleted when the job is stopped. The default is FALSE . + Clean *bool + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type CancelMLDataProcessingJobOutput struct { + + // The status of the cancellation request. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCancelMLDataProcessingJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCancelMLDataProcessingJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCancelMLDataProcessingJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCancelMLDataProcessingJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpCancelMLDataProcessingJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelMLDataProcessingJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCancelMLDataProcessingJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "CancelMLDataProcessingJob", + } +} + +type opCancelMLDataProcessingJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCancelMLDataProcessingJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCancelMLDataProcessingJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCancelMLDataProcessingJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCancelMLDataProcessingJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_CancelMLModelTrainingJob.go b/service/neptunedata/api_op_CancelMLModelTrainingJob.go new file mode 100644 index 00000000000..4c65de7a872 --- /dev/null +++ b/service/neptunedata/api_op_CancelMLModelTrainingJob.go @@ -0,0 +1,271 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Cancels a Neptune ML model training job. See Model training using the +// modeltraining command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-modeltraining.html) +// . +func (c *Client) CancelMLModelTrainingJob(ctx context.Context, params *CancelMLModelTrainingJobInput, optFns ...func(*Options)) (*CancelMLModelTrainingJobOutput, error) { + if params == nil { + params = &CancelMLModelTrainingJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CancelMLModelTrainingJob", params, optFns, c.addOperationCancelMLModelTrainingJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CancelMLModelTrainingJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CancelMLModelTrainingJobInput struct { + + // The unique identifier of the model-training job to be canceled. + // + // This member is required. + Id *string + + // If set to TRUE , this flag specifies that all Amazon S3 artifacts should be + // deleted when the job is stopped. The default is FALSE . + Clean *bool + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type CancelMLModelTrainingJobOutput struct { + + // The status of the cancellation. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCancelMLModelTrainingJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCancelMLModelTrainingJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCancelMLModelTrainingJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCancelMLModelTrainingJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpCancelMLModelTrainingJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelMLModelTrainingJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCancelMLModelTrainingJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "CancelMLModelTrainingJob", + } +} + +type opCancelMLModelTrainingJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCancelMLModelTrainingJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCancelMLModelTrainingJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCancelMLModelTrainingJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCancelMLModelTrainingJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_CancelMLModelTransformJob.go b/service/neptunedata/api_op_CancelMLModelTransformJob.go new file mode 100644 index 00000000000..1dae76948ed --- /dev/null +++ b/service/neptunedata/api_op_CancelMLModelTransformJob.go @@ -0,0 +1,271 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Cancels a specified model transform job. See Use a trained model to generate +// new model artifacts (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-model-transform.html) +// . +func (c *Client) CancelMLModelTransformJob(ctx context.Context, params *CancelMLModelTransformJobInput, optFns ...func(*Options)) (*CancelMLModelTransformJobOutput, error) { + if params == nil { + params = &CancelMLModelTransformJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CancelMLModelTransformJob", params, optFns, c.addOperationCancelMLModelTransformJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CancelMLModelTransformJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CancelMLModelTransformJobInput struct { + + // The unique ID of the model transform job to be canceled. + // + // This member is required. + Id *string + + // If this flag is set to TRUE , all Neptune ML S3 artifacts should be deleted when + // the job is stopped. The default is FALSE . + Clean *bool + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type CancelMLModelTransformJobOutput struct { + + // the status of the cancelation. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCancelMLModelTransformJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCancelMLModelTransformJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCancelMLModelTransformJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCancelMLModelTransformJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpCancelMLModelTransformJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelMLModelTransformJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCancelMLModelTransformJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "CancelMLModelTransformJob", + } +} + +type opCancelMLModelTransformJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCancelMLModelTransformJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCancelMLModelTransformJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCancelMLModelTransformJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCancelMLModelTransformJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_CancelOpenCypherQuery.go b/service/neptunedata/api_op_CancelOpenCypherQuery.go new file mode 100644 index 00000000000..05fe2c6ad28 --- /dev/null +++ b/service/neptunedata/api_op_CancelOpenCypherQuery.go @@ -0,0 +1,268 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Cancels a specified openCypher query. See Neptune openCypher status endpoint (https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-opencypher-status.html) +// for more information. +func (c *Client) CancelOpenCypherQuery(ctx context.Context, params *CancelOpenCypherQueryInput, optFns ...func(*Options)) (*CancelOpenCypherQueryOutput, error) { + if params == nil { + params = &CancelOpenCypherQueryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CancelOpenCypherQuery", params, optFns, c.addOperationCancelOpenCypherQueryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CancelOpenCypherQueryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CancelOpenCypherQueryInput struct { + + // The unique ID of the openCypher query to cancel. + // + // This member is required. + QueryId *string + + // If set to TRUE , causes the cancelation of the openCypher query to happen + // silently. + Silent *bool + + noSmithyDocumentSerde +} + +type CancelOpenCypherQueryOutput struct { + + // The cancelation payload for the openCypher query. + Payload *bool + + // The cancellation status of the openCypher query. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCancelOpenCypherQueryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCancelOpenCypherQuery{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCancelOpenCypherQuery{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCancelOpenCypherQueryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpCancelOpenCypherQueryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCancelOpenCypherQuery(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCancelOpenCypherQuery(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "CancelOpenCypherQuery", + } +} + +type opCancelOpenCypherQueryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCancelOpenCypherQueryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCancelOpenCypherQueryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCancelOpenCypherQueryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCancelOpenCypherQueryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_CreateMLEndpoint.go b/service/neptunedata/api_op_CreateMLEndpoint.go new file mode 100644 index 00000000000..695bc17415f --- /dev/null +++ b/service/neptunedata/api_op_CreateMLEndpoint.go @@ -0,0 +1,305 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a new Neptune ML inference endpoint that lets you query one specific +// model that the model-training process constructed. See Managing inference +// endpoints using the endpoints command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-endpoints.html) +// . +func (c *Client) CreateMLEndpoint(ctx context.Context, params *CreateMLEndpointInput, optFns ...func(*Options)) (*CreateMLEndpointOutput, error) { + if params == nil { + params = &CreateMLEndpointInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateMLEndpoint", params, optFns, c.addOperationCreateMLEndpointMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateMLEndpointOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateMLEndpointInput struct { + + // A unique identifier for the new inference endpoint. The default is an + // autogenerated timestamped name. + Id *string + + // The minimum number of Amazon EC2 instances to deploy to an endpoint for + // prediction. The default is 1 + InstanceCount *int32 + + // The type of Neptune ML instance to use for online servicing. The default is + // ml.m5.xlarge . Choosing the ML instance for an inference endpoint depends on the + // task type, the graph size, and your budget. + InstanceType *string + + // The job Id of the completed model-training job that has created the model that + // the inference endpoint will point to. You must supply either the + // mlModelTrainingJobId or the mlModelTransformJobId . + MlModelTrainingJobId *string + + // The job Id of the completed model-transform job. You must supply either the + // mlModelTrainingJobId or the mlModelTransformJobId . + MlModelTransformJobId *string + + // Model type for training. By default the Neptune ML model is automatically based + // on the modelType used in data processing, but you can specify a different model + // type here. The default is rgcn for heterogeneous graphs and kge for knowledge + // graphs. The only valid value for heterogeneous graphs is rgcn . Valid values for + // knowledge graphs are: kge , transe , distmult , and rotate . + ModelName *string + + // The ARN of an IAM role providing Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will be thrown. + NeptuneIamRoleArn *string + + // If set to true , update indicates that this is an update request. The default + // is false . You must supply either the mlModelTrainingJobId or the + // mlModelTransformJobId . + Update *bool + + // The Amazon Key Management Service (Amazon KMS) key that SageMaker uses to + // encrypt data on the storage volume attached to the ML compute instances that run + // the training job. The default is None. + VolumeEncryptionKMSKey *string + + noSmithyDocumentSerde +} + +type CreateMLEndpointOutput struct { + + // The ARN for the new inference endpoint. + Arn *string + + // The endpoint creation time, in milliseconds. + CreationTimeInMillis *int64 + + // The unique ID of the new inference endpoint. + Id *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateMLEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateMLEndpoint{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateMLEndpoint{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCreateMLEndpointResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateMLEndpoint(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opCreateMLEndpoint(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "CreateMLEndpoint", + } +} + +type opCreateMLEndpointResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCreateMLEndpointResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCreateMLEndpointResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCreateMLEndpointResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCreateMLEndpointResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_DeleteMLEndpoint.go b/service/neptunedata/api_op_DeleteMLEndpoint.go new file mode 100644 index 00000000000..e15a7f875fe --- /dev/null +++ b/service/neptunedata/api_op_DeleteMLEndpoint.go @@ -0,0 +1,271 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Cancels the creation of a Neptune ML inference endpoint. See Managing inference +// endpoints using the endpoints command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-endpoints.html) +// . +func (c *Client) DeleteMLEndpoint(ctx context.Context, params *DeleteMLEndpointInput, optFns ...func(*Options)) (*DeleteMLEndpointOutput, error) { + if params == nil { + params = &DeleteMLEndpointInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteMLEndpoint", params, optFns, c.addOperationDeleteMLEndpointMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteMLEndpointOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteMLEndpointInput struct { + + // The unique identifier of the inference endpoint. + // + // This member is required. + Id *string + + // If this flag is set to TRUE , all Neptune ML S3 artifacts should be deleted when + // the job is stopped. The default is FALSE . + Clean *bool + + // The ARN of an IAM role providing Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will be thrown. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type DeleteMLEndpointOutput struct { + + // The status of the cancellation. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteMLEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteMLEndpoint{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteMLEndpoint{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addDeleteMLEndpointResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpDeleteMLEndpointValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteMLEndpoint(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteMLEndpoint(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "DeleteMLEndpoint", + } +} + +type opDeleteMLEndpointResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opDeleteMLEndpointResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opDeleteMLEndpointResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addDeleteMLEndpointResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opDeleteMLEndpointResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_DeletePropertygraphStatistics.go b/service/neptunedata/api_op_DeletePropertygraphStatistics.go new file mode 100644 index 00000000000..cefcf5ed3d1 --- /dev/null +++ b/service/neptunedata/api_op_DeletePropertygraphStatistics.go @@ -0,0 +1,259 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes statistics for Gremlin and openCypher (property graph) data. +func (c *Client) DeletePropertygraphStatistics(ctx context.Context, params *DeletePropertygraphStatisticsInput, optFns ...func(*Options)) (*DeletePropertygraphStatisticsOutput, error) { + if params == nil { + params = &DeletePropertygraphStatisticsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeletePropertygraphStatistics", params, optFns, c.addOperationDeletePropertygraphStatisticsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeletePropertygraphStatisticsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeletePropertygraphStatisticsInput struct { + noSmithyDocumentSerde +} + +type DeletePropertygraphStatisticsOutput struct { + + // The deletion payload. + Payload *types.DeleteStatisticsValueMap + + // The cancel status. + Status *string + + // The HTTP response code: 200 if the delete was successful, or 204 if there were + // no statistics to delete. + StatusCode *int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeletePropertygraphStatisticsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeletePropertygraphStatistics{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeletePropertygraphStatistics{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addDeletePropertygraphStatisticsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeletePropertygraphStatistics(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeletePropertygraphStatistics(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "DeletePropertygraphStatistics", + } +} + +type opDeletePropertygraphStatisticsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opDeletePropertygraphStatisticsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opDeletePropertygraphStatisticsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addDeletePropertygraphStatisticsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opDeletePropertygraphStatisticsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_DeleteSparqlStatistics.go b/service/neptunedata/api_op_DeleteSparqlStatistics.go new file mode 100644 index 00000000000..ad3e5215a83 --- /dev/null +++ b/service/neptunedata/api_op_DeleteSparqlStatistics.go @@ -0,0 +1,259 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes SPARQL statistics +func (c *Client) DeleteSparqlStatistics(ctx context.Context, params *DeleteSparqlStatisticsInput, optFns ...func(*Options)) (*DeleteSparqlStatisticsOutput, error) { + if params == nil { + params = &DeleteSparqlStatisticsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteSparqlStatistics", params, optFns, c.addOperationDeleteSparqlStatisticsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteSparqlStatisticsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteSparqlStatisticsInput struct { + noSmithyDocumentSerde +} + +type DeleteSparqlStatisticsOutput struct { + + // The deletion payload. + Payload *types.DeleteStatisticsValueMap + + // The cancel status. + Status *string + + // The HTTP response code: 200 if the delete was successful, or 204 if there were + // no statistics to delete. + StatusCode *int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteSparqlStatisticsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteSparqlStatistics{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteSparqlStatistics{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addDeleteSparqlStatisticsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteSparqlStatistics(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteSparqlStatistics(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "DeleteSparqlStatistics", + } +} + +type opDeleteSparqlStatisticsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opDeleteSparqlStatisticsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opDeleteSparqlStatisticsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addDeleteSparqlStatisticsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opDeleteSparqlStatisticsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ExecuteFastReset.go b/service/neptunedata/api_op_ExecuteFastReset.go new file mode 100644 index 00000000000..d75e311944b --- /dev/null +++ b/service/neptunedata/api_op_ExecuteFastReset.go @@ -0,0 +1,282 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// The fast reset REST API lets you reset a Neptune graph quicky and easily, +// removing all of its data. Neptune fast reset is a two-step process. First you +// call ExecuteFastReset with action set to initiateDatabaseReset . This returns a +// UUID token which you then include when calling ExecuteFastReset again with +// action set to performDatabaseReset . See Empty an Amazon Neptune DB cluster +// using the fast reset API (https://docs.aws.amazon.com/neptune/latest/userguide/manage-console-fast-reset.html) +// . +func (c *Client) ExecuteFastReset(ctx context.Context, params *ExecuteFastResetInput, optFns ...func(*Options)) (*ExecuteFastResetOutput, error) { + if params == nil { + params = &ExecuteFastResetInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ExecuteFastReset", params, optFns, c.addOperationExecuteFastResetMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ExecuteFastResetOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ExecuteFastResetInput struct { + + // The fast reset action. One of the following values: + // - initiateDatabaseReset – This action generates a unique token needed to + // actually perform the fast reset. + // - performDatabaseReset – This action uses the token generated by the + // initiateDatabaseReset action to actually perform the fast reset. + // + // This member is required. + Action types.Action + + // The fast-reset token to initiate the reset. + Token *string + + noSmithyDocumentSerde +} + +type ExecuteFastResetOutput struct { + + // The status is only returned for the performDatabaseReset action, and indicates + // whether or not the fast reset rquest is accepted. + // + // This member is required. + Status *string + + // The payload is only returned by the initiateDatabaseReset action, and contains + // the unique token to use with the performDatabaseReset action to make the reset + // occur. + Payload *types.FastResetToken + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationExecuteFastResetMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpExecuteFastReset{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExecuteFastReset{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addExecuteFastResetResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpExecuteFastResetValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExecuteFastReset(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opExecuteFastReset(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ExecuteFastReset", + } +} + +type opExecuteFastResetResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opExecuteFastResetResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opExecuteFastResetResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addExecuteFastResetResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opExecuteFastResetResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ExecuteGremlinExplainQuery.go b/service/neptunedata/api_op_ExecuteGremlinExplainQuery.go new file mode 100644 index 00000000000..c9de0f38c96 --- /dev/null +++ b/service/neptunedata/api_op_ExecuteGremlinExplainQuery.go @@ -0,0 +1,272 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Executes a Gremlin Explain query. Amazon Neptune has added a Gremlin feature +// named explain that provides is a self-service tool for understanding the +// execution approach being taken by the Neptune engine for the query. You invoke +// it by adding an explain parameter to an HTTP call that submits a Gremlin query. +// The explain feature provides information about the logical structure of query +// execution plans. You can use this information to identify potential evaluation +// and execution bottlenecks and to tune your query, as explained in Tuning +// Gremlin queries (https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-traversal-tuning.html) +// . You can also use query hints to improve query execution plans. +func (c *Client) ExecuteGremlinExplainQuery(ctx context.Context, params *ExecuteGremlinExplainQueryInput, optFns ...func(*Options)) (*ExecuteGremlinExplainQueryOutput, error) { + if params == nil { + params = &ExecuteGremlinExplainQueryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ExecuteGremlinExplainQuery", params, optFns, c.addOperationExecuteGremlinExplainQueryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ExecuteGremlinExplainQueryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ExecuteGremlinExplainQueryInput struct { + + // The Gremlin explain query string. + // + // This member is required. + GremlinQuery *string + + noSmithyDocumentSerde +} + +type ExecuteGremlinExplainQueryOutput struct { + + // A text blob containing the Gremlin explain result, as described in Tuning + // Gremlin queries (https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-traversal-tuning.html) + // . + // + // This value conforms to the media type: text/plain + Output []byte + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationExecuteGremlinExplainQueryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpExecuteGremlinExplainQuery{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExecuteGremlinExplainQuery{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addExecuteGremlinExplainQueryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpExecuteGremlinExplainQueryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExecuteGremlinExplainQuery(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opExecuteGremlinExplainQuery(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ExecuteGremlinExplainQuery", + } +} + +type opExecuteGremlinExplainQueryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opExecuteGremlinExplainQueryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opExecuteGremlinExplainQueryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addExecuteGremlinExplainQueryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opExecuteGremlinExplainQueryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ExecuteGremlinProfileQuery.go b/service/neptunedata/api_op_ExecuteGremlinProfileQuery.go new file mode 100644 index 00000000000..7c856db0240 --- /dev/null +++ b/service/neptunedata/api_op_ExecuteGremlinProfileQuery.go @@ -0,0 +1,284 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Executes a Gremlin Profile query, which runs a specified traversal, collects +// various metrics about the run, and produces a profile report as output. See +// Gremlin profile API in Neptune (https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-profile-api.html) +// for details. +func (c *Client) ExecuteGremlinProfileQuery(ctx context.Context, params *ExecuteGremlinProfileQueryInput, optFns ...func(*Options)) (*ExecuteGremlinProfileQueryOutput, error) { + if params == nil { + params = &ExecuteGremlinProfileQueryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ExecuteGremlinProfileQuery", params, optFns, c.addOperationExecuteGremlinProfileQueryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ExecuteGremlinProfileQueryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ExecuteGremlinProfileQueryInput struct { + + // The Gremlin query string to profile. + // + // This member is required. + GremlinQuery *string + + // If non-zero, causes the results string to be truncated at that number of + // characters. If set to zero, the string contains all the results. + Chop *int32 + + // If this flag is set to TRUE , the results include a detailed report of all index + // operations that took place during query execution and serialization. + IndexOps *bool + + // If this flag is set to TRUE , the query results are gathered and displayed as + // part of the profile report. If FALSE , only the result count is displayed. + Results *bool + + // If non-null, the gathered results are returned in a serialized response message + // in the format specified by this parameter. See Gremlin profile API in Neptune (https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-profile-api.html) + // for more information. + Serializer *string + + noSmithyDocumentSerde +} + +type ExecuteGremlinProfileQueryOutput struct { + + // A text blob containing the Gremlin Profile result. See Gremlin profile API in + // Neptune (https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-profile-api.html) + // for details. + // + // This value conforms to the media type: text/plain + Output []byte + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationExecuteGremlinProfileQueryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpExecuteGremlinProfileQuery{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExecuteGremlinProfileQuery{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addExecuteGremlinProfileQueryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpExecuteGremlinProfileQueryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExecuteGremlinProfileQuery(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opExecuteGremlinProfileQuery(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ExecuteGremlinProfileQuery", + } +} + +type opExecuteGremlinProfileQueryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opExecuteGremlinProfileQueryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opExecuteGremlinProfileQueryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addExecuteGremlinProfileQueryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opExecuteGremlinProfileQueryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ExecuteGremlinQuery.go b/service/neptunedata/api_op_ExecuteGremlinQuery.go new file mode 100644 index 00000000000..908e9cfeba7 --- /dev/null +++ b/service/neptunedata/api_op_ExecuteGremlinQuery.go @@ -0,0 +1,285 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/document" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// This commands executes a Gremlin query. Amazon Neptune is compatible with +// Apache TinkerPop3 and Gremlin, so you can use the Gremlin traversal language to +// query the graph, as described under The Graph (https://tinkerpop.apache.org/docs/current/reference/#graph) +// in the Apache TinkerPop3 documentation. More details can also be found in +// Accessing a Neptune graph with Gremlin (https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin.html) +// . +func (c *Client) ExecuteGremlinQuery(ctx context.Context, params *ExecuteGremlinQueryInput, optFns ...func(*Options)) (*ExecuteGremlinQueryOutput, error) { + if params == nil { + params = &ExecuteGremlinQueryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ExecuteGremlinQuery", params, optFns, c.addOperationExecuteGremlinQueryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ExecuteGremlinQueryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ExecuteGremlinQueryInput struct { + + // Using this API, you can run Gremlin queries in string format much as you can + // using the HTTP endpoint. The interface is compatible with whatever Gremlin + // version your DB cluster is using (see the Tinkerpop client section (https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-client.html#best-practices-gremlin-java-latest) + // to determine which Gremlin releases your engine version supports). + // + // This member is required. + GremlinQuery *string + + // If non-null, the query results are returned in a serialized response message in + // the format specified by this parameter. See the GraphSON (https://tinkerpop.apache.org/docs/current/reference/#_graphson) + // section in the TinkerPop documentation for a list of the formats that are + // currently supported. + Serializer *string + + noSmithyDocumentSerde +} + +type ExecuteGremlinQueryOutput struct { + + // Metadata about the Gremlin query. + Meta document.Interface + + // The unique identifier of the Gremlin query. + RequestId *string + + // The Gremlin query output from the server. + Result document.Interface + + // The status of the Gremlin query. + Status *types.GremlinQueryStatusAttributes + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationExecuteGremlinQueryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpExecuteGremlinQuery{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExecuteGremlinQuery{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addExecuteGremlinQueryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpExecuteGremlinQueryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExecuteGremlinQuery(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opExecuteGremlinQuery(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ExecuteGremlinQuery", + } +} + +type opExecuteGremlinQueryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opExecuteGremlinQueryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opExecuteGremlinQueryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addExecuteGremlinQueryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opExecuteGremlinQueryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ExecuteOpenCypherExplainQuery.go b/service/neptunedata/api_op_ExecuteOpenCypherExplainQuery.go new file mode 100644 index 00000000000..e3aada8146d --- /dev/null +++ b/service/neptunedata/api_op_ExecuteOpenCypherExplainQuery.go @@ -0,0 +1,272 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Executes an openCypher explain request. See The openCypher explain feature (https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-opencypher-explain.html) +// for more information. +func (c *Client) ExecuteOpenCypherExplainQuery(ctx context.Context, params *ExecuteOpenCypherExplainQueryInput, optFns ...func(*Options)) (*ExecuteOpenCypherExplainQueryOutput, error) { + if params == nil { + params = &ExecuteOpenCypherExplainQueryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ExecuteOpenCypherExplainQuery", params, optFns, c.addOperationExecuteOpenCypherExplainQueryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ExecuteOpenCypherExplainQueryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ExecuteOpenCypherExplainQueryInput struct { + + // The openCypher explain mode. Can be one of: static , dynamic , or details . + // + // This member is required. + ExplainMode types.OpenCypherExplainMode + + // The openCypher query string. + // + // This member is required. + OpenCypherQuery *string + + // The openCypher query parameters. + Parameters *string + + noSmithyDocumentSerde +} + +type ExecuteOpenCypherExplainQueryOutput struct { + + // A text blob containing the openCypher explain results. + // + // This member is required. + Results []byte + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationExecuteOpenCypherExplainQueryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpExecuteOpenCypherExplainQuery{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExecuteOpenCypherExplainQuery{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addExecuteOpenCypherExplainQueryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpExecuteOpenCypherExplainQueryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExecuteOpenCypherExplainQuery(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opExecuteOpenCypherExplainQuery(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ExecuteOpenCypherExplainQuery", + } +} + +type opExecuteOpenCypherExplainQueryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opExecuteOpenCypherExplainQueryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opExecuteOpenCypherExplainQueryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addExecuteOpenCypherExplainQueryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opExecuteOpenCypherExplainQueryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ExecuteOpenCypherQuery.go b/service/neptunedata/api_op_ExecuteOpenCypherQuery.go new file mode 100644 index 00000000000..babeea05072 --- /dev/null +++ b/service/neptunedata/api_op_ExecuteOpenCypherQuery.go @@ -0,0 +1,276 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/document" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Executes an openCypher query. See Accessing the Neptune Graph with openCypher (https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-opencypher.html) +// for more information. Neptune supports building graph applications using +// openCypher, which is currently one of the most popular query languages among +// developers working with graph databases. Developers, business analysts, and data +// scientists like openCypher's declarative, SQL-inspired syntax because it +// provides a familiar structure in which to querying property graphs. The +// openCypher language was originally developed by Neo4j, then open-sourced in 2015 +// and contributed to the openCypher project (https://opencypher.org/) under an +// Apache 2 open-source license. +func (c *Client) ExecuteOpenCypherQuery(ctx context.Context, params *ExecuteOpenCypherQueryInput, optFns ...func(*Options)) (*ExecuteOpenCypherQueryOutput, error) { + if params == nil { + params = &ExecuteOpenCypherQueryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ExecuteOpenCypherQuery", params, optFns, c.addOperationExecuteOpenCypherQueryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ExecuteOpenCypherQueryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ExecuteOpenCypherQueryInput struct { + + // The openCypher query string to be executed. + // + // This member is required. + OpenCypherQuery *string + + // The openCypher query parameters for query execution. See Examples of openCypher + // parameterized queries (https://docs.aws.amazon.com/neptune/latest/userguide/opencypher-parameterized-queries.html) + // for more information. + Parameters *string + + noSmithyDocumentSerde +} + +type ExecuteOpenCypherQueryOutput struct { + + // The openCypherquery results. + // + // This member is required. + Results document.Interface + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationExecuteOpenCypherQueryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpExecuteOpenCypherQuery{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpExecuteOpenCypherQuery{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addExecuteOpenCypherQueryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpExecuteOpenCypherQueryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opExecuteOpenCypherQuery(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opExecuteOpenCypherQuery(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ExecuteOpenCypherQuery", + } +} + +type opExecuteOpenCypherQueryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opExecuteOpenCypherQueryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opExecuteOpenCypherQueryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addExecuteOpenCypherQueryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opExecuteOpenCypherQueryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetEngineStatus.go b/service/neptunedata/api_op_GetEngineStatus.go new file mode 100644 index 00000000000..c0405d7996b --- /dev/null +++ b/service/neptunedata/api_op_GetEngineStatus.go @@ -0,0 +1,306 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/document" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Check the status of the graph database on the host. +func (c *Client) GetEngineStatus(ctx context.Context, params *GetEngineStatusInput, optFns ...func(*Options)) (*GetEngineStatusOutput, error) { + if params == nil { + params = &GetEngineStatusInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetEngineStatus", params, optFns, c.addOperationGetEngineStatusMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetEngineStatusOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetEngineStatusInput struct { + noSmithyDocumentSerde +} + +type GetEngineStatusOutput struct { + + // Set to the Neptune engine version running on your DB cluster. If this engine + // version has been manually patched since it was released, the version number is + // prefixed by Patch- . + DbEngineVersion *string + + // Set to enabled if the DFE engine is fully enabled, or to viaQueryHint (the + // default) if the DFE engine is only used with queries that have the useDFE query + // hint set to true . + DfeQueryEngine *string + + // Contains status information about the features enabled on your DB cluster. + Features map[string]document.Interface + + // Contains information about the Gremlin query language available on your + // cluster. Specifically, it contains a version field that specifies the current + // TinkerPop version being used by the engine. + Gremlin *types.QueryLanguageVersion + + // Contains Lab Mode settings being used by the engine. + LabMode map[string]string + + // Contains information about the openCypher query language available on your + // cluster. Specifically, it contains a version field that specifies the current + // operCypher version being used by the engine. + Opencypher *types.QueryLanguageVersion + + // Set to reader if the instance is a read-replica, or to writer if the instance + // is the primary instance. + Role *string + + // If there are transactions being rolled back, this field is set to the number of + // such transactions. If there are none, the field doesn't appear at all. + RollingBackTrxCount *int32 + + // Set to the start time of the earliest transaction being rolled back. If no + // transactions are being rolled back, the field doesn't appear at all. + RollingBackTrxEarliestStartTime *string + + // Contains information about the current settings on your DB cluster. For + // example, contains the current cluster query timeout setting ( + // clusterQueryTimeoutInMs ). + Settings map[string]string + + // Contains information about the SPARQL query language available on your cluster. + // Specifically, it contains a version field that specifies the current SPARQL + // version being used by the engine. + Sparql *types.QueryLanguageVersion + + // Set to the UTC time at which the current server process started. + StartTime *string + + // Set to healthy if the instance is not experiencing problems. If the instance is + // recovering from a crash or from being rebooted and there are active transactions + // running from the latest server shutdown, status is set to recovery . + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetEngineStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetEngineStatus{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetEngineStatus{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetEngineStatusResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetEngineStatus(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetEngineStatus(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetEngineStatus", + } +} + +type opGetEngineStatusResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetEngineStatusResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetEngineStatusResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetEngineStatusResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetEngineStatusResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetGremlinQueryStatus.go b/service/neptunedata/api_op_GetGremlinQueryStatus.go new file mode 100644 index 00000000000..bd8e045839e --- /dev/null +++ b/service/neptunedata/api_op_GetGremlinQueryStatus.go @@ -0,0 +1,267 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets the status of a specified Gremlin query. +func (c *Client) GetGremlinQueryStatus(ctx context.Context, params *GetGremlinQueryStatusInput, optFns ...func(*Options)) (*GetGremlinQueryStatusOutput, error) { + if params == nil { + params = &GetGremlinQueryStatusInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetGremlinQueryStatus", params, optFns, c.addOperationGetGremlinQueryStatusMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetGremlinQueryStatusOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetGremlinQueryStatusInput struct { + + // The unique identifier that identifies the Gremlin query. + // + // This member is required. + QueryId *string + + noSmithyDocumentSerde +} + +type GetGremlinQueryStatusOutput struct { + + // The evaluation status of the Gremlin query. + QueryEvalStats *types.QueryEvalStats + + // The ID of the query for which status is being returned. + QueryId *string + + // The Gremlin query string. + QueryString *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetGremlinQueryStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetGremlinQueryStatus{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetGremlinQueryStatus{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetGremlinQueryStatusResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetGremlinQueryStatusValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetGremlinQueryStatus(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetGremlinQueryStatus(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetGremlinQueryStatus", + } +} + +type opGetGremlinQueryStatusResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetGremlinQueryStatusResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetGremlinQueryStatusResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetGremlinQueryStatusResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetGremlinQueryStatusResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetLoaderJobStatus.go b/service/neptunedata/api_op_GetLoaderJobStatus.go new file mode 100644 index 00000000000..fcaa14caa1e --- /dev/null +++ b/service/neptunedata/api_op_GetLoaderJobStatus.go @@ -0,0 +1,288 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/document" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets status information about a specified load job. Neptune keeps track of the +// most recent 1,024 bulk load jobs, and stores the last 10,000 error details per +// job. See Neptune Loader Get-Status API (https://docs.aws.amazon.com/neptune/latest/userguide/load-api-reference-status.htm) +// for more information. +func (c *Client) GetLoaderJobStatus(ctx context.Context, params *GetLoaderJobStatusInput, optFns ...func(*Options)) (*GetLoaderJobStatusOutput, error) { + if params == nil { + params = &GetLoaderJobStatusInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetLoaderJobStatus", params, optFns, c.addOperationGetLoaderJobStatusMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetLoaderJobStatusOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetLoaderJobStatusInput struct { + + // The load ID of the load job to get the status of. + // + // This member is required. + LoadId *string + + // Flag indicating whether or not to include details beyond the overall status ( + // TRUE or FALSE ; the default is FALSE ). + Details *bool + + // Flag indicating whether or not to include a list of errors encountered ( TRUE + // or FALSE ; the default is FALSE ). The list of errors is paged. The page and + // errorsPerPage parameters allow you to page through all the errors. + Errors *bool + + // The number of errors returned in each page (a positive integer; the default is + // 10 ). Only valid when the errors parameter set to TRUE . + ErrorsPerPage *int32 + + // The error page number (a positive integer; the default is 1 ). Only valid when + // the errors parameter is set to TRUE . + Page *int32 + + noSmithyDocumentSerde +} + +type GetLoaderJobStatusOutput struct { + + // Status information about the load job, in a layout that could look like this: + // + // This member is required. + Payload document.Interface + + // The HTTP response code for the request. + // + // This member is required. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetLoaderJobStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetLoaderJobStatus{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetLoaderJobStatus{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetLoaderJobStatusResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetLoaderJobStatusValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLoaderJobStatus(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetLoaderJobStatus(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetLoaderJobStatus", + } +} + +type opGetLoaderJobStatusResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetLoaderJobStatusResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetLoaderJobStatusResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetLoaderJobStatusResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetLoaderJobStatusResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetMLDataProcessingJob.go b/service/neptunedata/api_op_GetMLDataProcessingJob.go new file mode 100644 index 00000000000..9ac8c6d4dcc --- /dev/null +++ b/service/neptunedata/api_op_GetMLDataProcessingJob.go @@ -0,0 +1,274 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves information about a specified data processing job. See The +// dataprocessing command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-dataprocessing.html) +// . +func (c *Client) GetMLDataProcessingJob(ctx context.Context, params *GetMLDataProcessingJobInput, optFns ...func(*Options)) (*GetMLDataProcessingJobOutput, error) { + if params == nil { + params = &GetMLDataProcessingJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetMLDataProcessingJob", params, optFns, c.addOperationGetMLDataProcessingJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetMLDataProcessingJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetMLDataProcessingJobInput struct { + + // The unique identifier of the data-processing job to be retrieved. + // + // This member is required. + Id *string + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type GetMLDataProcessingJobOutput struct { + + // The unique identifier of this data-processing job. + Id *string + + // Definition of the data processing job. + ProcessingJob *types.MlResourceDefinition + + // Status of the data processing job. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetMLDataProcessingJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetMLDataProcessingJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetMLDataProcessingJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetMLDataProcessingJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetMLDataProcessingJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetMLDataProcessingJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetMLDataProcessingJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetMLDataProcessingJob", + } +} + +type opGetMLDataProcessingJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetMLDataProcessingJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetMLDataProcessingJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetMLDataProcessingJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetMLDataProcessingJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetMLEndpoint.go b/service/neptunedata/api_op_GetMLEndpoint.go new file mode 100644 index 00000000000..3b3e3945327 --- /dev/null +++ b/service/neptunedata/api_op_GetMLEndpoint.go @@ -0,0 +1,277 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves details about an inference endpoint. See Managing inference endpoints +// using the endpoints command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-endpoints.html) +// . +func (c *Client) GetMLEndpoint(ctx context.Context, params *GetMLEndpointInput, optFns ...func(*Options)) (*GetMLEndpointOutput, error) { + if params == nil { + params = &GetMLEndpointInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetMLEndpoint", params, optFns, c.addOperationGetMLEndpointMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetMLEndpointOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetMLEndpointInput struct { + + // The unique identifier of the inference endpoint. + // + // This member is required. + Id *string + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type GetMLEndpointOutput struct { + + // The endpoint definition. + Endpoint *types.MlResourceDefinition + + // The endpoint configuration + EndpointConfig *types.MlConfigDefinition + + // The unique identifier of the inference endpoint. + Id *string + + // The status of the inference endpoint. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetMLEndpointMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetMLEndpoint{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetMLEndpoint{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetMLEndpointResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetMLEndpointValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetMLEndpoint(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetMLEndpoint(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetMLEndpoint", + } +} + +type opGetMLEndpointResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetMLEndpointResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetMLEndpointResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetMLEndpointResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetMLEndpointResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetMLModelTrainingJob.go b/service/neptunedata/api_op_GetMLModelTrainingJob.go new file mode 100644 index 00000000000..d97e57398b1 --- /dev/null +++ b/service/neptunedata/api_op_GetMLModelTrainingJob.go @@ -0,0 +1,283 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves information about a Neptune ML model training job. See Model training +// using the modeltraining command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-modeltraining.html) +// . +func (c *Client) GetMLModelTrainingJob(ctx context.Context, params *GetMLModelTrainingJobInput, optFns ...func(*Options)) (*GetMLModelTrainingJobOutput, error) { + if params == nil { + params = &GetMLModelTrainingJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetMLModelTrainingJob", params, optFns, c.addOperationGetMLModelTrainingJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetMLModelTrainingJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetMLModelTrainingJobInput struct { + + // The unique identifier of the model-training job to retrieve. + // + // This member is required. + Id *string + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type GetMLModelTrainingJobOutput struct { + + // The HPO job. + HpoJob *types.MlResourceDefinition + + // The unique identifier of this model-training job. + Id *string + + // A list of the configurations of the ML models being used. + MlModels []types.MlConfigDefinition + + // The model transform job. + ModelTransformJob *types.MlResourceDefinition + + // The data processing job. + ProcessingJob *types.MlResourceDefinition + + // The status of the model training job. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetMLModelTrainingJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetMLModelTrainingJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetMLModelTrainingJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetMLModelTrainingJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetMLModelTrainingJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetMLModelTrainingJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetMLModelTrainingJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetMLModelTrainingJob", + } +} + +type opGetMLModelTrainingJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetMLModelTrainingJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetMLModelTrainingJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetMLModelTrainingJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetMLModelTrainingJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetMLModelTransformJob.go b/service/neptunedata/api_op_GetMLModelTransformJob.go new file mode 100644 index 00000000000..a2d426ab62e --- /dev/null +++ b/service/neptunedata/api_op_GetMLModelTransformJob.go @@ -0,0 +1,280 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets information about a specified model transform job. See Use a trained model +// to generate new model artifacts (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-model-transform.html) +// . +func (c *Client) GetMLModelTransformJob(ctx context.Context, params *GetMLModelTransformJobInput, optFns ...func(*Options)) (*GetMLModelTransformJobOutput, error) { + if params == nil { + params = &GetMLModelTransformJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetMLModelTransformJob", params, optFns, c.addOperationGetMLModelTransformJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetMLModelTransformJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetMLModelTransformJobInput struct { + + // The unique identifier of the model-transform job to be reetrieved. + // + // This member is required. + Id *string + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type GetMLModelTransformJobOutput struct { + + // The base data processing job. + BaseProcessingJob *types.MlResourceDefinition + + // The unique identifier of the model-transform job to be retrieved. + Id *string + + // A list of the configuration information for the models being used. + Models []types.MlConfigDefinition + + // The remote model transform job. + RemoteModelTransformJob *types.MlResourceDefinition + + // The status of the model-transform job. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetMLModelTransformJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetMLModelTransformJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetMLModelTransformJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetMLModelTransformJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetMLModelTransformJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetMLModelTransformJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetMLModelTransformJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetMLModelTransformJob", + } +} + +type opGetMLModelTransformJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetMLModelTransformJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetMLModelTransformJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetMLModelTransformJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetMLModelTransformJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetOpenCypherQueryStatus.go b/service/neptunedata/api_op_GetOpenCypherQueryStatus.go new file mode 100644 index 00000000000..59b3192885f --- /dev/null +++ b/service/neptunedata/api_op_GetOpenCypherQueryStatus.go @@ -0,0 +1,267 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves the status of a specified openCypher query. +func (c *Client) GetOpenCypherQueryStatus(ctx context.Context, params *GetOpenCypherQueryStatusInput, optFns ...func(*Options)) (*GetOpenCypherQueryStatusOutput, error) { + if params == nil { + params = &GetOpenCypherQueryStatusInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetOpenCypherQueryStatus", params, optFns, c.addOperationGetOpenCypherQueryStatusMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetOpenCypherQueryStatusOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetOpenCypherQueryStatusInput struct { + + // The unique ID of the openCypher query for which to retrieve the query status. + // + // This member is required. + QueryId *string + + noSmithyDocumentSerde +} + +type GetOpenCypherQueryStatusOutput struct { + + // The openCypher query evaluation status. + QueryEvalStats *types.QueryEvalStats + + // The unique ID of the query for which status is being returned. + QueryId *string + + // The openCypher query string. + QueryString *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetOpenCypherQueryStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetOpenCypherQueryStatus{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetOpenCypherQueryStatus{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetOpenCypherQueryStatusResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetOpenCypherQueryStatusValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetOpenCypherQueryStatus(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetOpenCypherQueryStatus(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetOpenCypherQueryStatus", + } +} + +type opGetOpenCypherQueryStatusResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetOpenCypherQueryStatusResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetOpenCypherQueryStatusResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetOpenCypherQueryStatusResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetOpenCypherQueryStatusResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetPropertygraphStatistics.go b/service/neptunedata/api_op_GetPropertygraphStatistics.go new file mode 100644 index 00000000000..f0259b98341 --- /dev/null +++ b/service/neptunedata/api_op_GetPropertygraphStatistics.go @@ -0,0 +1,260 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets property graph statistics (Gremlin and openCypher). +func (c *Client) GetPropertygraphStatistics(ctx context.Context, params *GetPropertygraphStatisticsInput, optFns ...func(*Options)) (*GetPropertygraphStatisticsOutput, error) { + if params == nil { + params = &GetPropertygraphStatisticsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetPropertygraphStatistics", params, optFns, c.addOperationGetPropertygraphStatisticsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetPropertygraphStatisticsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetPropertygraphStatisticsInput struct { + noSmithyDocumentSerde +} + +type GetPropertygraphStatisticsOutput struct { + + // Statistics for property-graph data. + // + // This member is required. + Payload *types.Statistics + + // The HTTP return code of the request. If the request succeeded, the code is 200. + // See Common error codes for DFE statistics request for a list of common errors. + // + // This member is required. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetPropertygraphStatisticsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetPropertygraphStatistics{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetPropertygraphStatistics{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetPropertygraphStatisticsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPropertygraphStatistics(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetPropertygraphStatistics(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetPropertygraphStatistics", + } +} + +type opGetPropertygraphStatisticsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetPropertygraphStatisticsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetPropertygraphStatisticsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetPropertygraphStatisticsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetPropertygraphStatisticsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetPropertygraphStream.go b/service/neptunedata/api_op_GetPropertygraphStream.go new file mode 100644 index 00000000000..42de1acef4d --- /dev/null +++ b/service/neptunedata/api_op_GetPropertygraphStream.go @@ -0,0 +1,319 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a stream for a property graph. With the Neptune Streams feature, you can +// generate a complete sequence of change-log entries that record every change made +// to your graph data as it happens. GetPropertygraphStream lets you collect these +// change-log entries for a property graph. The Neptune streams feature needs to be +// enabled on your Neptune DBcluster. To enable streams, set the neptune_streams (https://docs.aws.amazon.com/neptune/latest/userguide/parameters.html#parameters-db-cluster-parameters-neptune_streams) +// DB cluster parameter to 1 . See Capturing graph changes in real time using +// Neptune streams (https://docs.aws.amazon.com/neptune/latest/userguide/streams.html) +// . +func (c *Client) GetPropertygraphStream(ctx context.Context, params *GetPropertygraphStreamInput, optFns ...func(*Options)) (*GetPropertygraphStreamOutput, error) { + if params == nil { + params = &GetPropertygraphStreamInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetPropertygraphStream", params, optFns, c.addOperationGetPropertygraphStreamMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetPropertygraphStreamOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetPropertygraphStreamInput struct { + + // The commit number of the starting record to read from the change-log stream. + // This parameter is required when iteratorType is AT_SEQUENCE_NUMBER or + // AFTER_SEQUENCE_NUMBER , and ignored when iteratorType is TRIM_HORIZON or LATEST . + CommitNum *int64 + + // If set to TRUE, Neptune compresses the response using gzip encoding. + Encoding types.Encoding + + // Can be one of: + // - AT_SEQUENCE_NUMBER – Indicates that reading should start from the event + // sequence number specified jointly by the commitNum and opNum parameters. + // - AFTER_SEQUENCE_NUMBER – Indicates that reading should start right after the + // event sequence number specified jointly by the commitNum and opNum parameters. + // - TRIM_HORIZON – Indicates that reading should start at the last untrimmed + // record in the system, which is the oldest unexpired (not yet deleted) record in + // the change-log stream. + // - LATEST – Indicates that reading should start at the most recent record in + // the system, which is the latest unexpired (not yet deleted) record in the + // change-log stream. + IteratorType types.IteratorType + + // Specifies the maximum number of records to return. There is also a size limit + // of 10 MB on the response that can't be modified and that takes precedence over + // the number of records specified in the limit parameter. The response does + // include a threshold-breaching record if the 10 MB limit was reached. The range + // for limit is 1 to 100,000, with a default of 10. + Limit *int64 + + // The operation sequence number within the specified commit to start reading from + // in the change-log stream data. The default is 1 . + OpNum *int64 + + noSmithyDocumentSerde +} + +type GetPropertygraphStreamOutput struct { + + // Serialization format for the change records being returned. Currently, the only + // supported value is PG_JSON . + // + // This member is required. + Format *string + + // Sequence identifier of the last change in the stream response. An event ID is + // composed of two fields: a commitNum , which identifies a transaction that + // changed the graph, and an opNum , which identifies a specific operation within + // that transaction: + // + // This member is required. + LastEventId map[string]string + + // The time at which the commit for the transaction was requested, in milliseconds + // from the Unix epoch. + // + // This member is required. + LastTrxTimestampInMillis *int64 + + // An array of serialized change-log stream records included in the response. + // + // This member is required. + Records []types.PropertygraphRecord + + // The total number of records in the response. + // + // This member is required. + TotalRecords *int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetPropertygraphStreamMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetPropertygraphStream{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetPropertygraphStream{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetPropertygraphStreamResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPropertygraphStream(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetPropertygraphStream(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetPropertygraphStream", + } +} + +type opGetPropertygraphStreamResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetPropertygraphStreamResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetPropertygraphStreamResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetPropertygraphStreamResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetPropertygraphStreamResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetPropertygraphSummary.go b/service/neptunedata/api_op_GetPropertygraphSummary.go new file mode 100644 index 00000000000..b62d08cd5ba --- /dev/null +++ b/service/neptunedata/api_op_GetPropertygraphSummary.go @@ -0,0 +1,259 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a graph summary for a property graph. +func (c *Client) GetPropertygraphSummary(ctx context.Context, params *GetPropertygraphSummaryInput, optFns ...func(*Options)) (*GetPropertygraphSummaryOutput, error) { + if params == nil { + params = &GetPropertygraphSummaryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetPropertygraphSummary", params, optFns, c.addOperationGetPropertygraphSummaryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetPropertygraphSummaryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetPropertygraphSummaryInput struct { + + // Mode can take one of two values: BASIC (the default), and DETAILED . + Mode types.GraphSummaryType + + noSmithyDocumentSerde +} + +type GetPropertygraphSummaryOutput struct { + + // Payload containing the property graph summary response. + Payload *types.PropertygraphSummaryValueMap + + // The HTTP return code of the request. If the request succeeded, the code is 200. + StatusCode *int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetPropertygraphSummaryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetPropertygraphSummary{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetPropertygraphSummary{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetPropertygraphSummaryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetPropertygraphSummary(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetPropertygraphSummary(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetPropertygraphSummary", + } +} + +type opGetPropertygraphSummaryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetPropertygraphSummaryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetPropertygraphSummaryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetPropertygraphSummaryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetPropertygraphSummaryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetRDFGraphSummary.go b/service/neptunedata/api_op_GetRDFGraphSummary.go new file mode 100644 index 00000000000..0967b4fb772 --- /dev/null +++ b/service/neptunedata/api_op_GetRDFGraphSummary.go @@ -0,0 +1,259 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a graph summary for an RDF graph. +func (c *Client) GetRDFGraphSummary(ctx context.Context, params *GetRDFGraphSummaryInput, optFns ...func(*Options)) (*GetRDFGraphSummaryOutput, error) { + if params == nil { + params = &GetRDFGraphSummaryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetRDFGraphSummary", params, optFns, c.addOperationGetRDFGraphSummaryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetRDFGraphSummaryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetRDFGraphSummaryInput struct { + + // Mode can take one of two values: BASIC (the default), and DETAILED . + Mode types.GraphSummaryType + + noSmithyDocumentSerde +} + +type GetRDFGraphSummaryOutput struct { + + // Payload for an RDF graph summary response + Payload *types.RDFGraphSummaryValueMap + + // The HTTP return code of the request. If the request succeeded, the code is 200. + StatusCode *int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetRDFGraphSummaryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRDFGraphSummary{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRDFGraphSummary{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetRDFGraphSummaryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRDFGraphSummary(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetRDFGraphSummary(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetRDFGraphSummary", + } +} + +type opGetRDFGraphSummaryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetRDFGraphSummaryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetRDFGraphSummaryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetRDFGraphSummaryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetRDFGraphSummaryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetSparqlStatistics.go b/service/neptunedata/api_op_GetSparqlStatistics.go new file mode 100644 index 00000000000..b3f0cad4379 --- /dev/null +++ b/service/neptunedata/api_op_GetSparqlStatistics.go @@ -0,0 +1,260 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets RDF statistics (SPARQL). +func (c *Client) GetSparqlStatistics(ctx context.Context, params *GetSparqlStatisticsInput, optFns ...func(*Options)) (*GetSparqlStatisticsOutput, error) { + if params == nil { + params = &GetSparqlStatisticsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetSparqlStatistics", params, optFns, c.addOperationGetSparqlStatisticsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetSparqlStatisticsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetSparqlStatisticsInput struct { + noSmithyDocumentSerde +} + +type GetSparqlStatisticsOutput struct { + + // Statistics for RDF data. + // + // This member is required. + Payload *types.Statistics + + // The HTTP return code of the request. If the request succeeded, the code is 200. + // See Common error codes for DFE statistics request for a list of common errors. + // + // This member is required. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetSparqlStatisticsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetSparqlStatistics{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetSparqlStatistics{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetSparqlStatisticsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSparqlStatistics(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetSparqlStatistics(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetSparqlStatistics", + } +} + +type opGetSparqlStatisticsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetSparqlStatisticsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetSparqlStatisticsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetSparqlStatisticsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetSparqlStatisticsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_GetSparqlStream.go b/service/neptunedata/api_op_GetSparqlStream.go new file mode 100644 index 00000000000..e1079649d6e --- /dev/null +++ b/service/neptunedata/api_op_GetSparqlStream.go @@ -0,0 +1,319 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Gets a stream for an RDF graph. With the Neptune Streams feature, you can +// generate a complete sequence of change-log entries that record every change made +// to your graph data as it happens. GetSparqlStream lets you collect these +// change-log entries for an RDF graph. The Neptune streams feature needs to be +// enabled on your Neptune DBcluster. To enable streams, set the neptune_streams (https://docs.aws.amazon.com/neptune/latest/userguide/parameters.html#parameters-db-cluster-parameters-neptune_streams) +// DB cluster parameter to 1 . See Capturing graph changes in real time using +// Neptune streams (https://docs.aws.amazon.com/neptune/latest/userguide/streams.html) +// . +func (c *Client) GetSparqlStream(ctx context.Context, params *GetSparqlStreamInput, optFns ...func(*Options)) (*GetSparqlStreamOutput, error) { + if params == nil { + params = &GetSparqlStreamInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetSparqlStream", params, optFns, c.addOperationGetSparqlStreamMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetSparqlStreamOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetSparqlStreamInput struct { + + // The commit number of the starting record to read from the change-log stream. + // This parameter is required when iteratorType is AT_SEQUENCE_NUMBER or + // AFTER_SEQUENCE_NUMBER , and ignored when iteratorType is TRIM_HORIZON or LATEST . + CommitNum *int64 + + // If set to TRUE, Neptune compresses the response using gzip encoding. + Encoding types.Encoding + + // Can be one of: + // - AT_SEQUENCE_NUMBER – Indicates that reading should start from the event + // sequence number specified jointly by the commitNum and opNum parameters. + // - AFTER_SEQUENCE_NUMBER – Indicates that reading should start right after the + // event sequence number specified jointly by the commitNum and opNum parameters. + // - TRIM_HORIZON – Indicates that reading should start at the last untrimmed + // record in the system, which is the oldest unexpired (not yet deleted) record in + // the change-log stream. + // - LATEST – Indicates that reading should start at the most recent record in + // the system, which is the latest unexpired (not yet deleted) record in the + // change-log stream. + IteratorType types.IteratorType + + // Specifies the maximum number of records to return. There is also a size limit + // of 10 MB on the response that can't be modified and that takes precedence over + // the number of records specified in the limit parameter. The response does + // include a threshold-breaching record if the 10 MB limit was reached. The range + // for limit is 1 to 100,000, with a default of 10. + Limit *int64 + + // The operation sequence number within the specified commit to start reading from + // in the change-log stream data. The default is 1 . + OpNum *int64 + + noSmithyDocumentSerde +} + +type GetSparqlStreamOutput struct { + + // Serialization format for the change records being returned. Currently, the only + // supported value is NQUADS . + // + // This member is required. + Format *string + + // Sequence identifier of the last change in the stream response. An event ID is + // composed of two fields: a commitNum , which identifies a transaction that + // changed the graph, and an opNum , which identifies a specific operation within + // that transaction: + // + // This member is required. + LastEventId map[string]string + + // The time at which the commit for the transaction was requested, in milliseconds + // from the Unix epoch. + // + // This member is required. + LastTrxTimestampInMillis *int64 + + // An array of serialized change-log stream records included in the response. + // + // This member is required. + Records []types.SparqlRecord + + // The total number of records in the response. + // + // This member is required. + TotalRecords *int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetSparqlStreamMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetSparqlStream{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetSparqlStream{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetSparqlStreamResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetSparqlStream(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetSparqlStream(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "GetSparqlStream", + } +} + +type opGetSparqlStreamResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetSparqlStreamResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetSparqlStreamResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetSparqlStreamResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetSparqlStreamResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ListGremlinQueries.go b/service/neptunedata/api_op_ListGremlinQueries.go new file mode 100644 index 00000000000..fb12a61d58a --- /dev/null +++ b/service/neptunedata/api_op_ListGremlinQueries.go @@ -0,0 +1,265 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists active Gremlin queries. See Gremlin query status API (https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-api-status.html) +// for details about the output. +func (c *Client) ListGremlinQueries(ctx context.Context, params *ListGremlinQueriesInput, optFns ...func(*Options)) (*ListGremlinQueriesOutput, error) { + if params == nil { + params = &ListGremlinQueriesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListGremlinQueries", params, optFns, c.addOperationListGremlinQueriesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListGremlinQueriesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListGremlinQueriesInput struct { + + // If set to TRUE , the list returned includes waiting queries. The default is + // FALSE ; + IncludeWaiting *bool + + noSmithyDocumentSerde +} + +type ListGremlinQueriesOutput struct { + + // The number of queries that have been accepted but not yet completed, including + // queries in the queue. + AcceptedQueryCount *int32 + + // A list of the current queries. + Queries []types.GremlinQueryStatus + + // The number of Gremlin queries currently running. + RunningQueryCount *int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListGremlinQueriesMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListGremlinQueries{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListGremlinQueries{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListGremlinQueriesResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListGremlinQueries(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListGremlinQueries(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ListGremlinQueries", + } +} + +type opListGremlinQueriesResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListGremlinQueriesResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListGremlinQueriesResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListGremlinQueriesResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListGremlinQueriesResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ListLoaderJobs.go b/service/neptunedata/api_op_ListLoaderJobs.go new file mode 100644 index 00000000000..5392c6ef258 --- /dev/null +++ b/service/neptunedata/api_op_ListLoaderJobs.go @@ -0,0 +1,269 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves a list of the loadIds for all active loader jobs. +func (c *Client) ListLoaderJobs(ctx context.Context, params *ListLoaderJobsInput, optFns ...func(*Options)) (*ListLoaderJobsOutput, error) { + if params == nil { + params = &ListLoaderJobsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListLoaderJobs", params, optFns, c.addOperationListLoaderJobsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListLoaderJobsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListLoaderJobsInput struct { + + // An optional parameter that can be used to exclude the load IDs of queued load + // requests when requesting a list of load IDs by setting the parameter to FALSE . + // The default value is TRUE . + IncludeQueuedLoads *bool + + // The number of load IDs to list. Must be a positive integer greater than zero + // and not more than 100 (which is the default). + Limit *int32 + + noSmithyDocumentSerde +} + +type ListLoaderJobsOutput struct { + + // The requested list of job IDs. + // + // This member is required. + Payload *types.LoaderIdResult + + // Returns the status of the job list request. + // + // This member is required. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListLoaderJobsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListLoaderJobs{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListLoaderJobs{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListLoaderJobsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListLoaderJobs(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListLoaderJobs(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ListLoaderJobs", + } +} + +type opListLoaderJobsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListLoaderJobsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListLoaderJobsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListLoaderJobsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListLoaderJobsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ListMLDataProcessingJobs.go b/service/neptunedata/api_op_ListMLDataProcessingJobs.go new file mode 100644 index 00000000000..4a8eef67018 --- /dev/null +++ b/service/neptunedata/api_op_ListMLDataProcessingJobs.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns a list of Neptune ML data processing jobs. See Listing active +// data-processing jobs using the Neptune ML dataprocessing command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-dataprocessing.html#machine-learning-api-dataprocessing-list-jobs) +// . +func (c *Client) ListMLDataProcessingJobs(ctx context.Context, params *ListMLDataProcessingJobsInput, optFns ...func(*Options)) (*ListMLDataProcessingJobsOutput, error) { + if params == nil { + params = &ListMLDataProcessingJobsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListMLDataProcessingJobs", params, optFns, c.addOperationListMLDataProcessingJobsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListMLDataProcessingJobsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListMLDataProcessingJobsInput struct { + + // The maximum number of items to return (from 1 to 1024; the default is 10). + MaxItems *int32 + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type ListMLDataProcessingJobsOutput struct { + + // A page listing data processing job IDs. + Ids []string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListMLDataProcessingJobsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListMLDataProcessingJobs{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListMLDataProcessingJobs{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListMLDataProcessingJobsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListMLDataProcessingJobs(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListMLDataProcessingJobs(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ListMLDataProcessingJobs", + } +} + +type opListMLDataProcessingJobsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListMLDataProcessingJobsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListMLDataProcessingJobsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListMLDataProcessingJobsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListMLDataProcessingJobsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ListMLEndpoints.go b/service/neptunedata/api_op_ListMLEndpoints.go new file mode 100644 index 00000000000..822dadfc27d --- /dev/null +++ b/service/neptunedata/api_op_ListMLEndpoints.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists existing inference endpoints. See Managing inference endpoints using the +// endpoints command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-endpoints.html) +// . +func (c *Client) ListMLEndpoints(ctx context.Context, params *ListMLEndpointsInput, optFns ...func(*Options)) (*ListMLEndpointsOutput, error) { + if params == nil { + params = &ListMLEndpointsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListMLEndpoints", params, optFns, c.addOperationListMLEndpointsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListMLEndpointsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListMLEndpointsInput struct { + + // The maximum number of items to return (from 1 to 1024; the default is 10. + MaxItems *int32 + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type ListMLEndpointsOutput struct { + + // A page from the list of inference endpoint IDs. + Ids []string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListMLEndpointsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListMLEndpoints{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListMLEndpoints{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListMLEndpointsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListMLEndpoints(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListMLEndpoints(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ListMLEndpoints", + } +} + +type opListMLEndpointsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListMLEndpointsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListMLEndpointsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListMLEndpointsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListMLEndpointsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ListMLModelTrainingJobs.go b/service/neptunedata/api_op_ListMLModelTrainingJobs.go new file mode 100644 index 00000000000..de69592e549 --- /dev/null +++ b/service/neptunedata/api_op_ListMLModelTrainingJobs.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists Neptune ML model-training jobs. See Model training using the modeltraining +// command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-modeltraining.html) +// . +func (c *Client) ListMLModelTrainingJobs(ctx context.Context, params *ListMLModelTrainingJobsInput, optFns ...func(*Options)) (*ListMLModelTrainingJobsOutput, error) { + if params == nil { + params = &ListMLModelTrainingJobsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListMLModelTrainingJobs", params, optFns, c.addOperationListMLModelTrainingJobsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListMLModelTrainingJobsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListMLModelTrainingJobsInput struct { + + // The maximum number of items to return (from 1 to 1024; the default is 10). + MaxItems *int32 + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type ListMLModelTrainingJobsOutput struct { + + // A page of the list of model training job IDs. + Ids []string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListMLModelTrainingJobsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListMLModelTrainingJobs{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListMLModelTrainingJobs{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListMLModelTrainingJobsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListMLModelTrainingJobs(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListMLModelTrainingJobs(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ListMLModelTrainingJobs", + } +} + +type opListMLModelTrainingJobsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListMLModelTrainingJobsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListMLModelTrainingJobsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListMLModelTrainingJobsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListMLModelTrainingJobsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ListMLModelTransformJobs.go b/service/neptunedata/api_op_ListMLModelTransformJobs.go new file mode 100644 index 00000000000..52667e69a36 --- /dev/null +++ b/service/neptunedata/api_op_ListMLModelTransformJobs.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns a list of model transform job IDs. See Use a trained model to generate +// new model artifacts (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-model-transform.html) +// . +func (c *Client) ListMLModelTransformJobs(ctx context.Context, params *ListMLModelTransformJobsInput, optFns ...func(*Options)) (*ListMLModelTransformJobsOutput, error) { + if params == nil { + params = &ListMLModelTransformJobsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListMLModelTransformJobs", params, optFns, c.addOperationListMLModelTransformJobsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListMLModelTransformJobsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListMLModelTransformJobsInput struct { + + // The maximum number of items to return (from 1 to 1024; the default is 10). + MaxItems *int32 + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + noSmithyDocumentSerde +} + +type ListMLModelTransformJobsOutput struct { + + // A page from the list of model transform IDs. + Ids []string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListMLModelTransformJobsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListMLModelTransformJobs{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListMLModelTransformJobs{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListMLModelTransformJobsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListMLModelTransformJobs(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListMLModelTransformJobs(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ListMLModelTransformJobs", + } +} + +type opListMLModelTransformJobsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListMLModelTransformJobsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListMLModelTransformJobsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListMLModelTransformJobsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListMLModelTransformJobsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ListOpenCypherQueries.go b/service/neptunedata/api_op_ListOpenCypherQueries.go new file mode 100644 index 00000000000..5a065a65173 --- /dev/null +++ b/service/neptunedata/api_op_ListOpenCypherQueries.go @@ -0,0 +1,265 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists active openCypher queries. See Neptune openCypher status endpoint (https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-opencypher-status.html) +// for more information. +func (c *Client) ListOpenCypherQueries(ctx context.Context, params *ListOpenCypherQueriesInput, optFns ...func(*Options)) (*ListOpenCypherQueriesOutput, error) { + if params == nil { + params = &ListOpenCypherQueriesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListOpenCypherQueries", params, optFns, c.addOperationListOpenCypherQueriesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListOpenCypherQueriesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListOpenCypherQueriesInput struct { + + // When set to TRUE and other parameters are not present, causes status + // information to be returned for waiting queries as well as for running queries. + IncludeWaiting *bool + + noSmithyDocumentSerde +} + +type ListOpenCypherQueriesOutput struct { + + // The number of queries that have been accepted but not yet completed, including + // queries in the queue. + AcceptedQueryCount *int32 + + // A list of current openCypher queries. + Queries []types.GremlinQueryStatus + + // The number of currently running openCypher queries. + RunningQueryCount *int32 + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListOpenCypherQueriesMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListOpenCypherQueries{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListOpenCypherQueries{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListOpenCypherQueriesResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListOpenCypherQueries(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListOpenCypherQueries(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ListOpenCypherQueries", + } +} + +type opListOpenCypherQueriesResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListOpenCypherQueriesResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListOpenCypherQueriesResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListOpenCypherQueriesResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListOpenCypherQueriesResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ManagePropertygraphStatistics.go b/service/neptunedata/api_op_ManagePropertygraphStatistics.go new file mode 100644 index 00000000000..0b27e1d7167 --- /dev/null +++ b/service/neptunedata/api_op_ManagePropertygraphStatistics.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Manages the generation and use of property graph statistics. +func (c *Client) ManagePropertygraphStatistics(ctx context.Context, params *ManagePropertygraphStatisticsInput, optFns ...func(*Options)) (*ManagePropertygraphStatisticsOutput, error) { + if params == nil { + params = &ManagePropertygraphStatisticsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ManagePropertygraphStatistics", params, optFns, c.addOperationManagePropertygraphStatisticsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ManagePropertygraphStatisticsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ManagePropertygraphStatisticsInput struct { + + // The statistics generation mode. One of: DISABLE_AUTOCOMPUTE , ENABLE_AUTOCOMPUTE + // , or REFRESH , the last of which manually triggers DFE statistics generation. + Mode types.StatisticsAutoGenerationMode + + noSmithyDocumentSerde +} + +type ManagePropertygraphStatisticsOutput struct { + + // The HTTP return code of the request. If the request succeeded, the code is 200. + // + // This member is required. + Status *string + + // This is only returned for refresh mode. + Payload *types.RefreshStatisticsIdMap + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationManagePropertygraphStatisticsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpManagePropertygraphStatistics{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpManagePropertygraphStatistics{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addManagePropertygraphStatisticsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opManagePropertygraphStatistics(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opManagePropertygraphStatistics(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ManagePropertygraphStatistics", + } +} + +type opManagePropertygraphStatisticsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opManagePropertygraphStatisticsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opManagePropertygraphStatisticsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addManagePropertygraphStatisticsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opManagePropertygraphStatisticsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_ManageSparqlStatistics.go b/service/neptunedata/api_op_ManageSparqlStatistics.go new file mode 100644 index 00000000000..45876c6277b --- /dev/null +++ b/service/neptunedata/api_op_ManageSparqlStatistics.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Manages the generation and use of RDF graph statistics. +func (c *Client) ManageSparqlStatistics(ctx context.Context, params *ManageSparqlStatisticsInput, optFns ...func(*Options)) (*ManageSparqlStatisticsOutput, error) { + if params == nil { + params = &ManageSparqlStatisticsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ManageSparqlStatistics", params, optFns, c.addOperationManageSparqlStatisticsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ManageSparqlStatisticsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ManageSparqlStatisticsInput struct { + + // The statistics generation mode. One of: DISABLE_AUTOCOMPUTE , ENABLE_AUTOCOMPUTE + // , or REFRESH , the last of which manually triggers DFE statistics generation. + Mode types.StatisticsAutoGenerationMode + + noSmithyDocumentSerde +} + +type ManageSparqlStatisticsOutput struct { + + // The HTTP return code of the request. If the request succeeded, the code is 200. + // + // This member is required. + Status *string + + // This is only returned for refresh mode. + Payload *types.RefreshStatisticsIdMap + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationManageSparqlStatisticsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpManageSparqlStatistics{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpManageSparqlStatistics{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addManageSparqlStatisticsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opManageSparqlStatistics(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opManageSparqlStatistics(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "ManageSparqlStatistics", + } +} + +type opManageSparqlStatisticsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opManageSparqlStatisticsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opManageSparqlStatisticsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addManageSparqlStatisticsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opManageSparqlStatisticsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_StartLoaderJob.go b/service/neptunedata/api_op_StartLoaderJob.go new file mode 100644 index 00000000000..28c3a727c67 --- /dev/null +++ b/service/neptunedata/api_op_StartLoaderJob.go @@ -0,0 +1,429 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Starts a Neptune bulk loader job to load data from an Amazon S3 bucket into a +// Neptune DB instance. See Using the Amazon Neptune Bulk Loader to Ingest Data (https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load.html) +// . +func (c *Client) StartLoaderJob(ctx context.Context, params *StartLoaderJobInput, optFns ...func(*Options)) (*StartLoaderJobOutput, error) { + if params == nil { + params = &StartLoaderJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartLoaderJob", params, optFns, c.addOperationStartLoaderJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartLoaderJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartLoaderJobInput struct { + + // The format of the data. For more information about data formats for the Neptune + // Loader command, see Load Data Formats (https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-format.html) + // . Allowed values + // - csv for the Gremlin CSV data format (https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-format-gremlin.html) + // . + // - opencypher for the openCypher CSV data format (https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-format-opencypher.html) + // . + // - ntriples for the N-Triples RDF data format (https://www.w3.org/TR/n-triples/) + // . + // - nquads for the N-Quads RDF data format (https://www.w3.org/TR/n-quads/) . + // - rdfxml for the RDF\XML RDF data format (https://www.w3.org/TR/rdf-syntax-grammar/) + // . + // - turtle for the Turtle RDF data format (https://www.w3.org/TR/turtle/) . + // + // This member is required. + Format types.Format + + // The Amazon Resource Name (ARN) for an IAM role to be assumed by the Neptune DB + // instance for access to the S3 bucket. The IAM role ARN provided here should be + // attached to the DB cluster (see Adding the IAM Role to an Amazon Neptune Cluster (https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-IAM-add-role-cluster.html) + // . + // + // This member is required. + IamRoleArn *string + + // The Amazon region of the S3 bucket. This must match the Amazon Region of the DB + // cluster. + // + // This member is required. + S3BucketRegion types.S3BucketRegion + + // The source parameter accepts an S3 URI that identifies a single file, multiple + // files, a folder, or multiple folders. Neptune loads every data file in any + // folder that is specified. The URI can be in any of the following formats. + // - s3://(bucket_name)/(object-key-name) + // - https://s3.amazonaws.com/(bucket_name)/(object-key-name) + // - https://s3.us-east-1.amazonaws.com/(bucket_name)/(object-key-name) + // The object-key-name element of the URI is equivalent to the prefix (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html#API_ListObjects_RequestParameters) + // parameter in an S3 ListObjects (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html) + // API call. It identifies all the objects in the specified S3 bucket whose names + // begin with that prefix. That can be a single file or folder, or multiple files + // and/or folders. The specified folder or folders can contain multiple vertex + // files and multiple edge files. + // + // This member is required. + Source *string + + // This is an optional parameter that can make a queued load request contingent on + // the successful completion of one or more previous jobs in the queue. Neptune can + // queue up as many as 64 load requests at a time, if their queueRequest + // parameters are set to "TRUE" . The dependencies parameter lets you make + // execution of such a queued request dependent on the successful completion of one + // or more specified previous requests in the queue. For example, if load Job-A + // and Job-B are independent of each other, but load Job-C needs Job-A and Job-B + // to be finished before it begins, proceed as follows: + // - Submit load-job-A and load-job-B one after another in any order, and save + // their load-ids. + // - Submit load-job-C with the load-ids of the two jobs in its dependencies + // field: + // Because of the dependencies parameter, the bulk loader will not start Job-C + // until Job-A and Job-B have completed successfully. If either one of them fails, + // Job-C will not be executed, and its status will be set to + // LOAD_FAILED_BECAUSE_DEPENDENCY_NOT_SATISFIED . You can set up multiple levels of + // dependency in this way, so that the failure of one job will cause all requests + // that are directly or indirectly dependent on it to be cancelled. + Dependencies []string + + // failOnError – A flag to toggle a complete stop on an error. Allowed values: + // "TRUE" , "FALSE" . Default value: "TRUE" . When this parameter is set to "FALSE" + // , the loader tries to load all the data in the location specified, skipping any + // entries with errors. When this parameter is set to "TRUE" , the loader stops as + // soon as it encounters an error. Data loaded up to that point persists. + FailOnError *bool + + // The load job mode. Allowed values: RESUME , NEW , AUTO . Default value: AUTO . + // - RESUME – In RESUME mode, the loader looks for a previous load from this + // source, and if it finds one, resumes that load job. If no previous load job is + // found, the loader stops. The loader avoids reloading files that were + // successfully loaded in a previous job. It only tries to process failed files. If + // you dropped previously loaded data from your Neptune cluster, that data is not + // reloaded in this mode. If a previous load job loaded all files from the same + // source successfully, nothing is reloaded, and the loader returns success. + // - NEW – In NEW mode, the creates a new load request regardless of any previous + // loads. You can use this mode to reload all the data from a source after dropping + // previously loaded data from your Neptune cluster, or to load new data available + // at the same source. + // - AUTO – In AUTO mode, the loader looks for a previous load job from the same + // source, and if it finds one, resumes that job, just as in RESUME mode. If the + // loader doesn't find a previous load job from the same source, it loads all data + // from the source, just as in NEW mode. + Mode types.Mode + + // The optional parallelism parameter can be set to reduce the number of threads + // used by the bulk load process. Allowed values: + // - LOW – The number of threads used is the number of available vCPUs divided by + // 8. + // - MEDIUM – The number of threads used is the number of available vCPUs divided + // by 2. + // - HIGH – The number of threads used is the same as the number of available + // vCPUs. + // - OVERSUBSCRIBE – The number of threads used is the number of available vCPUs + // multiplied by 2. If this value is used, the bulk loader takes up all available + // resources. This does not mean, however, that the OVERSUBSCRIBE setting results + // in 100% CPU utilization. Because the load operation is I/O bound, the highest + // CPU utilization to expect is in the 60% to 70% range. + // Default value: HIGH The parallelism setting can sometimes result in a deadlock + // between threads when loading openCypher data. When this happens, Neptune returns + // the LOAD_DATA_DEADLOCK error. You can generally fix the issue by setting + // parallelism to a lower setting and retrying the load command. + Parallelism types.Parallelism + + // parserConfiguration – An optional object with additional parser configuration + // values. Each of the child parameters is also optional: + // - namedGraphUri – The default graph for all RDF formats when no graph is + // specified (for non-quads formats and NQUAD entries with no graph). The default + // is https://aws.amazon.com/neptune/vocab/v01/DefaultNamedGraph . + // - baseUri – The base URI for RDF/XML and Turtle formats. The default is + // https://aws.amazon.com/neptune/default . + // - allowEmptyStrings – Gremlin users need to be able to pass empty string + // values("") as node and edge properties when loading CSV data. If + // allowEmptyStrings is set to false (the default), such empty strings are + // treated as nulls and are not loaded. If allowEmptyStrings is set to true , the + // loader treats empty strings as valid property values and loads them accordingly. + ParserConfiguration map[string]string + + // This is an optional flag parameter that indicates whether the load request can + // be queued up or not. You don't have to wait for one load job to complete before + // issuing the next one, because Neptune can queue up as many as 64 jobs at a time, + // provided that their queueRequest parameters are all set to "TRUE" . If the + // queueRequest parameter is omitted or set to "FALSE" , the load request will fail + // if another load job is already running. Allowed values: "TRUE" , "FALSE" . + // Default value: "FALSE" . + QueueRequest *bool + + // updateSingleCardinalityProperties is an optional parameter that controls how + // the bulk loader treats a new value for single-cardinality vertex or edge + // properties. This is not supported for loading openCypher data. Allowed values: + // "TRUE" , "FALSE" . Default value: "FALSE" . By default, or when + // updateSingleCardinalityProperties is explicitly set to "FALSE" , the loader + // treats a new value as an error, because it violates single cardinality. When + // updateSingleCardinalityProperties is set to "TRUE" , on the other hand, the bulk + // loader replaces the existing value with the new one. If multiple edge or + // single-cardinality vertex property values are provided in the source file(s) + // being loaded, the final value at the end of the bulk load could be any one of + // those new values. The loader only guarantees that the existing value has been + // replaced by one of the new ones. + UpdateSingleCardinalityProperties *bool + + // This parameter is required only when loading openCypher data that contains + // relationship IDs. It must be included and set to True when openCypher + // relationship IDs are explicitly provided in the load data (recommended). When + // userProvidedEdgeIds is absent or set to True , an :ID column must be present in + // every relationship file in the load. When userProvidedEdgeIds is present and + // set to False , relationship files in the load must not contain an :ID column. + // Instead, the Neptune loader automatically generates an ID for each relationship. + // It's useful to provide relationship IDs explicitly so that the loader can resume + // loading after error in the CSV data have been fixed, without having to reload + // any relationships that have already been loaded. If relationship IDs have not + // been explicitly assigned, the loader cannot resume a failed load if any + // relationship file has had to be corrected, and must instead reload all the + // relationships. + UserProvidedEdgeIds *bool + + noSmithyDocumentSerde +} + +type StartLoaderJobOutput struct { + + // Contains a loadId name-value pair that provides an identifier for the load + // operation. + // + // This member is required. + Payload map[string]string + + // The HTTP return code indicating the status of the load job. + // + // This member is required. + Status *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartLoaderJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartLoaderJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartLoaderJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addStartLoaderJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpStartLoaderJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartLoaderJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStartLoaderJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "StartLoaderJob", + } +} + +type opStartLoaderJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opStartLoaderJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opStartLoaderJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addStartLoaderJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opStartLoaderJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_StartMLDataProcessingJob.go b/service/neptunedata/api_op_StartMLDataProcessingJob.go new file mode 100644 index 00000000000..62555edc9be --- /dev/null +++ b/service/neptunedata/api_op_StartMLDataProcessingJob.go @@ -0,0 +1,332 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a new Neptune ML data processing job for processing the graph data +// exported from Neptune for training. See The dataprocessing command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-dataprocessing.html) +// . +func (c *Client) StartMLDataProcessingJob(ctx context.Context, params *StartMLDataProcessingJobInput, optFns ...func(*Options)) (*StartMLDataProcessingJobOutput, error) { + if params == nil { + params = &StartMLDataProcessingJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartMLDataProcessingJob", params, optFns, c.addOperationStartMLDataProcessingJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartMLDataProcessingJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartMLDataProcessingJobInput struct { + + // The URI of the Amazon S3 location where you want SageMaker to download the data + // needed to run the data processing job. + // + // This member is required. + InputDataS3Location *string + + // The URI of the Amazon S3 location where you want SageMaker to save the results + // of a data processing job. + // + // This member is required. + ProcessedDataS3Location *string + + // A data specification file that describes how to load the exported graph data + // for training. The file is automatically generated by the Neptune export toolkit. + // The default is training-data-configuration.json . + ConfigFileName *string + + // A unique identifier for the new job. The default is an autogenerated UUID. + Id *string + + // One of the two model types that Neptune ML currently supports: heterogeneous + // graph models ( heterogeneous ), and knowledge graph ( kge ). The default is + // none. If not specified, Neptune ML chooses the model type automatically based on + // the data. + ModelType *string + + // The Amazon Resource Name (ARN) of an IAM role that SageMaker can assume to + // perform tasks on your behalf. This must be listed in your DB cluster parameter + // group or an error will occur. + NeptuneIamRoleArn *string + + // The job ID of a completed data processing job run on an earlier version of the + // data. + PreviousDataProcessingJobId *string + + // The type of ML instance used during data processing. Its memory should be large + // enough to hold the processed dataset. The default is the smallest ml.r5 type + // whose memory is ten times larger than the size of the exported graph data on + // disk. + ProcessingInstanceType *string + + // The disk volume size of the processing instance. Both input data and processed + // data are stored on disk, so the volume size must be large enough to hold both + // data sets. The default is 0. If not specified or 0, Neptune ML chooses the + // volume size automatically based on the data size. + ProcessingInstanceVolumeSizeInGB *int32 + + // Timeout in seconds for the data processing job. The default is 86,400 (1 day). + ProcessingTimeOutInSeconds *int32 + + // The Amazon Key Management Service (Amazon KMS) key that SageMaker uses to + // encrypt the output of the processing job. The default is none. + S3OutputEncryptionKMSKey *string + + // The ARN of an IAM role for SageMaker execution. This must be listed in your DB + // cluster parameter group or an error will occur. + SagemakerIamRoleArn *string + + // The VPC security group IDs. The default is None. + SecurityGroupIds []string + + // The IDs of the subnets in the Neptune VPC. The default is None. + Subnets []string + + // The Amazon Key Management Service (Amazon KMS) key that SageMaker uses to + // encrypt data on the storage volume attached to the ML compute instances that run + // the training job. The default is None. + VolumeEncryptionKMSKey *string + + noSmithyDocumentSerde +} + +type StartMLDataProcessingJobOutput struct { + + // The ARN of the data processing job. + Arn *string + + // The time it took to create the new processing job, in milliseconds. + CreationTimeInMillis *int64 + + // The unique ID of the new data processing job. + Id *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartMLDataProcessingJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartMLDataProcessingJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartMLDataProcessingJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addStartMLDataProcessingJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpStartMLDataProcessingJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartMLDataProcessingJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStartMLDataProcessingJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "StartMLDataProcessingJob", + } +} + +type opStartMLDataProcessingJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opStartMLDataProcessingJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opStartMLDataProcessingJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addStartMLDataProcessingJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opStartMLDataProcessingJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_StartMLModelTrainingJob.go b/service/neptunedata/api_op_StartMLModelTrainingJob.go new file mode 100644 index 00000000000..8f9e9c2b862 --- /dev/null +++ b/service/neptunedata/api_op_StartMLModelTrainingJob.go @@ -0,0 +1,345 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a new Neptune ML model training job. See Model training using the +// modeltraining command (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-api-modeltraining.html) +// . +func (c *Client) StartMLModelTrainingJob(ctx context.Context, params *StartMLModelTrainingJobInput, optFns ...func(*Options)) (*StartMLModelTrainingJobOutput, error) { + if params == nil { + params = &StartMLModelTrainingJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartMLModelTrainingJob", params, optFns, c.addOperationStartMLModelTrainingJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartMLModelTrainingJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartMLModelTrainingJobInput struct { + + // The job ID of the completed data-processing job that has created the data that + // the training will work with. + // + // This member is required. + DataProcessingJobId *string + + // The location in Amazon S3 where the model artifacts are to be stored. + // + // This member is required. + TrainModelS3Location *string + + // The type of ML instance used in preparing and managing training of ML models. + // This is a CPU instance chosen based on memory requirements for processing the + // training data and model. + BaseProcessingInstanceType *string + + // The configuration for custom model training. This is a JSON object. + CustomModelTrainingParameters *types.CustomModelTrainingParameters + + // Optimizes the cost of training machine-learning models by using Amazon Elastic + // Compute Cloud spot instances. The default is False . + EnableManagedSpotTraining *bool + + // A unique identifier for the new job. The default is An autogenerated UUID. + Id *string + + // Maximum total number of training jobs to start for the hyperparameter tuning + // job. The default is 2. Neptune ML automatically tunes the hyperparameters of the + // machine learning model. To obtain a model that performs well, use at least 10 + // jobs (in other words, set maxHPONumberOfTrainingJobs to 10). In general, the + // more tuning runs, the better the results. + MaxHPONumberOfTrainingJobs *int32 + + // Maximum number of parallel training jobs to start for the hyperparameter tuning + // job. The default is 2. The number of parallel jobs you can run is limited by the + // available resources on your training instance. + MaxHPOParallelTrainingJobs *int32 + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + // The job ID of a completed model-training job that you want to update + // incrementally based on updated data. + PreviousModelTrainingJobId *string + + // The Amazon Key Management Service (KMS) key that SageMaker uses to encrypt the + // output of the processing job. The default is none. + S3OutputEncryptionKMSKey *string + + // The ARN of an IAM role for SageMaker execution.This must be listed in your DB + // cluster parameter group or an error will occur. + SagemakerIamRoleArn *string + + // The VPC security group IDs. The default is None. + SecurityGroupIds []string + + // The IDs of the subnets in the Neptune VPC. The default is None. + Subnets []string + + // The type of ML instance used for model training. All Neptune ML models support + // CPU, GPU, and multiGPU training. The default is ml.p3.2xlarge . Choosing the + // right instance type for training depends on the task type, graph size, and your + // budget. + TrainingInstanceType *string + + // The disk volume size of the training instance. Both input data and the output + // model are stored on disk, so the volume size must be large enough to hold both + // data sets. The default is 0. If not specified or 0, Neptune ML selects a disk + // volume size based on the recommendation generated in the data processing step. + TrainingInstanceVolumeSizeInGB *int32 + + // Timeout in seconds for the training job. The default is 86,400 (1 day). + TrainingTimeOutInSeconds *int32 + + // The Amazon Key Management Service (KMS) key that SageMaker uses to encrypt data + // on the storage volume attached to the ML compute instances that run the training + // job. The default is None. + VolumeEncryptionKMSKey *string + + noSmithyDocumentSerde +} + +type StartMLModelTrainingJobOutput struct { + + // The ARN of the new model training job. + Arn *string + + // The model training job creation time, in milliseconds. + CreationTimeInMillis *int64 + + // The unique ID of the new model training job. + Id *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartMLModelTrainingJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartMLModelTrainingJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartMLModelTrainingJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addStartMLModelTrainingJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpStartMLModelTrainingJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartMLModelTrainingJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStartMLModelTrainingJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "StartMLModelTrainingJob", + } +} + +type opStartMLModelTrainingJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opStartMLModelTrainingJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opStartMLModelTrainingJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addStartMLModelTrainingJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opStartMLModelTrainingJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/api_op_StartMLModelTransformJob.go b/service/neptunedata/api_op_StartMLModelTransformJob.go new file mode 100644 index 00000000000..7965c920266 --- /dev/null +++ b/service/neptunedata/api_op_StartMLModelTransformJob.go @@ -0,0 +1,325 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a new model transform job. See Use a trained model to generate new +// model artifacts (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-model-transform.html) +// . +func (c *Client) StartMLModelTransformJob(ctx context.Context, params *StartMLModelTransformJobInput, optFns ...func(*Options)) (*StartMLModelTransformJobOutput, error) { + if params == nil { + params = &StartMLModelTransformJobInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "StartMLModelTransformJob", params, optFns, c.addOperationStartMLModelTransformJobMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*StartMLModelTransformJobOutput) + out.ResultMetadata = metadata + return out, nil +} + +type StartMLModelTransformJobInput struct { + + // The location in Amazon S3 where the model artifacts are to be stored. + // + // This member is required. + ModelTransformOutputS3Location *string + + // The type of ML instance used in preparing and managing training of ML models. + // This is an ML compute instance chosen based on memory requirements for + // processing the training data and model. + BaseProcessingInstanceType *string + + // The disk volume size of the training instance in gigabytes. The default is 0. + // Both input data and the output model are stored on disk, so the volume size must + // be large enough to hold both data sets. If not specified or 0, Neptune ML + // selects a disk volume size based on the recommendation generated in the data + // processing step. + BaseProcessingInstanceVolumeSizeInGB *int32 + + // Configuration information for a model transform using a custom model. The + // customModelTransformParameters object contains the following fields, which must + // have values compatible with the saved model parameters from the training job: + CustomModelTransformParameters *types.CustomModelTransformParameters + + // The job ID of a completed data-processing job. You must include either + // dataProcessingJobId and a mlModelTrainingJobId , or a trainingJobName . + DataProcessingJobId *string + + // A unique identifier for the new job. The default is an autogenerated UUID. + Id *string + + // The job ID of a completed model-training job. You must include either + // dataProcessingJobId and a mlModelTrainingJobId , or a trainingJobName . + MlModelTrainingJobId *string + + // The ARN of an IAM role that provides Neptune access to SageMaker and Amazon S3 + // resources. This must be listed in your DB cluster parameter group or an error + // will occur. + NeptuneIamRoleArn *string + + // The Amazon Key Management Service (KMS) key that SageMaker uses to encrypt the + // output of the processing job. The default is none. + S3OutputEncryptionKMSKey *string + + // The ARN of an IAM role for SageMaker execution. This must be listed in your DB + // cluster parameter group or an error will occur. + SagemakerIamRoleArn *string + + // The VPC security group IDs. The default is None. + SecurityGroupIds []string + + // The IDs of the subnets in the Neptune VPC. The default is None. + Subnets []string + + // The name of a completed SageMaker training job. You must include either + // dataProcessingJobId and a mlModelTrainingJobId , or a trainingJobName . + TrainingJobName *string + + // The Amazon Key Management Service (KMS) key that SageMaker uses to encrypt data + // on the storage volume attached to the ML compute instances that run the training + // job. The default is None. + VolumeEncryptionKMSKey *string + + noSmithyDocumentSerde +} + +type StartMLModelTransformJobOutput struct { + + // The ARN of the model transform job. + Arn *string + + // The creation time of the model transform job, in milliseconds. + CreationTimeInMillis *int64 + + // The unique ID of the new model transform job. + Id *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationStartMLModelTransformJobMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpStartMLModelTransformJob{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpStartMLModelTransformJob{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addStartMLModelTransformJobResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpStartMLModelTransformJobValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartMLModelTransformJob(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opStartMLModelTransformJob(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "neptune-db", + OperationName: "StartMLModelTransformJob", + } +} + +type opStartMLModelTransformJobResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opStartMLModelTransformJobResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opStartMLModelTransformJobResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "neptune-db" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "neptune-db" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("neptune-db") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addStartMLModelTransformJobResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opStartMLModelTransformJobResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/neptunedata/deserializers.go b/service/neptunedata/deserializers.go new file mode 100644 index 00000000000..9eab3f2f4a3 --- /dev/null +++ b/service/neptunedata/deserializers.go @@ -0,0 +1,13906 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/document" + internaldocument "github.com/aws/aws-sdk-go-v2/service/neptunedata/internal/document" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/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_deserializeOpCancelGremlinQuery struct { +} + +func (*awsRestjson1_deserializeOpCancelGremlinQuery) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCancelGremlinQuery) 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_deserializeOpErrorCancelGremlinQuery(response, &metadata) + } + output := &CancelGremlinQueryOutput{} + 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_deserializeOpDocumentCancelGremlinQueryOutput(&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_deserializeOpErrorCancelGremlinQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCancelGremlinQueryOutput(v **CancelGremlinQueryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CancelGremlinQueryOutput + if *v == nil { + sv = &CancelGremlinQueryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCancelLoaderJob struct { +} + +func (*awsRestjson1_deserializeOpCancelLoaderJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCancelLoaderJob) 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_deserializeOpErrorCancelLoaderJob(response, &metadata) + } + output := &CancelLoaderJobOutput{} + 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_deserializeOpDocumentCancelLoaderJobOutput(&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_deserializeOpErrorCancelLoaderJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("BulkLoadIdNotFoundException", errorCode): + return awsRestjson1_deserializeErrorBulkLoadIdNotFoundException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InternalFailureException", errorCode): + return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("LoadUrlAccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorLoadUrlAccessDeniedException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCancelLoaderJobOutput(v **CancelLoaderJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CancelLoaderJobOutput + if *v == nil { + sv = &CancelLoaderJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCancelMLDataProcessingJob struct { +} + +func (*awsRestjson1_deserializeOpCancelMLDataProcessingJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCancelMLDataProcessingJob) 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_deserializeOpErrorCancelMLDataProcessingJob(response, &metadata) + } + output := &CancelMLDataProcessingJobOutput{} + 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_deserializeOpDocumentCancelMLDataProcessingJobOutput(&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_deserializeOpErrorCancelMLDataProcessingJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCancelMLDataProcessingJobOutput(v **CancelMLDataProcessingJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CancelMLDataProcessingJobOutput + if *v == nil { + sv = &CancelMLDataProcessingJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCancelMLModelTrainingJob struct { +} + +func (*awsRestjson1_deserializeOpCancelMLModelTrainingJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCancelMLModelTrainingJob) 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_deserializeOpErrorCancelMLModelTrainingJob(response, &metadata) + } + output := &CancelMLModelTrainingJobOutput{} + 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_deserializeOpDocumentCancelMLModelTrainingJobOutput(&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_deserializeOpErrorCancelMLModelTrainingJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCancelMLModelTrainingJobOutput(v **CancelMLModelTrainingJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CancelMLModelTrainingJobOutput + if *v == nil { + sv = &CancelMLModelTrainingJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCancelMLModelTransformJob struct { +} + +func (*awsRestjson1_deserializeOpCancelMLModelTransformJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCancelMLModelTransformJob) 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_deserializeOpErrorCancelMLModelTransformJob(response, &metadata) + } + output := &CancelMLModelTransformJobOutput{} + 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_deserializeOpDocumentCancelMLModelTransformJobOutput(&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_deserializeOpErrorCancelMLModelTransformJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCancelMLModelTransformJobOutput(v **CancelMLModelTransformJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CancelMLModelTransformJobOutput + if *v == nil { + sv = &CancelMLModelTransformJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCancelOpenCypherQuery struct { +} + +func (*awsRestjson1_deserializeOpCancelOpenCypherQuery) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCancelOpenCypherQuery) 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_deserializeOpErrorCancelOpenCypherQuery(response, &metadata) + } + output := &CancelOpenCypherQueryOutput{} + 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_deserializeOpDocumentCancelOpenCypherQueryOutput(&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_deserializeOpErrorCancelOpenCypherQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidNumericDataException", errorCode): + return awsRestjson1_deserializeErrorInvalidNumericDataException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCancelOpenCypherQueryOutput(v **CancelOpenCypherQueryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CancelOpenCypherQueryOutput + if *v == nil { + sv = &CancelOpenCypherQueryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Payload = ptr.Bool(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateMLEndpoint struct { +} + +func (*awsRestjson1_deserializeOpCreateMLEndpoint) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateMLEndpoint) 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_deserializeOpErrorCreateMLEndpoint(response, &metadata) + } + output := &CreateMLEndpointOutput{} + 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_deserializeOpDocumentCreateMLEndpointOutput(&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_deserializeOpErrorCreateMLEndpoint(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateMLEndpointOutput(v **CreateMLEndpointOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateMLEndpointOutput + if *v == nil { + sv = &CreateMLEndpointOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "creationTimeInMillis": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.CreationTimeInMillis = ptr.Int64(i64) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteMLEndpoint struct { +} + +func (*awsRestjson1_deserializeOpDeleteMLEndpoint) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteMLEndpoint) 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_deserializeOpErrorDeleteMLEndpoint(response, &metadata) + } + output := &DeleteMLEndpointOutput{} + 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_deserializeOpDocumentDeleteMLEndpointOutput(&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_deserializeOpErrorDeleteMLEndpoint(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentDeleteMLEndpointOutput(v **DeleteMLEndpointOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteMLEndpointOutput + if *v == nil { + sv = &DeleteMLEndpointOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeletePropertygraphStatistics struct { +} + +func (*awsRestjson1_deserializeOpDeletePropertygraphStatistics) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeletePropertygraphStatistics) 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_deserializeOpErrorDeletePropertygraphStatistics(response, &metadata) + } + output := &DeletePropertygraphStatisticsOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsDeletePropertygraphStatisticsOutput(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_deserializeOpDocumentDeletePropertygraphStatisticsOutput(&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_deserializeOpErrorDeletePropertygraphStatistics(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("StatisticsNotAvailableException", errorCode): + return awsRestjson1_deserializeErrorStatisticsNotAvailableException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsDeletePropertygraphStatisticsOutput(v *DeletePropertygraphStatisticsOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + v.StatusCode = ptr.Int32(int32(response.StatusCode)) + + return nil +} +func awsRestjson1_deserializeOpDocumentDeletePropertygraphStatisticsOutput(v **DeletePropertygraphStatisticsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeletePropertygraphStatisticsOutput + if *v == nil { + sv = &DeletePropertygraphStatisticsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentDeleteStatisticsValueMap(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpDeleteSparqlStatistics struct { +} + +func (*awsRestjson1_deserializeOpDeleteSparqlStatistics) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteSparqlStatistics) 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_deserializeOpErrorDeleteSparqlStatistics(response, &metadata) + } + output := &DeleteSparqlStatisticsOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsDeleteSparqlStatisticsOutput(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_deserializeOpDocumentDeleteSparqlStatisticsOutput(&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_deserializeOpErrorDeleteSparqlStatistics(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("StatisticsNotAvailableException", errorCode): + return awsRestjson1_deserializeErrorStatisticsNotAvailableException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsDeleteSparqlStatisticsOutput(v *DeleteSparqlStatisticsOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + v.StatusCode = ptr.Int32(int32(response.StatusCode)) + + return nil +} +func awsRestjson1_deserializeOpDocumentDeleteSparqlStatisticsOutput(v **DeleteSparqlStatisticsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteSparqlStatisticsOutput + if *v == nil { + sv = &DeleteSparqlStatisticsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentDeleteStatisticsValueMap(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpExecuteFastReset struct { +} + +func (*awsRestjson1_deserializeOpExecuteFastReset) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpExecuteFastReset) 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_deserializeOpErrorExecuteFastReset(response, &metadata) + } + output := &ExecuteFastResetOutput{} + 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_deserializeOpDocumentExecuteFastResetOutput(&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_deserializeOpErrorExecuteFastReset(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MethodNotAllowedException", errorCode): + return awsRestjson1_deserializeErrorMethodNotAllowedException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("ServerShutdownException", errorCode): + return awsRestjson1_deserializeErrorServerShutdownException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentExecuteFastResetOutput(v **ExecuteFastResetOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ExecuteFastResetOutput + if *v == nil { + sv = &ExecuteFastResetOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentFastResetToken(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpExecuteGremlinExplainQuery struct { +} + +func (*awsRestjson1_deserializeOpExecuteGremlinExplainQuery) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpExecuteGremlinExplainQuery) 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_deserializeOpErrorExecuteGremlinExplainQuery(response, &metadata) + } + output := &ExecuteGremlinExplainQueryOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpDocumentExecuteGremlinExplainQueryOutput(output, response.Body, response.ContentLength) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorExecuteGremlinExplainQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("CancelledByUserException", errorCode): + return awsRestjson1_deserializeErrorCancelledByUserException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MalformedQueryException", errorCode): + return awsRestjson1_deserializeErrorMalformedQueryException(response, errorBody) + + case strings.EqualFold("MemoryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorMemoryLimitExceededException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("QueryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitExceededException(response, errorBody) + + case strings.EqualFold("QueryLimitException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitException(response, errorBody) + + case strings.EqualFold("QueryTooLargeException", errorCode): + return awsRestjson1_deserializeErrorQueryTooLargeException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentExecuteGremlinExplainQueryOutput(v *ExecuteGremlinExplainQueryOutput, body io.ReadCloser, contentLength int64) error { + if v == nil { + return fmt.Errorf("unsupported deserialization of nil %T", v) + } + + var buf bytes.Buffer + if contentLength > 0 { + buf.Grow(int(contentLength)) + } else { + buf.Grow(512) + } + + _, err := buf.ReadFrom(body) + if err != nil { + return err + } + if buf.Len() > 0 { + v.Output = buf.Bytes() + } + return nil +} + +type awsRestjson1_deserializeOpExecuteGremlinProfileQuery struct { +} + +func (*awsRestjson1_deserializeOpExecuteGremlinProfileQuery) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpExecuteGremlinProfileQuery) 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_deserializeOpErrorExecuteGremlinProfileQuery(response, &metadata) + } + output := &ExecuteGremlinProfileQueryOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpDocumentExecuteGremlinProfileQueryOutput(output, response.Body, response.ContentLength) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorExecuteGremlinProfileQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("CancelledByUserException", errorCode): + return awsRestjson1_deserializeErrorCancelledByUserException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MalformedQueryException", errorCode): + return awsRestjson1_deserializeErrorMalformedQueryException(response, errorBody) + + case strings.EqualFold("MemoryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorMemoryLimitExceededException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("QueryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitExceededException(response, errorBody) + + case strings.EqualFold("QueryLimitException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitException(response, errorBody) + + case strings.EqualFold("QueryTooLargeException", errorCode): + return awsRestjson1_deserializeErrorQueryTooLargeException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentExecuteGremlinProfileQueryOutput(v *ExecuteGremlinProfileQueryOutput, body io.ReadCloser, contentLength int64) error { + if v == nil { + return fmt.Errorf("unsupported deserialization of nil %T", v) + } + + var buf bytes.Buffer + if contentLength > 0 { + buf.Grow(int(contentLength)) + } else { + buf.Grow(512) + } + + _, err := buf.ReadFrom(body) + if err != nil { + return err + } + if buf.Len() > 0 { + v.Output = buf.Bytes() + } + return nil +} + +type awsRestjson1_deserializeOpExecuteGremlinQuery struct { +} + +func (*awsRestjson1_deserializeOpExecuteGremlinQuery) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpExecuteGremlinQuery) 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_deserializeOpErrorExecuteGremlinQuery(response, &metadata) + } + output := &ExecuteGremlinQueryOutput{} + 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_deserializeOpDocumentExecuteGremlinQueryOutput(&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_deserializeOpErrorExecuteGremlinQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("CancelledByUserException", errorCode): + return awsRestjson1_deserializeErrorCancelledByUserException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MalformedQueryException", errorCode): + return awsRestjson1_deserializeErrorMalformedQueryException(response, errorBody) + + case strings.EqualFold("MemoryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorMemoryLimitExceededException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("QueryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitExceededException(response, errorBody) + + case strings.EqualFold("QueryLimitException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitException(response, errorBody) + + case strings.EqualFold("QueryTooLargeException", errorCode): + return awsRestjson1_deserializeErrorQueryTooLargeException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentExecuteGremlinQueryOutput(v **ExecuteGremlinQueryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ExecuteGremlinQueryOutput + if *v == nil { + sv = &ExecuteGremlinQueryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "meta": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Meta, 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) + } + + case "result": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Result, value); err != nil { + return err + } + + case "status": + if err := awsRestjson1_deserializeDocumentGremlinQueryStatusAttributes(&sv.Status, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpExecuteOpenCypherExplainQuery struct { +} + +func (*awsRestjson1_deserializeOpExecuteOpenCypherExplainQuery) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpExecuteOpenCypherExplainQuery) 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_deserializeOpErrorExecuteOpenCypherExplainQuery(response, &metadata) + } + output := &ExecuteOpenCypherExplainQueryOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpDocumentExecuteOpenCypherExplainQueryOutput(output, response.Body, response.ContentLength) + if err != nil { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("failed to deserialize response payload, %w", err)} + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorExecuteOpenCypherExplainQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("CancelledByUserException", errorCode): + return awsRestjson1_deserializeErrorCancelledByUserException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidNumericDataException", errorCode): + return awsRestjson1_deserializeErrorInvalidNumericDataException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MalformedQueryException", errorCode): + return awsRestjson1_deserializeErrorMalformedQueryException(response, errorBody) + + case strings.EqualFold("MemoryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorMemoryLimitExceededException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("QueryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitExceededException(response, errorBody) + + case strings.EqualFold("QueryLimitException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitException(response, errorBody) + + case strings.EqualFold("QueryTooLargeException", errorCode): + return awsRestjson1_deserializeErrorQueryTooLargeException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentExecuteOpenCypherExplainQueryOutput(v *ExecuteOpenCypherExplainQueryOutput, body io.ReadCloser, contentLength int64) error { + if v == nil { + return fmt.Errorf("unsupported deserialization of nil %T", v) + } + + var buf bytes.Buffer + if contentLength > 0 { + buf.Grow(int(contentLength)) + } else { + buf.Grow(512) + } + + _, err := buf.ReadFrom(body) + if err != nil { + return err + } + if buf.Len() > 0 { + v.Results = buf.Bytes() + } + return nil +} + +type awsRestjson1_deserializeOpExecuteOpenCypherQuery struct { +} + +func (*awsRestjson1_deserializeOpExecuteOpenCypherQuery) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpExecuteOpenCypherQuery) 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_deserializeOpErrorExecuteOpenCypherQuery(response, &metadata) + } + output := &ExecuteOpenCypherQueryOutput{} + 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_deserializeOpDocumentExecuteOpenCypherQueryOutput(&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_deserializeOpErrorExecuteOpenCypherQuery(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("CancelledByUserException", errorCode): + return awsRestjson1_deserializeErrorCancelledByUserException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidNumericDataException", errorCode): + return awsRestjson1_deserializeErrorInvalidNumericDataException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MalformedQueryException", errorCode): + return awsRestjson1_deserializeErrorMalformedQueryException(response, errorBody) + + case strings.EqualFold("MemoryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorMemoryLimitExceededException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("QueryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitExceededException(response, errorBody) + + case strings.EqualFold("QueryLimitException", errorCode): + return awsRestjson1_deserializeErrorQueryLimitException(response, errorBody) + + case strings.EqualFold("QueryTooLargeException", errorCode): + return awsRestjson1_deserializeErrorQueryTooLargeException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentExecuteOpenCypherQueryOutput(v **ExecuteOpenCypherQueryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ExecuteOpenCypherQueryOutput + if *v == nil { + sv = &ExecuteOpenCypherQueryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "results": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Results, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetEngineStatus struct { +} + +func (*awsRestjson1_deserializeOpGetEngineStatus) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetEngineStatus) 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_deserializeOpErrorGetEngineStatus(response, &metadata) + } + output := &GetEngineStatusOutput{} + 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_deserializeOpDocumentGetEngineStatusOutput(&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_deserializeOpErrorGetEngineStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InternalFailureException", errorCode): + return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetEngineStatusOutput(v **GetEngineStatusOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetEngineStatusOutput + if *v == nil { + sv = &GetEngineStatusOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "dbEngineVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DbEngineVersion = ptr.String(jtv) + } + + case "dfeQueryEngine": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DfeQueryEngine = ptr.String(jtv) + } + + case "features": + if err := awsRestjson1_deserializeDocumentDocumentValuedMap(&sv.Features, value); err != nil { + return err + } + + case "gremlin": + if err := awsRestjson1_deserializeDocumentQueryLanguageVersion(&sv.Gremlin, value); err != nil { + return err + } + + case "labMode": + if err := awsRestjson1_deserializeDocumentStringValuedMap(&sv.LabMode, value); err != nil { + return err + } + + case "opencypher": + if err := awsRestjson1_deserializeDocumentQueryLanguageVersion(&sv.Opencypher, value); err != nil { + return err + } + + case "role": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Role = ptr.String(jtv) + } + + case "rollingBackTrxCount": + 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.RollingBackTrxCount = ptr.Int32(int32(i64)) + } + + case "rollingBackTrxEarliestStartTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.RollingBackTrxEarliestStartTime = ptr.String(jtv) + } + + case "settings": + if err := awsRestjson1_deserializeDocumentStringValuedMap(&sv.Settings, value); err != nil { + return err + } + + case "sparql": + if err := awsRestjson1_deserializeDocumentQueryLanguageVersion(&sv.Sparql, value); err != nil { + return err + } + + case "startTime": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.StartTime = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetGremlinQueryStatus struct { +} + +func (*awsRestjson1_deserializeOpGetGremlinQueryStatus) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetGremlinQueryStatus) 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_deserializeOpErrorGetGremlinQueryStatus(response, &metadata) + } + output := &GetGremlinQueryStatusOutput{} + 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_deserializeOpDocumentGetGremlinQueryStatusOutput(&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_deserializeOpErrorGetGremlinQueryStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetGremlinQueryStatusOutput(v **GetGremlinQueryStatusOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetGremlinQueryStatusOutput + if *v == nil { + sv = &GetGremlinQueryStatusOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "queryEvalStats": + if err := awsRestjson1_deserializeDocumentQueryEvalStats(&sv.QueryEvalStats, value); err != nil { + return err + } + + case "queryId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.QueryId = ptr.String(jtv) + } + + case "queryString": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.QueryString = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetLoaderJobStatus struct { +} + +func (*awsRestjson1_deserializeOpGetLoaderJobStatus) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetLoaderJobStatus) 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_deserializeOpErrorGetLoaderJobStatus(response, &metadata) + } + output := &GetLoaderJobStatusOutput{} + 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_deserializeOpDocumentGetLoaderJobStatusOutput(&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_deserializeOpErrorGetLoaderJobStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("BulkLoadIdNotFoundException", errorCode): + return awsRestjson1_deserializeErrorBulkLoadIdNotFoundException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InternalFailureException", errorCode): + return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("LoadUrlAccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorLoadUrlAccessDeniedException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetLoaderJobStatusOutput(v **GetLoaderJobStatusOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetLoaderJobStatusOutput + if *v == nil { + sv = &GetLoaderJobStatusOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetMLDataProcessingJob struct { +} + +func (*awsRestjson1_deserializeOpGetMLDataProcessingJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetMLDataProcessingJob) 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_deserializeOpErrorGetMLDataProcessingJob(response, &metadata) + } + output := &GetMLDataProcessingJobOutput{} + 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_deserializeOpDocumentGetMLDataProcessingJobOutput(&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_deserializeOpErrorGetMLDataProcessingJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetMLDataProcessingJobOutput(v **GetMLDataProcessingJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetMLDataProcessingJobOutput + if *v == nil { + sv = &GetMLDataProcessingJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "processingJob": + if err := awsRestjson1_deserializeDocumentMlResourceDefinition(&sv.ProcessingJob, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetMLEndpoint struct { +} + +func (*awsRestjson1_deserializeOpGetMLEndpoint) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetMLEndpoint) 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_deserializeOpErrorGetMLEndpoint(response, &metadata) + } + output := &GetMLEndpointOutput{} + 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_deserializeOpDocumentGetMLEndpointOutput(&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_deserializeOpErrorGetMLEndpoint(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetMLEndpointOutput(v **GetMLEndpointOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetMLEndpointOutput + if *v == nil { + sv = &GetMLEndpointOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "endpoint": + if err := awsRestjson1_deserializeDocumentMlResourceDefinition(&sv.Endpoint, value); err != nil { + return err + } + + case "endpointConfig": + if err := awsRestjson1_deserializeDocumentMlConfigDefinition(&sv.EndpointConfig, value); err != nil { + return err + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetMLModelTrainingJob struct { +} + +func (*awsRestjson1_deserializeOpGetMLModelTrainingJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetMLModelTrainingJob) 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_deserializeOpErrorGetMLModelTrainingJob(response, &metadata) + } + output := &GetMLModelTrainingJobOutput{} + 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_deserializeOpDocumentGetMLModelTrainingJobOutput(&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_deserializeOpErrorGetMLModelTrainingJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetMLModelTrainingJobOutput(v **GetMLModelTrainingJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetMLModelTrainingJobOutput + if *v == nil { + sv = &GetMLModelTrainingJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "hpoJob": + if err := awsRestjson1_deserializeDocumentMlResourceDefinition(&sv.HpoJob, value); err != nil { + return err + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "mlModels": + if err := awsRestjson1_deserializeDocumentMlModels(&sv.MlModels, value); err != nil { + return err + } + + case "modelTransformJob": + if err := awsRestjson1_deserializeDocumentMlResourceDefinition(&sv.ModelTransformJob, value); err != nil { + return err + } + + case "processingJob": + if err := awsRestjson1_deserializeDocumentMlResourceDefinition(&sv.ProcessingJob, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetMLModelTransformJob struct { +} + +func (*awsRestjson1_deserializeOpGetMLModelTransformJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetMLModelTransformJob) 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_deserializeOpErrorGetMLModelTransformJob(response, &metadata) + } + output := &GetMLModelTransformJobOutput{} + 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_deserializeOpDocumentGetMLModelTransformJobOutput(&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_deserializeOpErrorGetMLModelTransformJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetMLModelTransformJobOutput(v **GetMLModelTransformJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetMLModelTransformJobOutput + if *v == nil { + sv = &GetMLModelTransformJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "baseProcessingJob": + if err := awsRestjson1_deserializeDocumentMlResourceDefinition(&sv.BaseProcessingJob, value); err != nil { + return err + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "models": + if err := awsRestjson1_deserializeDocumentModels(&sv.Models, value); err != nil { + return err + } + + case "remoteModelTransformJob": + if err := awsRestjson1_deserializeDocumentMlResourceDefinition(&sv.RemoteModelTransformJob, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetOpenCypherQueryStatus struct { +} + +func (*awsRestjson1_deserializeOpGetOpenCypherQueryStatus) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetOpenCypherQueryStatus) 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_deserializeOpErrorGetOpenCypherQueryStatus(response, &metadata) + } + output := &GetOpenCypherQueryStatusOutput{} + 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_deserializeOpDocumentGetOpenCypherQueryStatusOutput(&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_deserializeOpErrorGetOpenCypherQueryStatus(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidNumericDataException", errorCode): + return awsRestjson1_deserializeErrorInvalidNumericDataException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetOpenCypherQueryStatusOutput(v **GetOpenCypherQueryStatusOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetOpenCypherQueryStatusOutput + if *v == nil { + sv = &GetOpenCypherQueryStatusOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "queryEvalStats": + if err := awsRestjson1_deserializeDocumentQueryEvalStats(&sv.QueryEvalStats, value); err != nil { + return err + } + + case "queryId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.QueryId = ptr.String(jtv) + } + + case "queryString": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.QueryString = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetPropertygraphStatistics struct { +} + +func (*awsRestjson1_deserializeOpGetPropertygraphStatistics) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetPropertygraphStatistics) 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_deserializeOpErrorGetPropertygraphStatistics(response, &metadata) + } + output := &GetPropertygraphStatisticsOutput{} + 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_deserializeOpDocumentGetPropertygraphStatisticsOutput(&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_deserializeOpErrorGetPropertygraphStatistics(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("StatisticsNotAvailableException", errorCode): + return awsRestjson1_deserializeErrorStatisticsNotAvailableException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetPropertygraphStatisticsOutput(v **GetPropertygraphStatisticsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetPropertygraphStatisticsOutput + if *v == nil { + sv = &GetPropertygraphStatisticsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentStatistics(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetPropertygraphStream struct { +} + +func (*awsRestjson1_deserializeOpGetPropertygraphStream) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetPropertygraphStream) 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_deserializeOpErrorGetPropertygraphStream(response, &metadata) + } + output := &GetPropertygraphStreamOutput{} + 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_deserializeOpDocumentGetPropertygraphStreamOutput(&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_deserializeOpErrorGetPropertygraphStream(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("ExpiredStreamException", errorCode): + return awsRestjson1_deserializeErrorExpiredStreamException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MemoryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorMemoryLimitExceededException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("StreamRecordsNotFoundException", errorCode): + return awsRestjson1_deserializeErrorStreamRecordsNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetPropertygraphStreamOutput(v **GetPropertygraphStreamOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetPropertygraphStreamOutput + if *v == nil { + sv = &GetPropertygraphStreamOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "format": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Format = ptr.String(jtv) + } + + case "lastEventId": + if err := awsRestjson1_deserializeDocumentStringValuedMap(&sv.LastEventId, value); err != nil { + return err + } + + case "lastTrxTimestamp": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.LastTrxTimestampInMillis = ptr.Int64(i64) + } + + case "records": + if err := awsRestjson1_deserializeDocumentPropertygraphRecordsList(&sv.Records, value); err != nil { + return err + } + + case "totalRecords": + 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.TotalRecords = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetPropertygraphSummary struct { +} + +func (*awsRestjson1_deserializeOpGetPropertygraphSummary) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetPropertygraphSummary) 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_deserializeOpErrorGetPropertygraphSummary(response, &metadata) + } + output := &GetPropertygraphSummaryOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsGetPropertygraphSummaryOutput(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_deserializeOpDocumentGetPropertygraphSummaryOutput(&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_deserializeOpErrorGetPropertygraphSummary(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("StatisticsNotAvailableException", errorCode): + return awsRestjson1_deserializeErrorStatisticsNotAvailableException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsGetPropertygraphSummaryOutput(v *GetPropertygraphSummaryOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + v.StatusCode = ptr.Int32(int32(response.StatusCode)) + + return nil +} +func awsRestjson1_deserializeOpDocumentGetPropertygraphSummaryOutput(v **GetPropertygraphSummaryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetPropertygraphSummaryOutput + if *v == nil { + sv = &GetPropertygraphSummaryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentPropertygraphSummaryValueMap(&sv.Payload, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetRDFGraphSummary struct { +} + +func (*awsRestjson1_deserializeOpGetRDFGraphSummary) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetRDFGraphSummary) 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_deserializeOpErrorGetRDFGraphSummary(response, &metadata) + } + output := &GetRDFGraphSummaryOutput{} + out.Result = output + + err = awsRestjson1_deserializeOpHttpBindingsGetRDFGraphSummaryOutput(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_deserializeOpDocumentGetRDFGraphSummaryOutput(&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_deserializeOpErrorGetRDFGraphSummary(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("StatisticsNotAvailableException", errorCode): + return awsRestjson1_deserializeErrorStatisticsNotAvailableException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpHttpBindingsGetRDFGraphSummaryOutput(v *GetRDFGraphSummaryOutput, response *smithyhttp.Response) error { + if v == nil { + return fmt.Errorf("unsupported deserialization for nil %T", v) + } + + v.StatusCode = ptr.Int32(int32(response.StatusCode)) + + return nil +} +func awsRestjson1_deserializeOpDocumentGetRDFGraphSummaryOutput(v **GetRDFGraphSummaryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetRDFGraphSummaryOutput + if *v == nil { + sv = &GetRDFGraphSummaryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentRDFGraphSummaryValueMap(&sv.Payload, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetSparqlStatistics struct { +} + +func (*awsRestjson1_deserializeOpGetSparqlStatistics) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetSparqlStatistics) 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_deserializeOpErrorGetSparqlStatistics(response, &metadata) + } + output := &GetSparqlStatisticsOutput{} + 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_deserializeOpDocumentGetSparqlStatisticsOutput(&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_deserializeOpErrorGetSparqlStatistics(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("StatisticsNotAvailableException", errorCode): + return awsRestjson1_deserializeErrorStatisticsNotAvailableException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetSparqlStatisticsOutput(v **GetSparqlStatisticsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetSparqlStatisticsOutput + if *v == nil { + sv = &GetSparqlStatisticsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentStatistics(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetSparqlStream struct { +} + +func (*awsRestjson1_deserializeOpGetSparqlStream) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetSparqlStream) 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_deserializeOpErrorGetSparqlStream(response, &metadata) + } + output := &GetSparqlStreamOutput{} + 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_deserializeOpDocumentGetSparqlStreamOutput(&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_deserializeOpErrorGetSparqlStream(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("ExpiredStreamException", errorCode): + return awsRestjson1_deserializeErrorExpiredStreamException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MemoryLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorMemoryLimitExceededException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("StreamRecordsNotFoundException", errorCode): + return awsRestjson1_deserializeErrorStreamRecordsNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetSparqlStreamOutput(v **GetSparqlStreamOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetSparqlStreamOutput + if *v == nil { + sv = &GetSparqlStreamOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "format": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Format = ptr.String(jtv) + } + + case "lastEventId": + if err := awsRestjson1_deserializeDocumentStringValuedMap(&sv.LastEventId, value); err != nil { + return err + } + + case "lastTrxTimestamp": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.LastTrxTimestampInMillis = ptr.Int64(i64) + } + + case "records": + if err := awsRestjson1_deserializeDocumentSparqlRecordsList(&sv.Records, value); err != nil { + return err + } + + case "totalRecords": + 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.TotalRecords = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListGremlinQueries struct { +} + +func (*awsRestjson1_deserializeOpListGremlinQueries) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListGremlinQueries) 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_deserializeOpErrorListGremlinQueries(response, &metadata) + } + output := &ListGremlinQueriesOutput{} + 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_deserializeOpDocumentListGremlinQueriesOutput(&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_deserializeOpErrorListGremlinQueries(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListGremlinQueriesOutput(v **ListGremlinQueriesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListGremlinQueriesOutput + if *v == nil { + sv = &ListGremlinQueriesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "acceptedQueryCount": + 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.AcceptedQueryCount = ptr.Int32(int32(i64)) + } + + case "queries": + if err := awsRestjson1_deserializeDocumentGremlinQueries(&sv.Queries, value); err != nil { + return err + } + + case "runningQueryCount": + 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.RunningQueryCount = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListLoaderJobs struct { +} + +func (*awsRestjson1_deserializeOpListLoaderJobs) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListLoaderJobs) 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_deserializeOpErrorListLoaderJobs(response, &metadata) + } + output := &ListLoaderJobsOutput{} + 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_deserializeOpDocumentListLoaderJobsOutput(&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_deserializeOpErrorListLoaderJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("BulkLoadIdNotFoundException", errorCode): + return awsRestjson1_deserializeErrorBulkLoadIdNotFoundException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InternalFailureException", errorCode): + return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("LoadUrlAccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorLoadUrlAccessDeniedException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListLoaderJobsOutput(v **ListLoaderJobsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListLoaderJobsOutput + if *v == nil { + sv = &ListLoaderJobsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentLoaderIdResult(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListMLDataProcessingJobs struct { +} + +func (*awsRestjson1_deserializeOpListMLDataProcessingJobs) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListMLDataProcessingJobs) 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_deserializeOpErrorListMLDataProcessingJobs(response, &metadata) + } + output := &ListMLDataProcessingJobsOutput{} + 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_deserializeOpDocumentListMLDataProcessingJobsOutput(&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_deserializeOpErrorListMLDataProcessingJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListMLDataProcessingJobsOutput(v **ListMLDataProcessingJobsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListMLDataProcessingJobsOutput + if *v == nil { + sv = &ListMLDataProcessingJobsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ids": + if err := awsRestjson1_deserializeDocumentStringList(&sv.Ids, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListMLEndpoints struct { +} + +func (*awsRestjson1_deserializeOpListMLEndpoints) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListMLEndpoints) 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_deserializeOpErrorListMLEndpoints(response, &metadata) + } + output := &ListMLEndpointsOutput{} + 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_deserializeOpDocumentListMLEndpointsOutput(&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_deserializeOpErrorListMLEndpoints(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListMLEndpointsOutput(v **ListMLEndpointsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListMLEndpointsOutput + if *v == nil { + sv = &ListMLEndpointsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ids": + if err := awsRestjson1_deserializeDocumentStringList(&sv.Ids, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListMLModelTrainingJobs struct { +} + +func (*awsRestjson1_deserializeOpListMLModelTrainingJobs) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListMLModelTrainingJobs) 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_deserializeOpErrorListMLModelTrainingJobs(response, &metadata) + } + output := &ListMLModelTrainingJobsOutput{} + 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_deserializeOpDocumentListMLModelTrainingJobsOutput(&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_deserializeOpErrorListMLModelTrainingJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListMLModelTrainingJobsOutput(v **ListMLModelTrainingJobsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListMLModelTrainingJobsOutput + if *v == nil { + sv = &ListMLModelTrainingJobsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ids": + if err := awsRestjson1_deserializeDocumentStringList(&sv.Ids, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListMLModelTransformJobs struct { +} + +func (*awsRestjson1_deserializeOpListMLModelTransformJobs) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListMLModelTransformJobs) 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_deserializeOpErrorListMLModelTransformJobs(response, &metadata) + } + output := &ListMLModelTransformJobsOutput{} + 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_deserializeOpDocumentListMLModelTransformJobsOutput(&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_deserializeOpErrorListMLModelTransformJobs(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListMLModelTransformJobsOutput(v **ListMLModelTransformJobsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListMLModelTransformJobsOutput + if *v == nil { + sv = &ListMLModelTransformJobsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ids": + if err := awsRestjson1_deserializeDocumentStringList(&sv.Ids, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListOpenCypherQueries struct { +} + +func (*awsRestjson1_deserializeOpListOpenCypherQueries) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListOpenCypherQueries) 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_deserializeOpErrorListOpenCypherQueries(response, &metadata) + } + output := &ListOpenCypherQueriesOutput{} + 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_deserializeOpDocumentListOpenCypherQueriesOutput(&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_deserializeOpErrorListOpenCypherQueries(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConcurrentModificationException", errorCode): + return awsRestjson1_deserializeErrorConcurrentModificationException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("FailureByQueryException", errorCode): + return awsRestjson1_deserializeErrorFailureByQueryException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidNumericDataException", errorCode): + return awsRestjson1_deserializeErrorInvalidNumericDataException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("ParsingException", errorCode): + return awsRestjson1_deserializeErrorParsingException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("TimeLimitExceededException", errorCode): + return awsRestjson1_deserializeErrorTimeLimitExceededException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListOpenCypherQueriesOutput(v **ListOpenCypherQueriesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListOpenCypherQueriesOutput + if *v == nil { + sv = &ListOpenCypherQueriesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "acceptedQueryCount": + 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.AcceptedQueryCount = ptr.Int32(int32(i64)) + } + + case "queries": + if err := awsRestjson1_deserializeDocumentOpenCypherQueries(&sv.Queries, value); err != nil { + return err + } + + case "runningQueryCount": + 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.RunningQueryCount = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpManagePropertygraphStatistics struct { +} + +func (*awsRestjson1_deserializeOpManagePropertygraphStatistics) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpManagePropertygraphStatistics) 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_deserializeOpErrorManagePropertygraphStatistics(response, &metadata) + } + output := &ManagePropertygraphStatisticsOutput{} + 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_deserializeOpDocumentManagePropertygraphStatisticsOutput(&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_deserializeOpErrorManagePropertygraphStatistics(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("StatisticsNotAvailableException", errorCode): + return awsRestjson1_deserializeErrorStatisticsNotAvailableException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentManagePropertygraphStatisticsOutput(v **ManagePropertygraphStatisticsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ManagePropertygraphStatisticsOutput + if *v == nil { + sv = &ManagePropertygraphStatisticsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentRefreshStatisticsIdMap(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpManageSparqlStatistics struct { +} + +func (*awsRestjson1_deserializeOpManageSparqlStatistics) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpManageSparqlStatistics) 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_deserializeOpErrorManageSparqlStatistics(response, &metadata) + } + output := &ManageSparqlStatisticsOutput{} + 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_deserializeOpDocumentManageSparqlStatisticsOutput(&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_deserializeOpErrorManageSparqlStatistics(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("ReadOnlyViolationException", errorCode): + return awsRestjson1_deserializeErrorReadOnlyViolationException(response, errorBody) + + case strings.EqualFold("StatisticsNotAvailableException", errorCode): + return awsRestjson1_deserializeErrorStatisticsNotAvailableException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentManageSparqlStatisticsOutput(v **ManageSparqlStatisticsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ManageSparqlStatisticsOutput + if *v == nil { + sv = &ManageSparqlStatisticsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentRefreshStatisticsIdMap(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpStartLoaderJob struct { +} + +func (*awsRestjson1_deserializeOpStartLoaderJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartLoaderJob) 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_deserializeOpErrorStartLoaderJob(response, &metadata) + } + output := &StartLoaderJobOutput{} + 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_deserializeOpDocumentStartLoaderJobOutput(&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_deserializeOpErrorStartLoaderJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("BulkLoadIdNotFoundException", errorCode): + return awsRestjson1_deserializeErrorBulkLoadIdNotFoundException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InternalFailureException", errorCode): + return awsRestjson1_deserializeErrorInternalFailureException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("LoadUrlAccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorLoadUrlAccessDeniedException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("S3Exception", errorCode): + return awsRestjson1_deserializeErrorS3Exception(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentStartLoaderJobOutput(v **StartLoaderJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartLoaderJobOutput + if *v == nil { + sv = &StartLoaderJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "payload": + if err := awsRestjson1_deserializeDocumentStringValuedMap(&sv.Payload, value); err != nil { + return err + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpStartMLDataProcessingJob struct { +} + +func (*awsRestjson1_deserializeOpStartMLDataProcessingJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartMLDataProcessingJob) 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_deserializeOpErrorStartMLDataProcessingJob(response, &metadata) + } + output := &StartMLDataProcessingJobOutput{} + 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_deserializeOpDocumentStartMLDataProcessingJobOutput(&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_deserializeOpErrorStartMLDataProcessingJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentStartMLDataProcessingJobOutput(v **StartMLDataProcessingJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartMLDataProcessingJobOutput + if *v == nil { + sv = &StartMLDataProcessingJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "creationTimeInMillis": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.CreationTimeInMillis = ptr.Int64(i64) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpStartMLModelTrainingJob struct { +} + +func (*awsRestjson1_deserializeOpStartMLModelTrainingJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartMLModelTrainingJob) 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_deserializeOpErrorStartMLModelTrainingJob(response, &metadata) + } + output := &StartMLModelTrainingJobOutput{} + 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_deserializeOpDocumentStartMLModelTrainingJobOutput(&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_deserializeOpErrorStartMLModelTrainingJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentStartMLModelTrainingJobOutput(v **StartMLModelTrainingJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartMLModelTrainingJobOutput + if *v == nil { + sv = &StartMLModelTrainingJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "creationTimeInMillis": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.CreationTimeInMillis = ptr.Int64(i64) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpStartMLModelTransformJob struct { +} + +func (*awsRestjson1_deserializeOpStartMLModelTransformJob) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpStartMLModelTransformJob) 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_deserializeOpErrorStartMLModelTransformJob(response, &metadata) + } + output := &StartMLModelTransformJobOutput{} + 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_deserializeOpDocumentStartMLModelTransformJobOutput(&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_deserializeOpErrorStartMLModelTransformJob(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("BadRequestException", errorCode): + return awsRestjson1_deserializeErrorBadRequestException(response, errorBody) + + case strings.EqualFold("ClientTimeoutException", errorCode): + return awsRestjson1_deserializeErrorClientTimeoutException(response, errorBody) + + case strings.EqualFold("ConstraintViolationException", errorCode): + return awsRestjson1_deserializeErrorConstraintViolationException(response, errorBody) + + case strings.EqualFold("IllegalArgumentException", errorCode): + return awsRestjson1_deserializeErrorIllegalArgumentException(response, errorBody) + + case strings.EqualFold("InvalidArgumentException", errorCode): + return awsRestjson1_deserializeErrorInvalidArgumentException(response, errorBody) + + case strings.EqualFold("InvalidParameterException", errorCode): + return awsRestjson1_deserializeErrorInvalidParameterException(response, errorBody) + + case strings.EqualFold("MLResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorMLResourceNotFoundException(response, errorBody) + + case strings.EqualFold("MissingParameterException", errorCode): + return awsRestjson1_deserializeErrorMissingParameterException(response, errorBody) + + case strings.EqualFold("PreconditionsFailedException", errorCode): + return awsRestjson1_deserializeErrorPreconditionsFailedException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("UnsupportedOperationException", errorCode): + return awsRestjson1_deserializeErrorUnsupportedOperationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentStartMLModelTransformJobOutput(v **StartMLModelTransformJobOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *StartMLModelTransformJobOutput + if *v == nil { + sv = &StartMLModelTransformJobOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "creationTimeInMillis": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.CreationTimeInMillis = ptr.Int64(i64) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + 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_deserializeErrorBadRequestException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.BadRequestException{} + 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_deserializeDocumentBadRequestException(&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_deserializeErrorBulkLoadIdNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.BulkLoadIdNotFoundException{} + 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_deserializeDocumentBulkLoadIdNotFoundException(&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_deserializeErrorCancelledByUserException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.CancelledByUserException{} + 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_deserializeDocumentCancelledByUserException(&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_deserializeErrorClientTimeoutException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ClientTimeoutException{} + 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_deserializeDocumentClientTimeoutException(&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_deserializeErrorConcurrentModificationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ConcurrentModificationException{} + 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_deserializeDocumentConcurrentModificationException(&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_deserializeErrorConstraintViolationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ConstraintViolationException{} + 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_deserializeDocumentConstraintViolationException(&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_deserializeErrorExpiredStreamException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ExpiredStreamException{} + 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_deserializeDocumentExpiredStreamException(&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_deserializeErrorFailureByQueryException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.FailureByQueryException{} + 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_deserializeDocumentFailureByQueryException(&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_deserializeErrorIllegalArgumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.IllegalArgumentException{} + 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_deserializeDocumentIllegalArgumentException(&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_deserializeErrorInternalFailureException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InternalFailureException{} + 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_deserializeDocumentInternalFailureException(&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_deserializeErrorInvalidArgumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InvalidArgumentException{} + 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_deserializeDocumentInvalidArgumentException(&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_deserializeErrorInvalidNumericDataException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InvalidNumericDataException{} + 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_deserializeDocumentInvalidNumericDataException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InvalidParameterException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentInvalidParameterException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorLoadUrlAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.LoadUrlAccessDeniedException{} + 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_deserializeDocumentLoadUrlAccessDeniedException(&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_deserializeErrorMalformedQueryException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.MalformedQueryException{} + 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_deserializeDocumentMalformedQueryException(&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_deserializeErrorMemoryLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.MemoryLimitExceededException{} + 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_deserializeDocumentMemoryLimitExceededException(&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_deserializeErrorMethodNotAllowedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.MethodNotAllowedException{} + 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_deserializeDocumentMethodNotAllowedException(&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_deserializeErrorMissingParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.MissingParameterException{} + 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_deserializeDocumentMissingParameterException(&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_deserializeErrorMLResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.MLResourceNotFoundException{} + 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_deserializeDocumentMLResourceNotFoundException(&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_deserializeErrorParsingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ParsingException{} + 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_deserializeDocumentParsingException(&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_deserializeErrorPreconditionsFailedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.PreconditionsFailedException{} + 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_deserializeDocumentPreconditionsFailedException(&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_deserializeErrorQueryLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.QueryLimitExceededException{} + 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_deserializeDocumentQueryLimitExceededException(&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_deserializeErrorQueryLimitException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.QueryLimitException{} + 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_deserializeDocumentQueryLimitException(&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_deserializeErrorQueryTooLargeException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.QueryTooLargeException{} + 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_deserializeDocumentQueryTooLargeException(&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_deserializeErrorReadOnlyViolationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ReadOnlyViolationException{} + 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_deserializeDocumentReadOnlyViolationException(&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_deserializeErrorS3Exception(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.S3Exception{} + 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_deserializeDocumentS3Exception(&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_deserializeErrorServerShutdownException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ServerShutdownException{} + 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_deserializeDocumentServerShutdownException(&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_deserializeErrorStatisticsNotAvailableException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.StatisticsNotAvailableException{} + 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_deserializeDocumentStatisticsNotAvailableException(&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_deserializeErrorStreamRecordsNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.StreamRecordsNotFoundException{} + 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_deserializeDocumentStreamRecordsNotFoundException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ThrottlingException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorTimeLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.TimeLimitExceededException{} + 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_deserializeDocumentTimeLimitExceededException(&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_deserializeErrorTooManyRequestsException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.TooManyRequestsException{} + 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_deserializeDocumentTooManyRequestsException(&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_deserializeErrorUnsupportedOperationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.UnsupportedOperationException{} + 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_deserializeDocumentUnsupportedOperationException(&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 "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentBadRequestException(v **types.BadRequestException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.BadRequestException + if *v == nil { + sv = &types.BadRequestException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentBulkLoadIdNotFoundException(v **types.BulkLoadIdNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.BulkLoadIdNotFoundException + if *v == nil { + sv = &types.BulkLoadIdNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentCancelledByUserException(v **types.CancelledByUserException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.CancelledByUserException + if *v == nil { + sv = &types.CancelledByUserException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentClasses(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_deserializeDocumentClientTimeoutException(v **types.ClientTimeoutException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ClientTimeoutException + if *v == nil { + sv = &types.ClientTimeoutException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentConcurrentModificationException(v **types.ConcurrentModificationException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ConcurrentModificationException + if *v == nil { + sv = &types.ConcurrentModificationException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentConstraintViolationException(v **types.ConstraintViolationException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ConstraintViolationException + if *v == nil { + sv = &types.ConstraintViolationException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentDeleteStatisticsValueMap(v **types.DeleteStatisticsValueMap, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DeleteStatisticsValueMap + if *v == nil { + sv = &types.DeleteStatisticsValueMap{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "active": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Active = ptr.Bool(jtv) + } + + case "statisticsId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.StatisticsId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDocumentValuedMap(v *map[string]document.Interface, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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]document.Interface + if *v == nil { + mv = map[string]document.Interface{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal document.Interface + mapVar := parsedVal + if err := awsRestjson1_deserializeDocumentDocument(&mapVar, value); err != nil { + return err + } + parsedVal = mapVar + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentEdgeLabels(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_deserializeDocumentEdgeProperties(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_deserializeDocumentEdgeStructure(v **types.EdgeStructure, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EdgeStructure + if *v == nil { + sv = &types.EdgeStructure{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "count": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Count = ptr.Int64(i64) + } + + case "edgeProperties": + if err := awsRestjson1_deserializeDocumentEdgeProperties(&sv.EdgeProperties, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEdgeStructures(v *[]types.EdgeStructure, 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.EdgeStructure + if *v == nil { + cv = []types.EdgeStructure{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.EdgeStructure + destAddr := &col + if err := awsRestjson1_deserializeDocumentEdgeStructure(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentExpiredStreamException(v **types.ExpiredStreamException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ExpiredStreamException + if *v == nil { + sv = &types.ExpiredStreamException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentFailureByQueryException(v **types.FailureByQueryException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FailureByQueryException + if *v == nil { + sv = &types.FailureByQueryException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentFastResetToken(v **types.FastResetToken, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.FastResetToken + if *v == nil { + sv = &types.FastResetToken{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "token": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Token = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGremlinQueries(v *[]types.GremlinQueryStatus, 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.GremlinQueryStatus + if *v == nil { + cv = []types.GremlinQueryStatus{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.GremlinQueryStatus + destAddr := &col + if err := awsRestjson1_deserializeDocumentGremlinQueryStatus(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentGremlinQueryStatus(v **types.GremlinQueryStatus, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GremlinQueryStatus + if *v == nil { + sv = &types.GremlinQueryStatus{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "queryEvalStats": + if err := awsRestjson1_deserializeDocumentQueryEvalStats(&sv.QueryEvalStats, value); err != nil { + return err + } + + case "queryId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.QueryId = ptr.String(jtv) + } + + case "queryString": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.QueryString = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGremlinQueryStatusAttributes(v **types.GremlinQueryStatusAttributes, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GremlinQueryStatusAttributes + if *v == nil { + sv = &types.GremlinQueryStatusAttributes{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "attributes": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Attributes, value); err != nil { + return err + } + + case "code": + 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.Code = ptr.Int32(int32(i64)) + } + + 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_deserializeDocumentIllegalArgumentException(v **types.IllegalArgumentException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.IllegalArgumentException + if *v == nil { + sv = &types.IllegalArgumentException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentInternalFailureException(v **types.InternalFailureException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.InternalFailureException + if *v == nil { + sv = &types.InternalFailureException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentInvalidArgumentException(v **types.InvalidArgumentException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.InvalidArgumentException + if *v == nil { + sv = &types.InvalidArgumentException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentInvalidNumericDataException(v **types.InvalidNumericDataException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.InvalidNumericDataException + if *v == nil { + sv = &types.InvalidNumericDataException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.InvalidParameterException + if *v == nil { + sv = &types.InvalidParameterException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentLoaderIdResult(v **types.LoaderIdResult, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.LoaderIdResult + if *v == nil { + sv = &types.LoaderIdResult{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "loadIds": + if err := awsRestjson1_deserializeDocumentStringList(&sv.LoadIds, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentLoadUrlAccessDeniedException(v **types.LoadUrlAccessDeniedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.LoadUrlAccessDeniedException + if *v == nil { + sv = &types.LoadUrlAccessDeniedException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentLongValuedMap(v *map[string]int64, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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]int64 + if *v == nil { + mv = map[string]int64{} + } else { + mv = *v + } + + for key, value := range shape { + var parsedVal int64 + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + parsedVal = i64 + } + mv[key] = parsedVal + + } + *v = mv + return nil +} + +func awsRestjson1_deserializeDocumentLongValuedMapList(v *[]map[string]int64, 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 []map[string]int64 + if *v == nil { + cv = []map[string]int64{} + } else { + cv = *v + } + + for _, value := range shape { + var col map[string]int64 + if err := awsRestjson1_deserializeDocumentLongValuedMap(&col, value); err != nil { + return err + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentMalformedQueryException(v **types.MalformedQueryException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MalformedQueryException + if *v == nil { + sv = &types.MalformedQueryException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentMemoryLimitExceededException(v **types.MemoryLimitExceededException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MemoryLimitExceededException + if *v == nil { + sv = &types.MemoryLimitExceededException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentMethodNotAllowedException(v **types.MethodNotAllowedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MethodNotAllowedException + if *v == nil { + sv = &types.MethodNotAllowedException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentMissingParameterException(v **types.MissingParameterException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MissingParameterException + if *v == nil { + sv = &types.MissingParameterException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentMlConfigDefinition(v **types.MlConfigDefinition, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MlConfigDefinition + if *v == nil { + sv = &types.MlConfigDefinition{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "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) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentMlModels(v *[]types.MlConfigDefinition, 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.MlConfigDefinition + if *v == nil { + cv = []types.MlConfigDefinition{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.MlConfigDefinition + destAddr := &col + if err := awsRestjson1_deserializeDocumentMlConfigDefinition(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentMlResourceDefinition(v **types.MlResourceDefinition, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MlResourceDefinition + if *v == nil { + sv = &types.MlResourceDefinition{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "cloudwatchLogUrl": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.CloudwatchLogUrl = ptr.String(jtv) + } + + case "failureReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.FailureReason = ptr.String(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 "outputLocation": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.OutputLocation = ptr.String(jtv) + } + + case "status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Status = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentMLResourceNotFoundException(v **types.MLResourceNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.MLResourceNotFoundException + if *v == nil { + sv = &types.MLResourceNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentModels(v *[]types.MlConfigDefinition, 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.MlConfigDefinition + if *v == nil { + cv = []types.MlConfigDefinition{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.MlConfigDefinition + destAddr := &col + if err := awsRestjson1_deserializeDocumentMlConfigDefinition(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentNodeLabels(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_deserializeDocumentNodeProperties(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_deserializeDocumentNodeStructure(v **types.NodeStructure, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.NodeStructure + if *v == nil { + sv = &types.NodeStructure{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "count": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Count = ptr.Int64(i64) + } + + case "distinctOutgoingEdgeLabels": + if err := awsRestjson1_deserializeDocumentOutgoingEdgeLabels(&sv.DistinctOutgoingEdgeLabels, value); err != nil { + return err + } + + case "nodeProperties": + if err := awsRestjson1_deserializeDocumentNodeProperties(&sv.NodeProperties, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentNodeStructures(v *[]types.NodeStructure, 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.NodeStructure + if *v == nil { + cv = []types.NodeStructure{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.NodeStructure + destAddr := &col + if err := awsRestjson1_deserializeDocumentNodeStructure(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentOpenCypherQueries(v *[]types.GremlinQueryStatus, 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.GremlinQueryStatus + if *v == nil { + cv = []types.GremlinQueryStatus{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.GremlinQueryStatus + destAddr := &col + if err := awsRestjson1_deserializeDocumentGremlinQueryStatus(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentOutgoingEdgeLabels(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_deserializeDocumentParsingException(v **types.ParsingException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ParsingException + if *v == nil { + sv = &types.ParsingException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentPreconditionsFailedException(v **types.PreconditionsFailedException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PreconditionsFailedException + if *v == nil { + sv = &types.PreconditionsFailedException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentPredicates(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_deserializeDocumentPropertygraphData(v **types.PropertygraphData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PropertygraphData + if *v == nil { + sv = &types.PropertygraphData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "from": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.From = ptr.String(jtv) + } + + case "id": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Id = ptr.String(jtv) + } + + case "key": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Key = ptr.String(jtv) + } + + case "to": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.To = ptr.String(jtv) + } + + case "type": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Type = ptr.String(jtv) + } + + case "value": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Value, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPropertygraphRecord(v **types.PropertygraphRecord, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PropertygraphRecord + if *v == nil { + sv = &types.PropertygraphRecord{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "commitTimestamp": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.CommitTimestampInMillis = ptr.Int64(i64) + } + + case "data": + if err := awsRestjson1_deserializeDocumentPropertygraphData(&sv.Data, value); err != nil { + return err + } + + case "eventId": + if err := awsRestjson1_deserializeDocumentStringValuedMap(&sv.EventId, value); err != nil { + return err + } + + case "isLastOp": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IsLastOp = ptr.Bool(jtv) + } + + case "op": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Op = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPropertygraphRecordsList(v *[]types.PropertygraphRecord, 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.PropertygraphRecord + if *v == nil { + cv = []types.PropertygraphRecord{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.PropertygraphRecord + destAddr := &col + if err := awsRestjson1_deserializeDocumentPropertygraphRecord(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentPropertygraphSummary(v **types.PropertygraphSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PropertygraphSummary + if *v == nil { + sv = &types.PropertygraphSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "edgeLabels": + if err := awsRestjson1_deserializeDocumentEdgeLabels(&sv.EdgeLabels, value); err != nil { + return err + } + + case "edgeProperties": + if err := awsRestjson1_deserializeDocumentLongValuedMapList(&sv.EdgeProperties, value); err != nil { + return err + } + + case "edgeStructures": + if err := awsRestjson1_deserializeDocumentEdgeStructures(&sv.EdgeStructures, value); err != nil { + return err + } + + case "nodeLabels": + if err := awsRestjson1_deserializeDocumentNodeLabels(&sv.NodeLabels, value); err != nil { + return err + } + + case "nodeProperties": + if err := awsRestjson1_deserializeDocumentLongValuedMapList(&sv.NodeProperties, value); err != nil { + return err + } + + case "nodeStructures": + if err := awsRestjson1_deserializeDocumentNodeStructures(&sv.NodeStructures, value); err != nil { + return err + } + + case "numEdgeLabels": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumEdgeLabels = ptr.Int64(i64) + } + + case "numEdgeProperties": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumEdgeProperties = ptr.Int64(i64) + } + + case "numEdges": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumEdges = ptr.Int64(i64) + } + + case "numNodeLabels": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumNodeLabels = ptr.Int64(i64) + } + + case "numNodeProperties": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumNodeProperties = ptr.Int64(i64) + } + + case "numNodes": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumNodes = ptr.Int64(i64) + } + + case "totalEdgePropertyValues": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.TotalEdgePropertyValues = ptr.Int64(i64) + } + + case "totalNodePropertyValues": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.TotalNodePropertyValues = ptr.Int64(i64) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPropertygraphSummaryValueMap(v **types.PropertygraphSummaryValueMap, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PropertygraphSummaryValueMap + if *v == nil { + sv = &types.PropertygraphSummaryValueMap{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "graphSummary": + if err := awsRestjson1_deserializeDocumentPropertygraphSummary(&sv.GraphSummary, value); err != nil { + return err + } + + case "lastStatisticsComputationTime": + 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.LastStatisticsComputationTime = ptr.Time(t) + } + + case "version": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Version = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQueryEvalStats(v **types.QueryEvalStats, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QueryEvalStats + if *v == nil { + sv = &types.QueryEvalStats{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "cancelled": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Cancelled = ptr.Bool(jtv) + } + + case "elapsed": + 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.Elapsed = ptr.Int32(int32(i64)) + } + + case "subqueries": + if err := awsRestjson1_deserializeDocumentDocument(&sv.Subqueries, value); err != nil { + return err + } + + case "waited": + 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.Waited = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQueryLanguageVersion(v **types.QueryLanguageVersion, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QueryLanguageVersion + if *v == nil { + sv = &types.QueryLanguageVersion{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "version": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Version = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentQueryLimitExceededException(v **types.QueryLimitExceededException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QueryLimitExceededException + if *v == nil { + sv = &types.QueryLimitExceededException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentQueryLimitException(v **types.QueryLimitException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QueryLimitException + if *v == nil { + sv = &types.QueryLimitException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentQueryTooLargeException(v **types.QueryTooLargeException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.QueryTooLargeException + if *v == nil { + sv = &types.QueryTooLargeException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentRDFGraphSummary(v **types.RDFGraphSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RDFGraphSummary + if *v == nil { + sv = &types.RDFGraphSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "classes": + if err := awsRestjson1_deserializeDocumentClasses(&sv.Classes, value); err != nil { + return err + } + + case "numClasses": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumClasses = ptr.Int64(i64) + } + + case "numDistinctPredicates": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumDistinctPredicates = ptr.Int64(i64) + } + + case "numDistinctSubjects": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumDistinctSubjects = ptr.Int64(i64) + } + + case "numQuads": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.NumQuads = ptr.Int64(i64) + } + + case "predicates": + if err := awsRestjson1_deserializeDocumentLongValuedMapList(&sv.Predicates, value); err != nil { + return err + } + + case "subjectStructures": + if err := awsRestjson1_deserializeDocumentSubjectStructures(&sv.SubjectStructures, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRDFGraphSummaryValueMap(v **types.RDFGraphSummaryValueMap, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RDFGraphSummaryValueMap + if *v == nil { + sv = &types.RDFGraphSummaryValueMap{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "graphSummary": + if err := awsRestjson1_deserializeDocumentRDFGraphSummary(&sv.GraphSummary, value); err != nil { + return err + } + + case "lastStatisticsComputationTime": + 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.LastStatisticsComputationTime = ptr.Time(t) + } + + case "version": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Version = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentReadOnlyViolationException(v **types.ReadOnlyViolationException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ReadOnlyViolationException + if *v == nil { + sv = &types.ReadOnlyViolationException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentRefreshStatisticsIdMap(v **types.RefreshStatisticsIdMap, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.RefreshStatisticsIdMap + if *v == nil { + sv = &types.RefreshStatisticsIdMap{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "statisticsId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.StatisticsId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentS3Exception(v **types.S3Exception, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.S3Exception + if *v == nil { + sv = &types.S3Exception{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentServerShutdownException(v **types.ServerShutdownException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ServerShutdownException + if *v == nil { + sv = &types.ServerShutdownException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentSparqlData(v **types.SparqlData, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SparqlData + if *v == nil { + sv = &types.SparqlData{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "stmt": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Stmt = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSparqlRecord(v **types.SparqlRecord, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SparqlRecord + if *v == nil { + sv = &types.SparqlRecord{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "commitTimestamp": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.CommitTimestampInMillis = ptr.Int64(i64) + } + + case "data": + if err := awsRestjson1_deserializeDocumentSparqlData(&sv.Data, value); err != nil { + return err + } + + case "eventId": + if err := awsRestjson1_deserializeDocumentStringValuedMap(&sv.EventId, value); err != nil { + return err + } + + case "isLastOp": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IsLastOp = ptr.Bool(jtv) + } + + case "op": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Op = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSparqlRecordsList(v *[]types.SparqlRecord, 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.SparqlRecord + if *v == nil { + cv = []types.SparqlRecord{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.SparqlRecord + destAddr := &col + if err := awsRestjson1_deserializeDocumentSparqlRecord(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentStatistics(v **types.Statistics, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Statistics + if *v == nil { + sv = &types.Statistics{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "active": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Active = ptr.Bool(jtv) + } + + case "autoCompute": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.AutoCompute = ptr.Bool(jtv) + } + + case "date": + 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.Date = ptr.Time(t) + } + + case "note": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Note = ptr.String(jtv) + } + + case "signatureInfo": + if err := awsRestjson1_deserializeDocumentStatisticsSummary(&sv.SignatureInfo, value); err != nil { + return err + } + + case "statisticsId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.StatisticsId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentStatisticsNotAvailableException(v **types.StatisticsNotAvailableException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.StatisticsNotAvailableException + if *v == nil { + sv = &types.StatisticsNotAvailableException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentStatisticsSummary(v **types.StatisticsSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.StatisticsSummary + if *v == nil { + sv = &types.StatisticsSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "instanceCount": + 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.InstanceCount = ptr.Int32(int32(i64)) + } + + case "predicateCount": + 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.PredicateCount = ptr.Int32(int32(i64)) + } + + case "signatureCount": + 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.SignatureCount = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentStreamRecordsNotFoundException(v **types.StreamRecordsNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.StreamRecordsNotFoundException + if *v == nil { + sv = &types.StreamRecordsNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentStringList(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_deserializeDocumentStringValuedMap(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_deserializeDocumentSubjectStructure(v **types.SubjectStructure, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SubjectStructure + if *v == nil { + sv = &types.SubjectStructure{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "count": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Count = ptr.Int64(i64) + } + + case "predicates": + if err := awsRestjson1_deserializeDocumentPredicates(&sv.Predicates, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSubjectStructures(v *[]types.SubjectStructure, 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.SubjectStructure + if *v == nil { + cv = []types.SubjectStructure{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.SubjectStructure + destAddr := &col + if err := awsRestjson1_deserializeDocumentSubjectStructure(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ThrottlingException + if *v == nil { + sv = &types.ThrottlingException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentTimeLimitExceededException(v **types.TimeLimitExceededException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TimeLimitExceededException + if *v == nil { + sv = &types.TimeLimitExceededException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentTooManyRequestsException(v **types.TooManyRequestsException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TooManyRequestsException + if *v == nil { + sv = &types.TooManyRequestsException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentUnsupportedOperationException(v **types.UnsupportedOperationException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.UnsupportedOperationException + if *v == nil { + sv = &types.UnsupportedOperationException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "code": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Code = ptr.String(jtv) + } + + case "detailedMessage": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.DetailedMessage = ptr.String(jtv) + } + + 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 +} + +func awsRestjson1_deserializeDocumentDocument(v *document.Interface, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + *v = internaldocument.NewDocumentUnmarshaler(value) + return nil +} diff --git a/service/neptunedata/doc.go b/service/neptunedata/doc.go new file mode 100644 index 00000000000..6899bf158ec --- /dev/null +++ b/service/neptunedata/doc.go @@ -0,0 +1,12 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package neptunedata provides the API client, operations, and parameter types +// for Amazon NeptuneData. +// +// Neptune Data API The Amazon Neptune data API provides SDK support for more than +// 40 of Neptune's data operations, including data loading, query execution, data +// inquiry, and machine learning. It supports all three Neptune query languages +// (Gremlin, openCypher and SPARQL), and is available in all SDK languages. It +// automatically signs API requests and greatly simplifies integrating Neptune into +// your applications. +package neptunedata diff --git a/service/neptunedata/document/doc.go b/service/neptunedata/document/doc.go new file mode 100644 index 00000000000..2b06b14f3cd --- /dev/null +++ b/service/neptunedata/document/doc.go @@ -0,0 +1,66 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package document implements encoding and decoding of open-content that has a JSON-like data model. +// This data-model allows for UTF-8 strings, arbitrary precision numbers, booleans, nulls, a list of these values, and a +// map of UTF-8 strings to these values. +// +// Interface defines the semantics for how a document type is marshalled and unmarshalled for requests and responses +// for the service. To send a document as input to the service you use NewLazyDocument and pass it the Go type to be +// sent to the service. NewLazyDocument returns a document Interface type that encodes the provided Go type during +// the request serialization step after you have invoked an API client operation that uses the document type. +// +// The following examples show how you can create document types using basic Go types. +// +// NewLazyDocument(map[string]interface{}{ +// "favoriteNumber": 42, +// "fruits": []string{"apple", "orange"}, +// "capitals": map[string]interface{}{ +// "Washington": "Olympia", +// "Oregon": "Salem", +// }, +// "skyIsBlue": true, +// }) +// +// NewLazyDocument(3.14159) +// +// NewLazyDocument([]interface{"One", 2, 3, 3.5, "four"}) +// +// NewLazyDocument(true) +// +// Services can send document types as part of their API responses. To retrieve the content of a response document +// you use the UnmarshalSmithyDocument method on the response document. When calling UnmarshalSmithyDocument you pass +// a reference to the Go type that you want to unmarshal and map the response to. +// +// For example, if you expect to receive key/value map from the service response: +// +// var kv map[string]interface{} +// if err := outputDocument.UnmarshalSmithyDocument(&kv); err != nil { +// // handle error +// } +// +// If a service can return one or more data-types in the response, you can use an empty interface and type switch to +// dynamically handle the response type. +// +// var v interface{} +// if err := outputDocument.UnmarshalSmithyDocument(&v); err != nil { +// // handle error +// } +// +// switch vv := v.(type) { +// case map[string]interface{}: +// // handle key/value map +// case []interface{}: +// // handle array of values +// case bool: +// // handle boolean +// case document.Number: +// // handle an arbitrary precision number +// case string: +// // handle string +// default: +// // handle unknown case +// } +// +// The mapping of Go types to document types is covered in more depth in https://pkg.go.dev/github.com/aws/smithy-go/document +// including more in depth examples that cover user-defined structure types. +package document diff --git a/service/neptunedata/document/document.go b/service/neptunedata/document/document.go new file mode 100644 index 00000000000..a26cda2e080 --- /dev/null +++ b/service/neptunedata/document/document.go @@ -0,0 +1,34 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package document + +import ( + internaldocument "github.com/aws/aws-sdk-go-v2/service/neptunedata/internal/document" +) + +// Interface defines a document which is a protocol-agnostic type which supports a +// JSON-like data-model. You can use this type to send UTF-8 strings, arbitrary +// precision numbers, booleans, nulls, a list of these values, and a map of UTF-8 +// strings to these values. +// +// You create a document type using the NewLazyDocument function and passing it +// the Go type to marshal. When receiving a document in an API response, you use +// the document's UnmarshalSmithyDocument function to decode the response to your +// desired Go type. Unless documented specifically generated structure types in +// client packages or client types packages are not supported at this time. Such +// types embed a noSmithyDocumentSerde and will cause an error to be returned when +// attempting to send an API request. +// +// For more information see the accompanying package documentation and linked +// references. +type Interface = internaldocument.Interface + +// You create document type using the NewLazyDocument function and passing it the +// Go type to be marshaled and sent to the service. The document marshaler supports +// semantics similar to the encoding/json Go standard library. +// +// For more information see the accompanying package documentation and linked +// references. +func NewLazyDocument(v interface{}) Interface { + return internaldocument.NewDocumentMarshaler(v) +} diff --git a/service/neptunedata/endpoints.go b/service/neptunedata/endpoints.go new file mode 100644 index 00000000000..9ce3cb4fb52 --- /dev/null +++ b/service/neptunedata/endpoints.go @@ -0,0 +1,480 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/neptunedata/internal/endpoints" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/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) +} + +// 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, +) { + if !awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + 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 { + nf := (&aws.EndpointNotFoundError{}) + if errors.As(err, &nf) { + ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, false) + return next.HandleSerialize(ctx, in) + } + 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 = "neptune-db" + } + 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 +} + +func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { + return w.awsResolver.ResolveEndpoint(ServiceID, 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 aws.EndpointResolverWithOptions that first delegates endpoint resolution to the awsResolver. +// If awsResolver returns aws.EndpointNotFoundError error, the v1 resolver middleware will swallow the error, +// and set an appropriate context flag such that fallback will occur when EndpointResolverV2 is invoked +// via its middleware. +// +// If another error (besides aws.EndpointNotFoundError) is returned, then that error will be propagated. +func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions) EndpointResolver { + var resolver aws.EndpointResolverWithOptions + + if awsResolverWithOptions != nil { + resolver = awsResolverWithOptions + } else if awsResolver != nil { + resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint) + } + + return &wrappedEndpointResolver{ + awsResolver: resolver, + } +} + +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 + } + } + +} + +func resolveEndpointResolverV2(options *Options) { + if options.EndpointResolverV2 == nil { + options.EndpointResolverV2 = NewDefaultEndpointResolverV2() + } +} + +// Utility function to aid with translating pseudo-regions to classical regions +// with the appropriate setting indicated by the pseudo-region +func mapPseudoRegion(pr string) (region string, fips aws.FIPSEndpointState) { + const fipsInfix = "-fips-" + const fipsPrefix = "fips-" + const fipsSuffix = "-fips" + + if strings.Contains(pr, fipsInfix) || + strings.Contains(pr, fipsPrefix) || + strings.Contains(pr, fipsSuffix) { + region = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll( + pr, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "") + fips = aws.FIPSEndpointStateEnabled + } else { + region = pr + } + + return region, fips +} + +// builtInParameterResolver is the interface responsible for resolving BuiltIn +// values during the sourcing of EndpointParameters +type builtInParameterResolver interface { + ResolveBuiltIns(*EndpointParameters) error +} + +// builtInResolver resolves modeled BuiltIn values using only the members defined +// below. +type builtInResolver struct { + // The AWS region used to dispatch the request. + Region string + + // Sourced BuiltIn value in a historical enabled or disabled state. + UseDualStack aws.DualStackEndpointState + + // Sourced BuiltIn value in a historical enabled or disabled state. + UseFIPS aws.FIPSEndpointState + + // Base endpoint that can potentially be modified during Endpoint resolution. + Endpoint *string +} + +// Invoked at runtime to resolve BuiltIn Values. Only resolution code specific to +// each BuiltIn value is generated. +func (b *builtInResolver) ResolveBuiltIns(params *EndpointParameters) error { + + region, _ := mapPseudoRegion(b.Region) + if len(region) == 0 { + return fmt.Errorf("Could not resolve AWS::Region") + } else { + params.Region = aws.String(region) + } + if b.UseDualStack == aws.DualStackEndpointStateEnabled { + params.UseDualStack = aws.Bool(true) + } else { + params.UseDualStack = aws.Bool(false) + } + if b.UseFIPS == aws.FIPSEndpointStateEnabled { + params.UseFIPS = aws.Bool(true) + } else { + params.UseFIPS = aws.Bool(false) + } + params.Endpoint = b.Endpoint + return nil +} + +// EndpointParameters provides the parameters that influence how endpoints are +// resolved. +type EndpointParameters struct { + // The AWS region used to dispatch the request. + // + // Parameter is + // required. + // + // AWS::Region + Region *string + + // When true, use the dual-stack endpoint. If the configured endpoint does not + // support dual-stack, dispatching the request MAY return an error. + // + // Defaults to + // false if no value is provided. + // + // AWS::UseDualStack + UseDualStack *bool + + // When true, send this request to the FIPS-compliant regional endpoint. If the + // configured endpoint does not have a FIPS compliant endpoint, dispatching the + // request will return an error. + // + // Defaults to false if no value is + // provided. + // + // AWS::UseFIPS + UseFIPS *bool + + // Override the endpoint used to send this request + // + // Parameter is + // required. + // + // SDK::Endpoint + Endpoint *string +} + +// ValidateRequired validates required parameters are set. +func (p EndpointParameters) ValidateRequired() error { + if p.UseDualStack == nil { + return fmt.Errorf("parameter UseDualStack is required") + } + + if p.UseFIPS == nil { + return fmt.Errorf("parameter UseFIPS is required") + } + + return nil +} + +// WithDefaults returns a shallow copy of EndpointParameterswith default values +// applied to members where applicable. +func (p EndpointParameters) WithDefaults() EndpointParameters { + if p.UseDualStack == nil { + p.UseDualStack = ptr.Bool(false) + } + + if p.UseFIPS == nil { + p.UseFIPS = ptr.Bool(false) + } + return p +} + +// EndpointResolverV2 provides the interface for resolving service endpoints. +type EndpointResolverV2 interface { + // ResolveEndpoint attempts to resolve the endpoint with the provided options, + // returning the endpoint if found. Otherwise an error is returned. + ResolveEndpoint(ctx context.Context, params EndpointParameters) ( + smithyendpoints.Endpoint, error, + ) +} + +// resolver provides the implementation for resolving endpoints. +type resolver struct{} + +func NewDefaultEndpointResolverV2() EndpointResolverV2 { + return &resolver{} +} + +// ResolveEndpoint attempts to resolve the endpoint with the provided options, +// returning the endpoint if found. Otherwise an error is returned. +func (r *resolver) ResolveEndpoint( + ctx context.Context, params EndpointParameters, +) ( + endpoint smithyendpoints.Endpoint, err error, +) { + params = params.WithDefaults() + if err = params.ValidateRequired(); err != nil { + return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) + } + _UseDualStack := *params.UseDualStack + _UseFIPS := *params.UseFIPS + + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if _UseFIPS == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported") + } + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported") + } + uriString := _Endpoint + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + if exprVal := params.Region; exprVal != nil { + _Region := *exprVal + _ = _Region + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _PartitionResult := *exprVal + _ = _PartitionResult + if _UseFIPS == true { + if _UseDualStack == true { + if true == _PartitionResult.SupportsFIPS { + if true == _PartitionResult.SupportsDualStack { + uriString := func() string { + var out strings.Builder + out.WriteString("https://neptune-db-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS and DualStack are enabled, but this partition does not support one or both") + } + } + if _UseFIPS == true { + if true == _PartitionResult.SupportsFIPS { + uriString := func() string { + var out strings.Builder + out.WriteString("https://neptune-db-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS") + } + if _UseDualStack == true { + if true == _PartitionResult.SupportsDualStack { + uriString := func() string { + var out strings.Builder + out.WriteString("https://neptune-db.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack") + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://neptune-db.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("Endpoint resolution failed. Invalid operation or environment input.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Missing Region") +} diff --git a/service/neptunedata/endpoints_test.go b/service/neptunedata/endpoints_test.go new file mode 100644 index 00000000000..2f7e3ff82e2 --- /dev/null +++ b/service/neptunedata/endpoints_test.go @@ -0,0 +1,856 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + smithy "github.com/aws/smithy-go" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/ptr" + "github.com/google/go-cmp/cmp" + "net/http" + "net/url" + "strings" + "testing" +) + +// For region us-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase0(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db-fips.us-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase1(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db-fips.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase2(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db.us-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase3(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region cn-north-1 with FIPS enabled and DualStack enabled +func TestEndpointCase4(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db-fips.cn-north-1.api.amazonwebservices.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region cn-north-1 with FIPS enabled and DualStack disabled +func TestEndpointCase5(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db-fips.cn-north-1.amazonaws.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region cn-north-1 with FIPS disabled and DualStack enabled +func TestEndpointCase6(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db.cn-north-1.api.amazonwebservices.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region cn-north-1 with FIPS disabled and DualStack disabled +func TestEndpointCase7(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db.cn-north-1.amazonaws.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-gov-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase8(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db-fips.us-gov-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-gov-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase9(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db-fips.us-gov-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-gov-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase10(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db.us-gov-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-gov-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase11(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db.us-gov-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-iso-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase12(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-iso-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase13(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db-fips.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-iso-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase14(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-iso-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase15(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-isob-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase16(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-isob-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase17(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db-fips.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-isob-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase18(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-isob-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase19(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://neptune-db.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For custom endpoint with region set and fips disabled and dualstack disabled +func TestEndpointCase20(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For custom endpoint with region not set and fips disabled and dualstack disabled +func TestEndpointCase21(t *testing.T) { + var params = EndpointParameters{ + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For custom endpoint with fips enabled and dualstack disabled +func TestEndpointCase22(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: FIPS and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For custom endpoint with fips disabled and dualstack enabled +func TestEndpointCase23(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: Dualstack and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// Missing region +func TestEndpointCase24(t *testing.T) { + var params = EndpointParameters{} + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: Missing Region", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} diff --git a/service/neptunedata/generated.json b/service/neptunedata/generated.json new file mode 100644 index 00000000000..4282660fe3b --- /dev/null +++ b/service/neptunedata/generated.json @@ -0,0 +1,76 @@ +{ + "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", + "github.com/google/go-cmp": "v0.5.4" + }, + "files": [ + "api_client.go", + "api_client_test.go", + "api_op_CancelGremlinQuery.go", + "api_op_CancelLoaderJob.go", + "api_op_CancelMLDataProcessingJob.go", + "api_op_CancelMLModelTrainingJob.go", + "api_op_CancelMLModelTransformJob.go", + "api_op_CancelOpenCypherQuery.go", + "api_op_CreateMLEndpoint.go", + "api_op_DeleteMLEndpoint.go", + "api_op_DeletePropertygraphStatistics.go", + "api_op_DeleteSparqlStatistics.go", + "api_op_ExecuteFastReset.go", + "api_op_ExecuteGremlinExplainQuery.go", + "api_op_ExecuteGremlinProfileQuery.go", + "api_op_ExecuteGremlinQuery.go", + "api_op_ExecuteOpenCypherExplainQuery.go", + "api_op_ExecuteOpenCypherQuery.go", + "api_op_GetEngineStatus.go", + "api_op_GetGremlinQueryStatus.go", + "api_op_GetLoaderJobStatus.go", + "api_op_GetMLDataProcessingJob.go", + "api_op_GetMLEndpoint.go", + "api_op_GetMLModelTrainingJob.go", + "api_op_GetMLModelTransformJob.go", + "api_op_GetOpenCypherQueryStatus.go", + "api_op_GetPropertygraphStatistics.go", + "api_op_GetPropertygraphStream.go", + "api_op_GetPropertygraphSummary.go", + "api_op_GetRDFGraphSummary.go", + "api_op_GetSparqlStatistics.go", + "api_op_GetSparqlStream.go", + "api_op_ListGremlinQueries.go", + "api_op_ListLoaderJobs.go", + "api_op_ListMLDataProcessingJobs.go", + "api_op_ListMLEndpoints.go", + "api_op_ListMLModelTrainingJobs.go", + "api_op_ListMLModelTransformJobs.go", + "api_op_ListOpenCypherQueries.go", + "api_op_ManagePropertygraphStatistics.go", + "api_op_ManageSparqlStatistics.go", + "api_op_StartLoaderJob.go", + "api_op_StartMLDataProcessingJob.go", + "api_op_StartMLModelTrainingJob.go", + "api_op_StartMLModelTransformJob.go", + "deserializers.go", + "doc.go", + "document/doc.go", + "document/document.go", + "endpoints.go", + "endpoints_test.go", + "generated.json", + "internal/document/document.go", + "internal/document/document_test.go", + "internal/endpoints/endpoints.go", + "internal/endpoints/endpoints_test.go", + "protocol_test.go", + "serializers.go", + "types/enums.go", + "types/errors.go", + "types/types.go", + "validators.go" + ], + "go": "1.15", + "module": "github.com/aws/aws-sdk-go-v2/service/neptunedata", + "unstable": false +} diff --git a/service/neptunedata/go.mod b/service/neptunedata/go.mod new file mode 100644 index 00000000000..ecc2b51c905 --- /dev/null +++ b/service/neptunedata/go.mod @@ -0,0 +1,17 @@ +module github.com/aws/aws-sdk-go-v2/service/neptunedata + +go 1.15 + +require ( + github.com/aws/aws-sdk-go-v2 v1.21.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 + github.com/aws/smithy-go v1.14.2 + github.com/google/go-cmp v0.5.8 +) + +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/neptunedata/go.sum b/service/neptunedata/go.sum new file mode 100644 index 00000000000..0f594455d92 --- /dev/null +++ b/service/neptunedata/go.sum @@ -0,0 +1,11 @@ +github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= +github.com/aws/smithy-go v1.14.2/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/neptunedata/go_module_metadata.go b/service/neptunedata/go_module_metadata.go new file mode 100644 index 00000000000..b8be76c3d1b --- /dev/null +++ b/service/neptunedata/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package neptunedata + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/neptunedata/internal/document/document.go b/service/neptunedata/internal/document/document.go new file mode 100644 index 00000000000..54950609052 --- /dev/null +++ b/service/neptunedata/internal/document/document.go @@ -0,0 +1,99 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package document + +import ( + "bytes" + "encoding/json" + smithydocument "github.com/aws/smithy-go/document" + smithydocumentjson "github.com/aws/smithy-go/document/json" +) + +// github.com/aws/aws-sdk-go-v2/service/neptunedata/internal/document.smithyDocument +// is an interface which is used to bind a document type to its service client. +type smithyDocument interface { + isSmithyDocument() +} + +// github.com/aws/aws-sdk-go-v2/service/neptunedata/internal/document.Interface is +// a JSON-like data model type that is protocol agnostic and is usedto send +// open-content to a service. +type Interface interface { + smithyDocument + smithydocument.Marshaler + smithydocument.Unmarshaler +} + +type documentMarshaler struct { + value interface{} +} + +func (m *documentMarshaler) UnmarshalSmithyDocument(v interface{}) error { + mBytes, err := m.MarshalSmithyDocument() + if err != nil { + return err + } + + jDecoder := json.NewDecoder(bytes.NewReader(mBytes)) + jDecoder.UseNumber() + + var jv interface{} + if err := jDecoder.Decode(&v); err != nil { + return err + } + + return NewDocumentUnmarshaler(v).UnmarshalSmithyDocument(&jv) +} + +func (m *documentMarshaler) MarshalSmithyDocument() ([]byte, error) { + return smithydocumentjson.NewEncoder().Encode(m.value) +} + +func (m *documentMarshaler) isSmithyDocument() {} + +var _ Interface = (*documentMarshaler)(nil) + +type documentUnmarshaler struct { + value interface{} +} + +func (m *documentUnmarshaler) UnmarshalSmithyDocument(v interface{}) error { + decoder := smithydocumentjson.NewDecoder() + return decoder.DecodeJSONInterface(m.value, v) +} + +func (m *documentUnmarshaler) MarshalSmithyDocument() ([]byte, error) { + return json.Marshal(m.value) +} + +func (m *documentUnmarshaler) isSmithyDocument() {} + +var _ Interface = (*documentUnmarshaler)(nil) + +// NewDocumentMarshaler creates a new document marshaler for the given input type +func NewDocumentMarshaler(v interface{}) Interface { + return &documentMarshaler{ + value: v, + } +} + +// NewDocumentUnmarshaler creates a new document unmarshaler for the given service +// response +func NewDocumentUnmarshaler(v interface{}) Interface { + return &documentUnmarshaler{ + value: v, + } +} + +// github.com/aws/aws-sdk-go-v2/service/neptunedata/internal/document.IsInterface +// returns whether the given Interface implementation is a valid client +// implementation +func IsInterface(v Interface) (ok bool) { + defer func() { + if err := recover(); err != nil { + ok = false + } + }() + v.isSmithyDocument() + return true +} diff --git a/service/neptunedata/internal/document/document_test.go b/service/neptunedata/internal/document/document_test.go new file mode 100644 index 00000000000..775645dcd6e --- /dev/null +++ b/service/neptunedata/internal/document/document_test.go @@ -0,0 +1,11 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package document + +import ( + smithydocument "github.com/aws/smithy-go/document" +) + +var _ smithyDocument = (Interface)(nil) +var _ smithydocument.Marshaler = (Interface)(nil) +var _ smithydocument.Unmarshaler = (Interface)(nil) diff --git a/service/neptunedata/internal/endpoints/endpoints.go b/service/neptunedata/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..39b1cef0f2e --- /dev/null +++ b/service/neptunedata/internal/endpoints/endpoints.go @@ -0,0 +1,296 @@ +// 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 neptunedata endpoint resolver +type Resolver struct { + partitions endpoints.Partitions +} + +// ResolveEndpoint resolves the service endpoint for the given region and options +func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) { + if len(region) == 0 { + return endpoint, &aws.MissingRegionError{} + } + + opt := transformToSharedOptions(options) + return r.partitions.ResolveEndpoint(region, opt) +} + +// New returns a new Resolver +func New() *Resolver { + return &Resolver{ + partitions: defaultPartitions, + } +} + +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsIsoE *regexp.Regexp + AwsIsoF *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"), + AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + +var defaultPartitions = endpoints.Partitions{ + { + ID: "aws", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "neptune-db.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "neptune-db-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "neptune-db-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "neptune-db.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.Aws, + IsRegionalized: true, + }, + { + ID: "aws-cn", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "neptune-db.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "neptune-db-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "neptune-db-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "neptune-db.{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: "neptune-db-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "neptune-db.{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: "neptune-db-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "neptune-db.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoB, + IsRegionalized: true, + }, + { + ID: "aws-iso-e", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "neptune-db-fips.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "neptune-db.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoE, + IsRegionalized: true, + }, + { + ID: "aws-iso-f", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "neptune-db-fips.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "neptune-db.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoF, + IsRegionalized: true, + }, + { + ID: "aws-us-gov", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "neptune-db.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "neptune-db-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "neptune-db-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "neptune-db.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + }, +} diff --git a/service/neptunedata/internal/endpoints/endpoints_test.go b/service/neptunedata/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/neptunedata/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/neptunedata/protocol_test.go b/service/neptunedata/protocol_test.go new file mode 100644 index 00000000000..df3ed7895c5 --- /dev/null +++ b/service/neptunedata/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata diff --git a/service/neptunedata/serializers.go b/service/neptunedata/serializers.go new file mode 100644 index 00000000000..169849b6af5 --- /dev/null +++ b/service/neptunedata/serializers.go @@ -0,0 +1,3387 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/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_serializeOpCancelGremlinQuery struct { +} + +func (*awsRestjson1_serializeOpCancelGremlinQuery) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCancelGremlinQuery) 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.(*CancelGremlinQueryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/gremlin/status/{queryId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsCancelGremlinQueryInput(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_serializeOpHttpBindingsCancelGremlinQueryInput(v *CancelGremlinQueryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.QueryId == nil || len(*v.QueryId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member queryId must not be empty")} + } + if v.QueryId != nil { + if err := encoder.SetURI("queryId").String(*v.QueryId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCancelLoaderJob struct { +} + +func (*awsRestjson1_serializeOpCancelLoaderJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCancelLoaderJob) 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.(*CancelLoaderJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/loader/{loadId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsCancelLoaderJobInput(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_serializeOpHttpBindingsCancelLoaderJobInput(v *CancelLoaderJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.LoadId == nil || len(*v.LoadId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member loadId must not be empty")} + } + if v.LoadId != nil { + if err := encoder.SetURI("loadId").String(*v.LoadId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCancelMLDataProcessingJob struct { +} + +func (*awsRestjson1_serializeOpCancelMLDataProcessingJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCancelMLDataProcessingJob) 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.(*CancelMLDataProcessingJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/dataprocessing/{id}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsCancelMLDataProcessingJobInput(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_serializeOpHttpBindingsCancelMLDataProcessingJobInput(v *CancelMLDataProcessingJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Clean != nil { + encoder.SetQuery("clean").Boolean(*v.Clean) + } + + if v.Id == nil || len(*v.Id) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member id must not be empty")} + } + if v.Id != nil { + if err := encoder.SetURI("id").String(*v.Id); err != nil { + return err + } + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpCancelMLModelTrainingJob struct { +} + +func (*awsRestjson1_serializeOpCancelMLModelTrainingJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCancelMLModelTrainingJob) 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.(*CancelMLModelTrainingJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/modeltraining/{id}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsCancelMLModelTrainingJobInput(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_serializeOpHttpBindingsCancelMLModelTrainingJobInput(v *CancelMLModelTrainingJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Clean != nil { + encoder.SetQuery("clean").Boolean(*v.Clean) + } + + if v.Id == nil || len(*v.Id) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member id must not be empty")} + } + if v.Id != nil { + if err := encoder.SetURI("id").String(*v.Id); err != nil { + return err + } + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpCancelMLModelTransformJob struct { +} + +func (*awsRestjson1_serializeOpCancelMLModelTransformJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCancelMLModelTransformJob) 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.(*CancelMLModelTransformJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/modeltransform/{id}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsCancelMLModelTransformJobInput(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_serializeOpHttpBindingsCancelMLModelTransformJobInput(v *CancelMLModelTransformJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Clean != nil { + encoder.SetQuery("clean").Boolean(*v.Clean) + } + + if v.Id == nil || len(*v.Id) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member id must not be empty")} + } + if v.Id != nil { + if err := encoder.SetURI("id").String(*v.Id); err != nil { + return err + } + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpCancelOpenCypherQuery struct { +} + +func (*awsRestjson1_serializeOpCancelOpenCypherQuery) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCancelOpenCypherQuery) 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.(*CancelOpenCypherQueryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/opencypher/status/{queryId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsCancelOpenCypherQueryInput(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_serializeOpHttpBindingsCancelOpenCypherQueryInput(v *CancelOpenCypherQueryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.QueryId == nil || len(*v.QueryId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member queryId must not be empty")} + } + if v.QueryId != nil { + if err := encoder.SetURI("queryId").String(*v.QueryId); err != nil { + return err + } + } + + if v.Silent != nil { + encoder.SetQuery("silent").Boolean(*v.Silent) + } + + return nil +} + +type awsRestjson1_serializeOpCreateMLEndpoint struct { +} + +func (*awsRestjson1_serializeOpCreateMLEndpoint) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateMLEndpoint) 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.(*CreateMLEndpointInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/endpoints") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentCreateMLEndpointInput(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_serializeOpHttpBindingsCreateMLEndpointInput(v *CreateMLEndpointInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateMLEndpointInput(v *CreateMLEndpointInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Id != nil { + ok := object.Key("id") + ok.String(*v.Id) + } + + if v.InstanceCount != nil { + ok := object.Key("instanceCount") + ok.Integer(*v.InstanceCount) + } + + if v.InstanceType != nil { + ok := object.Key("instanceType") + ok.String(*v.InstanceType) + } + + if v.MlModelTrainingJobId != nil { + ok := object.Key("mlModelTrainingJobId") + ok.String(*v.MlModelTrainingJobId) + } + + if v.MlModelTransformJobId != nil { + ok := object.Key("mlModelTransformJobId") + ok.String(*v.MlModelTransformJobId) + } + + if v.ModelName != nil { + ok := object.Key("modelName") + ok.String(*v.ModelName) + } + + if v.NeptuneIamRoleArn != nil { + ok := object.Key("neptuneIamRoleArn") + ok.String(*v.NeptuneIamRoleArn) + } + + if v.Update != nil { + ok := object.Key("update") + ok.Boolean(*v.Update) + } + + if v.VolumeEncryptionKMSKey != nil { + ok := object.Key("volumeEncryptionKMSKey") + ok.String(*v.VolumeEncryptionKMSKey) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteMLEndpoint struct { +} + +func (*awsRestjson1_serializeOpDeleteMLEndpoint) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteMLEndpoint) 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.(*DeleteMLEndpointInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/endpoints/{id}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsDeleteMLEndpointInput(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_serializeOpHttpBindingsDeleteMLEndpointInput(v *DeleteMLEndpointInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Clean != nil { + encoder.SetQuery("clean").Boolean(*v.Clean) + } + + if v.Id == nil || len(*v.Id) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member id must not be empty")} + } + if v.Id != nil { + if err := encoder.SetURI("id").String(*v.Id); err != nil { + return err + } + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpDeletePropertygraphStatistics struct { +} + +func (*awsRestjson1_serializeOpDeletePropertygraphStatistics) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeletePropertygraphStatistics) 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.(*DeletePropertygraphStatisticsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/propertygraph/statistics") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsDeletePropertygraphStatisticsInput(v *DeletePropertygraphStatisticsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteSparqlStatistics struct { +} + +func (*awsRestjson1_serializeOpDeleteSparqlStatistics) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteSparqlStatistics) 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.(*DeleteSparqlStatisticsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/sparql/statistics") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsDeleteSparqlStatisticsInput(v *DeleteSparqlStatisticsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpExecuteFastReset struct { +} + +func (*awsRestjson1_serializeOpExecuteFastReset) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpExecuteFastReset) 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.(*ExecuteFastResetInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/system") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentExecuteFastResetInput(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_serializeOpHttpBindingsExecuteFastResetInput(v *ExecuteFastResetInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentExecuteFastResetInput(v *ExecuteFastResetInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Action) > 0 { + ok := object.Key("action") + ok.String(string(v.Action)) + } + + if v.Token != nil { + ok := object.Key("token") + ok.String(*v.Token) + } + + return nil +} + +type awsRestjson1_serializeOpExecuteGremlinExplainQuery struct { +} + +func (*awsRestjson1_serializeOpExecuteGremlinExplainQuery) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpExecuteGremlinExplainQuery) 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.(*ExecuteGremlinExplainQueryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/gremlin/explain") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentExecuteGremlinExplainQueryInput(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_serializeOpHttpBindingsExecuteGremlinExplainQueryInput(v *ExecuteGremlinExplainQueryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentExecuteGremlinExplainQueryInput(v *ExecuteGremlinExplainQueryInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.GremlinQuery != nil { + ok := object.Key("gremlin") + ok.String(*v.GremlinQuery) + } + + return nil +} + +type awsRestjson1_serializeOpExecuteGremlinProfileQuery struct { +} + +func (*awsRestjson1_serializeOpExecuteGremlinProfileQuery) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpExecuteGremlinProfileQuery) 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.(*ExecuteGremlinProfileQueryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/gremlin/profile") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentExecuteGremlinProfileQueryInput(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_serializeOpHttpBindingsExecuteGremlinProfileQueryInput(v *ExecuteGremlinProfileQueryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentExecuteGremlinProfileQueryInput(v *ExecuteGremlinProfileQueryInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Chop != nil { + ok := object.Key("profile.chop") + ok.Integer(*v.Chop) + } + + if v.GremlinQuery != nil { + ok := object.Key("gremlin") + ok.String(*v.GremlinQuery) + } + + if v.IndexOps != nil { + ok := object.Key("profile.indexOps") + ok.Boolean(*v.IndexOps) + } + + if v.Results != nil { + ok := object.Key("profile.results") + ok.Boolean(*v.Results) + } + + if v.Serializer != nil { + ok := object.Key("profile.serializer") + ok.String(*v.Serializer) + } + + return nil +} + +type awsRestjson1_serializeOpExecuteGremlinQuery struct { +} + +func (*awsRestjson1_serializeOpExecuteGremlinQuery) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpExecuteGremlinQuery) 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.(*ExecuteGremlinQueryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/gremlin") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsExecuteGremlinQueryInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentExecuteGremlinQueryInput(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_serializeOpHttpBindingsExecuteGremlinQueryInput(v *ExecuteGremlinQueryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Serializer != nil && len(*v.Serializer) > 0 { + locationName := "Accept" + encoder.SetHeader(locationName).String(*v.Serializer) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentExecuteGremlinQueryInput(v *ExecuteGremlinQueryInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.GremlinQuery != nil { + ok := object.Key("gremlin") + ok.String(*v.GremlinQuery) + } + + return nil +} + +type awsRestjson1_serializeOpExecuteOpenCypherExplainQuery struct { +} + +func (*awsRestjson1_serializeOpExecuteOpenCypherExplainQuery) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpExecuteOpenCypherExplainQuery) 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.(*ExecuteOpenCypherExplainQueryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/opencypher/explain") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentExecuteOpenCypherExplainQueryInput(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_serializeOpHttpBindingsExecuteOpenCypherExplainQueryInput(v *ExecuteOpenCypherExplainQueryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentExecuteOpenCypherExplainQueryInput(v *ExecuteOpenCypherExplainQueryInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.ExplainMode) > 0 { + ok := object.Key("explain") + ok.String(string(v.ExplainMode)) + } + + if v.OpenCypherQuery != nil { + ok := object.Key("query") + ok.String(*v.OpenCypherQuery) + } + + if v.Parameters != nil { + ok := object.Key("parameters") + ok.String(*v.Parameters) + } + + return nil +} + +type awsRestjson1_serializeOpExecuteOpenCypherQuery struct { +} + +func (*awsRestjson1_serializeOpExecuteOpenCypherQuery) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpExecuteOpenCypherQuery) 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.(*ExecuteOpenCypherQueryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/opencypher") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentExecuteOpenCypherQueryInput(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_serializeOpHttpBindingsExecuteOpenCypherQueryInput(v *ExecuteOpenCypherQueryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentExecuteOpenCypherQueryInput(v *ExecuteOpenCypherQueryInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.OpenCypherQuery != nil { + ok := object.Key("query") + ok.String(*v.OpenCypherQuery) + } + + if v.Parameters != nil { + ok := object.Key("parameters") + ok.String(*v.Parameters) + } + + return nil +} + +type awsRestjson1_serializeOpGetEngineStatus struct { +} + +func (*awsRestjson1_serializeOpGetEngineStatus) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetEngineStatus) 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.(*GetEngineStatusInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/status") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsGetEngineStatusInput(v *GetEngineStatusInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpGetGremlinQueryStatus struct { +} + +func (*awsRestjson1_serializeOpGetGremlinQueryStatus) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetGremlinQueryStatus) 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.(*GetGremlinQueryStatusInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/gremlin/status/{queryId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetGremlinQueryStatusInput(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_serializeOpHttpBindingsGetGremlinQueryStatusInput(v *GetGremlinQueryStatusInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.QueryId == nil || len(*v.QueryId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member queryId must not be empty")} + } + if v.QueryId != nil { + if err := encoder.SetURI("queryId").String(*v.QueryId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetLoaderJobStatus struct { +} + +func (*awsRestjson1_serializeOpGetLoaderJobStatus) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetLoaderJobStatus) 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.(*GetLoaderJobStatusInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/loader/{loadId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetLoaderJobStatusInput(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_serializeOpHttpBindingsGetLoaderJobStatusInput(v *GetLoaderJobStatusInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Details != nil { + encoder.SetQuery("details").Boolean(*v.Details) + } + + if v.Errors != nil { + encoder.SetQuery("errors").Boolean(*v.Errors) + } + + if v.ErrorsPerPage != nil { + encoder.SetQuery("errorsPerPage").Integer(*v.ErrorsPerPage) + } + + if v.LoadId == nil || len(*v.LoadId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member loadId must not be empty")} + } + if v.LoadId != nil { + if err := encoder.SetURI("loadId").String(*v.LoadId); err != nil { + return err + } + } + + if v.Page != nil { + encoder.SetQuery("page").Integer(*v.Page) + } + + return nil +} + +type awsRestjson1_serializeOpGetMLDataProcessingJob struct { +} + +func (*awsRestjson1_serializeOpGetMLDataProcessingJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetMLDataProcessingJob) 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.(*GetMLDataProcessingJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/dataprocessing/{id}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetMLDataProcessingJobInput(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_serializeOpHttpBindingsGetMLDataProcessingJobInput(v *GetMLDataProcessingJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Id == nil || len(*v.Id) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member id must not be empty")} + } + if v.Id != nil { + if err := encoder.SetURI("id").String(*v.Id); err != nil { + return err + } + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpGetMLEndpoint struct { +} + +func (*awsRestjson1_serializeOpGetMLEndpoint) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetMLEndpoint) 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.(*GetMLEndpointInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/endpoints/{id}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetMLEndpointInput(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_serializeOpHttpBindingsGetMLEndpointInput(v *GetMLEndpointInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Id == nil || len(*v.Id) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member id must not be empty")} + } + if v.Id != nil { + if err := encoder.SetURI("id").String(*v.Id); err != nil { + return err + } + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpGetMLModelTrainingJob struct { +} + +func (*awsRestjson1_serializeOpGetMLModelTrainingJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetMLModelTrainingJob) 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.(*GetMLModelTrainingJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/modeltraining/{id}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetMLModelTrainingJobInput(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_serializeOpHttpBindingsGetMLModelTrainingJobInput(v *GetMLModelTrainingJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Id == nil || len(*v.Id) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member id must not be empty")} + } + if v.Id != nil { + if err := encoder.SetURI("id").String(*v.Id); err != nil { + return err + } + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpGetMLModelTransformJob struct { +} + +func (*awsRestjson1_serializeOpGetMLModelTransformJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetMLModelTransformJob) 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.(*GetMLModelTransformJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/modeltransform/{id}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetMLModelTransformJobInput(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_serializeOpHttpBindingsGetMLModelTransformJobInput(v *GetMLModelTransformJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.Id == nil || len(*v.Id) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member id must not be empty")} + } + if v.Id != nil { + if err := encoder.SetURI("id").String(*v.Id); err != nil { + return err + } + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpGetOpenCypherQueryStatus struct { +} + +func (*awsRestjson1_serializeOpGetOpenCypherQueryStatus) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetOpenCypherQueryStatus) 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.(*GetOpenCypherQueryStatusInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/opencypher/status/{queryId}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetOpenCypherQueryStatusInput(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_serializeOpHttpBindingsGetOpenCypherQueryStatusInput(v *GetOpenCypherQueryStatusInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.QueryId == nil || len(*v.QueryId) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member queryId must not be empty")} + } + if v.QueryId != nil { + if err := encoder.SetURI("queryId").String(*v.QueryId); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetPropertygraphStatistics struct { +} + +func (*awsRestjson1_serializeOpGetPropertygraphStatistics) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetPropertygraphStatistics) 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.(*GetPropertygraphStatisticsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/propertygraph/statistics") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsGetPropertygraphStatisticsInput(v *GetPropertygraphStatisticsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpGetPropertygraphStream struct { +} + +func (*awsRestjson1_serializeOpGetPropertygraphStream) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetPropertygraphStream) 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.(*GetPropertygraphStreamInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/propertygraph/stream") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetPropertygraphStreamInput(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_serializeOpHttpBindingsGetPropertygraphStreamInput(v *GetPropertygraphStreamInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.CommitNum != nil { + encoder.SetQuery("commitNum").Long(*v.CommitNum) + } + + if len(v.Encoding) > 0 { + locationName := "Accept-Encoding" + encoder.SetHeader(locationName).String(string(v.Encoding)) + } + + if len(v.IteratorType) > 0 { + encoder.SetQuery("iteratorType").String(string(v.IteratorType)) + } + + if v.Limit != nil { + encoder.SetQuery("limit").Long(*v.Limit) + } + + if v.OpNum != nil { + encoder.SetQuery("opNum").Long(*v.OpNum) + } + + return nil +} + +type awsRestjson1_serializeOpGetPropertygraphSummary struct { +} + +func (*awsRestjson1_serializeOpGetPropertygraphSummary) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetPropertygraphSummary) 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.(*GetPropertygraphSummaryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/propertygraph/statistics/summary") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetPropertygraphSummaryInput(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_serializeOpHttpBindingsGetPropertygraphSummaryInput(v *GetPropertygraphSummaryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if len(v.Mode) > 0 { + encoder.SetQuery("mode").String(string(v.Mode)) + } + + return nil +} + +type awsRestjson1_serializeOpGetRDFGraphSummary struct { +} + +func (*awsRestjson1_serializeOpGetRDFGraphSummary) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetRDFGraphSummary) 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.(*GetRDFGraphSummaryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/rdf/statistics/summary") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetRDFGraphSummaryInput(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_serializeOpHttpBindingsGetRDFGraphSummaryInput(v *GetRDFGraphSummaryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if len(v.Mode) > 0 { + encoder.SetQuery("mode").String(string(v.Mode)) + } + + return nil +} + +type awsRestjson1_serializeOpGetSparqlStatistics struct { +} + +func (*awsRestjson1_serializeOpGetSparqlStatistics) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetSparqlStatistics) 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.(*GetSparqlStatisticsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/sparql/statistics") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsGetSparqlStatisticsInput(v *GetSparqlStatisticsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +type awsRestjson1_serializeOpGetSparqlStream struct { +} + +func (*awsRestjson1_serializeOpGetSparqlStream) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetSparqlStream) 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.(*GetSparqlStreamInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/sparql/stream") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetSparqlStreamInput(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_serializeOpHttpBindingsGetSparqlStreamInput(v *GetSparqlStreamInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.CommitNum != nil { + encoder.SetQuery("commitNum").Long(*v.CommitNum) + } + + if len(v.Encoding) > 0 { + locationName := "Accept-Encoding" + encoder.SetHeader(locationName).String(string(v.Encoding)) + } + + if len(v.IteratorType) > 0 { + encoder.SetQuery("iteratorType").String(string(v.IteratorType)) + } + + if v.Limit != nil { + encoder.SetQuery("limit").Long(*v.Limit) + } + + if v.OpNum != nil { + encoder.SetQuery("opNum").Long(*v.OpNum) + } + + return nil +} + +type awsRestjson1_serializeOpListGremlinQueries struct { +} + +func (*awsRestjson1_serializeOpListGremlinQueries) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListGremlinQueries) 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.(*ListGremlinQueriesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/gremlin/status") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListGremlinQueriesInput(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_serializeOpHttpBindingsListGremlinQueriesInput(v *ListGremlinQueriesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.IncludeWaiting != nil { + encoder.SetQuery("includeWaiting").Boolean(*v.IncludeWaiting) + } + + return nil +} + +type awsRestjson1_serializeOpListLoaderJobs struct { +} + +func (*awsRestjson1_serializeOpListLoaderJobs) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListLoaderJobs) 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.(*ListLoaderJobsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/loader") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListLoaderJobsInput(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_serializeOpHttpBindingsListLoaderJobsInput(v *ListLoaderJobsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.IncludeQueuedLoads != nil { + encoder.SetQuery("includeQueuedLoads").Boolean(*v.IncludeQueuedLoads) + } + + if v.Limit != nil { + encoder.SetQuery("limit").Integer(*v.Limit) + } + + return nil +} + +type awsRestjson1_serializeOpListMLDataProcessingJobs struct { +} + +func (*awsRestjson1_serializeOpListMLDataProcessingJobs) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListMLDataProcessingJobs) 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.(*ListMLDataProcessingJobsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/dataprocessing") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListMLDataProcessingJobsInput(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_serializeOpHttpBindingsListMLDataProcessingJobsInput(v *ListMLDataProcessingJobsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.MaxItems != nil { + encoder.SetQuery("maxItems").Integer(*v.MaxItems) + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpListMLEndpoints struct { +} + +func (*awsRestjson1_serializeOpListMLEndpoints) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListMLEndpoints) 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.(*ListMLEndpointsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/endpoints") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListMLEndpointsInput(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_serializeOpHttpBindingsListMLEndpointsInput(v *ListMLEndpointsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.MaxItems != nil { + encoder.SetQuery("maxItems").Integer(*v.MaxItems) + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpListMLModelTrainingJobs struct { +} + +func (*awsRestjson1_serializeOpListMLModelTrainingJobs) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListMLModelTrainingJobs) 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.(*ListMLModelTrainingJobsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/modeltraining") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListMLModelTrainingJobsInput(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_serializeOpHttpBindingsListMLModelTrainingJobsInput(v *ListMLModelTrainingJobsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.MaxItems != nil { + encoder.SetQuery("maxItems").Integer(*v.MaxItems) + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpListMLModelTransformJobs struct { +} + +func (*awsRestjson1_serializeOpListMLModelTransformJobs) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListMLModelTransformJobs) 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.(*ListMLModelTransformJobsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/modeltransform") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListMLModelTransformJobsInput(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_serializeOpHttpBindingsListMLModelTransformJobsInput(v *ListMLModelTransformJobsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.MaxItems != nil { + encoder.SetQuery("maxItems").Integer(*v.MaxItems) + } + + if v.NeptuneIamRoleArn != nil { + encoder.SetQuery("neptuneIamRoleArn").String(*v.NeptuneIamRoleArn) + } + + return nil +} + +type awsRestjson1_serializeOpListOpenCypherQueries struct { +} + +func (*awsRestjson1_serializeOpListOpenCypherQueries) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListOpenCypherQueries) 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.(*ListOpenCypherQueriesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/opencypher/status") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListOpenCypherQueriesInput(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_serializeOpHttpBindingsListOpenCypherQueriesInput(v *ListOpenCypherQueriesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.IncludeWaiting != nil { + encoder.SetQuery("includeWaiting").Boolean(*v.IncludeWaiting) + } + + return nil +} + +type awsRestjson1_serializeOpManagePropertygraphStatistics struct { +} + +func (*awsRestjson1_serializeOpManagePropertygraphStatistics) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpManagePropertygraphStatistics) 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.(*ManagePropertygraphStatisticsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/propertygraph/statistics") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentManagePropertygraphStatisticsInput(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_serializeOpHttpBindingsManagePropertygraphStatisticsInput(v *ManagePropertygraphStatisticsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentManagePropertygraphStatisticsInput(v *ManagePropertygraphStatisticsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Mode) > 0 { + ok := object.Key("mode") + ok.String(string(v.Mode)) + } + + return nil +} + +type awsRestjson1_serializeOpManageSparqlStatistics struct { +} + +func (*awsRestjson1_serializeOpManageSparqlStatistics) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpManageSparqlStatistics) 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.(*ManageSparqlStatisticsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/sparql/statistics") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentManageSparqlStatisticsInput(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_serializeOpHttpBindingsManageSparqlStatisticsInput(v *ManageSparqlStatisticsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentManageSparqlStatisticsInput(v *ManageSparqlStatisticsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Mode) > 0 { + ok := object.Key("mode") + ok.String(string(v.Mode)) + } + + return nil +} + +type awsRestjson1_serializeOpStartLoaderJob struct { +} + +func (*awsRestjson1_serializeOpStartLoaderJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartLoaderJob) 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.(*StartLoaderJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/loader") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentStartLoaderJobInput(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_serializeOpHttpBindingsStartLoaderJobInput(v *StartLoaderJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartLoaderJobInput(v *StartLoaderJobInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Dependencies != nil { + ok := object.Key("dependencies") + if err := awsRestjson1_serializeDocumentStringList(v.Dependencies, ok); err != nil { + return err + } + } + + if v.FailOnError != nil { + ok := object.Key("failOnError") + ok.Boolean(*v.FailOnError) + } + + if len(v.Format) > 0 { + ok := object.Key("format") + ok.String(string(v.Format)) + } + + if v.IamRoleArn != nil { + ok := object.Key("iamRoleArn") + ok.String(*v.IamRoleArn) + } + + if len(v.Mode) > 0 { + ok := object.Key("mode") + ok.String(string(v.Mode)) + } + + if len(v.Parallelism) > 0 { + ok := object.Key("parallelism") + ok.String(string(v.Parallelism)) + } + + if v.ParserConfiguration != nil { + ok := object.Key("parserConfiguration") + if err := awsRestjson1_serializeDocumentStringValuedMap(v.ParserConfiguration, ok); err != nil { + return err + } + } + + if v.QueueRequest != nil { + ok := object.Key("queueRequest") + ok.Boolean(*v.QueueRequest) + } + + if len(v.S3BucketRegion) > 0 { + ok := object.Key("region") + ok.String(string(v.S3BucketRegion)) + } + + if v.Source != nil { + ok := object.Key("source") + ok.String(*v.Source) + } + + if v.UpdateSingleCardinalityProperties != nil { + ok := object.Key("updateSingleCardinalityProperties") + ok.Boolean(*v.UpdateSingleCardinalityProperties) + } + + if v.UserProvidedEdgeIds != nil { + ok := object.Key("userProvidedEdgeIds") + ok.Boolean(*v.UserProvidedEdgeIds) + } + + return nil +} + +type awsRestjson1_serializeOpStartMLDataProcessingJob struct { +} + +func (*awsRestjson1_serializeOpStartMLDataProcessingJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartMLDataProcessingJob) 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.(*StartMLDataProcessingJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/dataprocessing") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentStartMLDataProcessingJobInput(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_serializeOpHttpBindingsStartMLDataProcessingJobInput(v *StartMLDataProcessingJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartMLDataProcessingJobInput(v *StartMLDataProcessingJobInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ConfigFileName != nil { + ok := object.Key("configFileName") + ok.String(*v.ConfigFileName) + } + + if v.Id != nil { + ok := object.Key("id") + ok.String(*v.Id) + } + + if v.InputDataS3Location != nil { + ok := object.Key("inputDataS3Location") + ok.String(*v.InputDataS3Location) + } + + if v.ModelType != nil { + ok := object.Key("modelType") + ok.String(*v.ModelType) + } + + if v.NeptuneIamRoleArn != nil { + ok := object.Key("neptuneIamRoleArn") + ok.String(*v.NeptuneIamRoleArn) + } + + if v.PreviousDataProcessingJobId != nil { + ok := object.Key("previousDataProcessingJobId") + ok.String(*v.PreviousDataProcessingJobId) + } + + if v.ProcessedDataS3Location != nil { + ok := object.Key("processedDataS3Location") + ok.String(*v.ProcessedDataS3Location) + } + + if v.ProcessingInstanceType != nil { + ok := object.Key("processingInstanceType") + ok.String(*v.ProcessingInstanceType) + } + + if v.ProcessingInstanceVolumeSizeInGB != nil { + ok := object.Key("processingInstanceVolumeSizeInGB") + ok.Integer(*v.ProcessingInstanceVolumeSizeInGB) + } + + if v.ProcessingTimeOutInSeconds != nil { + ok := object.Key("processingTimeOutInSeconds") + ok.Integer(*v.ProcessingTimeOutInSeconds) + } + + if v.S3OutputEncryptionKMSKey != nil { + ok := object.Key("s3OutputEncryptionKMSKey") + ok.String(*v.S3OutputEncryptionKMSKey) + } + + if v.SagemakerIamRoleArn != nil { + ok := object.Key("sagemakerIamRoleArn") + ok.String(*v.SagemakerIamRoleArn) + } + + if v.SecurityGroupIds != nil { + ok := object.Key("securityGroupIds") + if err := awsRestjson1_serializeDocumentStringList(v.SecurityGroupIds, ok); err != nil { + return err + } + } + + if v.Subnets != nil { + ok := object.Key("subnets") + if err := awsRestjson1_serializeDocumentStringList(v.Subnets, ok); err != nil { + return err + } + } + + if v.VolumeEncryptionKMSKey != nil { + ok := object.Key("volumeEncryptionKMSKey") + ok.String(*v.VolumeEncryptionKMSKey) + } + + return nil +} + +type awsRestjson1_serializeOpStartMLModelTrainingJob struct { +} + +func (*awsRestjson1_serializeOpStartMLModelTrainingJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartMLModelTrainingJob) 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.(*StartMLModelTrainingJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/modeltraining") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentStartMLModelTrainingJobInput(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_serializeOpHttpBindingsStartMLModelTrainingJobInput(v *StartMLModelTrainingJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartMLModelTrainingJobInput(v *StartMLModelTrainingJobInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BaseProcessingInstanceType != nil { + ok := object.Key("baseProcessingInstanceType") + ok.String(*v.BaseProcessingInstanceType) + } + + if v.CustomModelTrainingParameters != nil { + ok := object.Key("customModelTrainingParameters") + if err := awsRestjson1_serializeDocumentCustomModelTrainingParameters(v.CustomModelTrainingParameters, ok); err != nil { + return err + } + } + + if v.DataProcessingJobId != nil { + ok := object.Key("dataProcessingJobId") + ok.String(*v.DataProcessingJobId) + } + + if v.EnableManagedSpotTraining != nil { + ok := object.Key("enableManagedSpotTraining") + ok.Boolean(*v.EnableManagedSpotTraining) + } + + if v.Id != nil { + ok := object.Key("id") + ok.String(*v.Id) + } + + if v.MaxHPONumberOfTrainingJobs != nil { + ok := object.Key("maxHPONumberOfTrainingJobs") + ok.Integer(*v.MaxHPONumberOfTrainingJobs) + } + + if v.MaxHPOParallelTrainingJobs != nil { + ok := object.Key("maxHPOParallelTrainingJobs") + ok.Integer(*v.MaxHPOParallelTrainingJobs) + } + + if v.NeptuneIamRoleArn != nil { + ok := object.Key("neptuneIamRoleArn") + ok.String(*v.NeptuneIamRoleArn) + } + + if v.PreviousModelTrainingJobId != nil { + ok := object.Key("previousModelTrainingJobId") + ok.String(*v.PreviousModelTrainingJobId) + } + + if v.S3OutputEncryptionKMSKey != nil { + ok := object.Key("s3OutputEncryptionKMSKey") + ok.String(*v.S3OutputEncryptionKMSKey) + } + + if v.SagemakerIamRoleArn != nil { + ok := object.Key("sagemakerIamRoleArn") + ok.String(*v.SagemakerIamRoleArn) + } + + if v.SecurityGroupIds != nil { + ok := object.Key("securityGroupIds") + if err := awsRestjson1_serializeDocumentStringList(v.SecurityGroupIds, ok); err != nil { + return err + } + } + + if v.Subnets != nil { + ok := object.Key("subnets") + if err := awsRestjson1_serializeDocumentStringList(v.Subnets, ok); err != nil { + return err + } + } + + if v.TrainingInstanceType != nil { + ok := object.Key("trainingInstanceType") + ok.String(*v.TrainingInstanceType) + } + + if v.TrainingInstanceVolumeSizeInGB != nil { + ok := object.Key("trainingInstanceVolumeSizeInGB") + ok.Integer(*v.TrainingInstanceVolumeSizeInGB) + } + + if v.TrainingTimeOutInSeconds != nil { + ok := object.Key("trainingTimeOutInSeconds") + ok.Integer(*v.TrainingTimeOutInSeconds) + } + + if v.TrainModelS3Location != nil { + ok := object.Key("trainModelS3Location") + ok.String(*v.TrainModelS3Location) + } + + if v.VolumeEncryptionKMSKey != nil { + ok := object.Key("volumeEncryptionKMSKey") + ok.String(*v.VolumeEncryptionKMSKey) + } + + return nil +} + +type awsRestjson1_serializeOpStartMLModelTransformJob struct { +} + +func (*awsRestjson1_serializeOpStartMLModelTransformJob) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpStartMLModelTransformJob) 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.(*StartMLModelTransformJobInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ml/modeltransform") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentStartMLModelTransformJobInput(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_serializeOpHttpBindingsStartMLModelTransformJobInput(v *StartMLModelTransformJobInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentStartMLModelTransformJobInput(v *StartMLModelTransformJobInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.BaseProcessingInstanceType != nil { + ok := object.Key("baseProcessingInstanceType") + ok.String(*v.BaseProcessingInstanceType) + } + + if v.BaseProcessingInstanceVolumeSizeInGB != nil { + ok := object.Key("baseProcessingInstanceVolumeSizeInGB") + ok.Integer(*v.BaseProcessingInstanceVolumeSizeInGB) + } + + if v.CustomModelTransformParameters != nil { + ok := object.Key("customModelTransformParameters") + if err := awsRestjson1_serializeDocumentCustomModelTransformParameters(v.CustomModelTransformParameters, ok); err != nil { + return err + } + } + + if v.DataProcessingJobId != nil { + ok := object.Key("dataProcessingJobId") + ok.String(*v.DataProcessingJobId) + } + + if v.Id != nil { + ok := object.Key("id") + ok.String(*v.Id) + } + + if v.MlModelTrainingJobId != nil { + ok := object.Key("mlModelTrainingJobId") + ok.String(*v.MlModelTrainingJobId) + } + + if v.ModelTransformOutputS3Location != nil { + ok := object.Key("modelTransformOutputS3Location") + ok.String(*v.ModelTransformOutputS3Location) + } + + if v.NeptuneIamRoleArn != nil { + ok := object.Key("neptuneIamRoleArn") + ok.String(*v.NeptuneIamRoleArn) + } + + if v.S3OutputEncryptionKMSKey != nil { + ok := object.Key("s3OutputEncryptionKMSKey") + ok.String(*v.S3OutputEncryptionKMSKey) + } + + if v.SagemakerIamRoleArn != nil { + ok := object.Key("sagemakerIamRoleArn") + ok.String(*v.SagemakerIamRoleArn) + } + + if v.SecurityGroupIds != nil { + ok := object.Key("securityGroupIds") + if err := awsRestjson1_serializeDocumentStringList(v.SecurityGroupIds, ok); err != nil { + return err + } + } + + if v.Subnets != nil { + ok := object.Key("subnets") + if err := awsRestjson1_serializeDocumentStringList(v.Subnets, ok); err != nil { + return err + } + } + + if v.TrainingJobName != nil { + ok := object.Key("trainingJobName") + ok.String(*v.TrainingJobName) + } + + if v.VolumeEncryptionKMSKey != nil { + ok := object.Key("volumeEncryptionKMSKey") + ok.String(*v.VolumeEncryptionKMSKey) + } + + return nil +} + +func awsRestjson1_serializeDocumentCustomModelTrainingParameters(v *types.CustomModelTrainingParameters, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.SourceS3DirectoryPath != nil { + ok := object.Key("sourceS3DirectoryPath") + ok.String(*v.SourceS3DirectoryPath) + } + + if v.TrainingEntryPointScript != nil { + ok := object.Key("trainingEntryPointScript") + ok.String(*v.TrainingEntryPointScript) + } + + if v.TransformEntryPointScript != nil { + ok := object.Key("transformEntryPointScript") + ok.String(*v.TransformEntryPointScript) + } + + return nil +} + +func awsRestjson1_serializeDocumentCustomModelTransformParameters(v *types.CustomModelTransformParameters, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.SourceS3DirectoryPath != nil { + ok := object.Key("sourceS3DirectoryPath") + ok.String(*v.SourceS3DirectoryPath) + } + + if v.TransformEntryPointScript != nil { + ok := object.Key("transformEntryPointScript") + ok.String(*v.TransformEntryPointScript) + } + + return nil +} + +func awsRestjson1_serializeDocumentStringList(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_serializeDocumentStringValuedMap(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 +} diff --git a/service/neptunedata/types/enums.go b/service/neptunedata/types/enums.go new file mode 100644 index 00000000000..5d5448df691 --- /dev/null +++ b/service/neptunedata/types/enums.go @@ -0,0 +1,246 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type Action string + +// Enum values for Action +const ( + ActionInitializeReset Action = "initiateDatabaseReset" + ActionPerformReset Action = "performDatabaseReset" +) + +// Values returns all known values for Action. 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 (Action) Values() []Action { + return []Action{ + "initiateDatabaseReset", + "performDatabaseReset", + } +} + +type Encoding string + +// Enum values for Encoding +const ( + EncodingGzip Encoding = "gzip" +) + +// Values returns all known values for Encoding. 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 (Encoding) Values() []Encoding { + return []Encoding{ + "gzip", + } +} + +type Format string + +// Enum values for Format +const ( + FormatCsv Format = "csv" + FormatOpencypher Format = "opencypher" + FormatNtriples Format = "ntriples" + FormatNquads Format = "nquads" + FormatRdfxml Format = "rdfxml" + FormatTurtle Format = "turtle" +) + +// Values returns all known values for Format. 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 (Format) Values() []Format { + return []Format{ + "csv", + "opencypher", + "ntriples", + "nquads", + "rdfxml", + "turtle", + } +} + +type GraphSummaryType string + +// Enum values for GraphSummaryType +const ( + GraphSummaryTypeBasic GraphSummaryType = "basic" + GraphSummaryTypeDetailed GraphSummaryType = "detailed" +) + +// Values returns all known values for GraphSummaryType. 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 (GraphSummaryType) Values() []GraphSummaryType { + return []GraphSummaryType{ + "basic", + "detailed", + } +} + +type IteratorType string + +// Enum values for IteratorType +const ( + IteratorTypeAtSequenceNumber IteratorType = "AT_SEQUENCE_NUMBER" + IteratorTypeAfterSequenceNumber IteratorType = "AFTER_SEQUENCE_NUMBER" + IteratorTypeTrimHorizon IteratorType = "TRIM_HORIZON" + IteratorTypeLatest IteratorType = "LATEST" +) + +// Values returns all known values for IteratorType. 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 (IteratorType) Values() []IteratorType { + return []IteratorType{ + "AT_SEQUENCE_NUMBER", + "AFTER_SEQUENCE_NUMBER", + "TRIM_HORIZON", + "LATEST", + } +} + +type Mode string + +// Enum values for Mode +const ( + ModeResume Mode = "RESUME" + ModeNew Mode = "NEW" + ModeAuto Mode = "AUTO" +) + +// Values returns all known values for Mode. 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 (Mode) Values() []Mode { + return []Mode{ + "RESUME", + "NEW", + "AUTO", + } +} + +type OpenCypherExplainMode string + +// Enum values for OpenCypherExplainMode +const ( + OpenCypherExplainModeStatic OpenCypherExplainMode = "static" + OpenCypherExplainModeDynamic OpenCypherExplainMode = "dynamic" + OpenCypherExplainModeDetails OpenCypherExplainMode = "details" +) + +// Values returns all known values for OpenCypherExplainMode. 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 (OpenCypherExplainMode) Values() []OpenCypherExplainMode { + return []OpenCypherExplainMode{ + "static", + "dynamic", + "details", + } +} + +type Parallelism string + +// Enum values for Parallelism +const ( + ParallelismLow Parallelism = "LOW" + ParallelismMedium Parallelism = "MEDIUM" + ParallelismHigh Parallelism = "HIGH" + ParallelismOversubscribe Parallelism = "OVERSUBSCRIBE" +) + +// Values returns all known values for Parallelism. 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 (Parallelism) Values() []Parallelism { + return []Parallelism{ + "LOW", + "MEDIUM", + "HIGH", + "OVERSUBSCRIBE", + } +} + +type S3BucketRegion string + +// Enum values for S3BucketRegion +const ( + S3BucketRegionUsEast1 S3BucketRegion = "us-east-1" + S3BucketRegionUsEast2 S3BucketRegion = "us-east-2" + S3BucketRegionUsWest1 S3BucketRegion = "us-west-1" + S3BucketRegionUsWest2 S3BucketRegion = "us-west-2" + S3BucketRegionCaCentral1 S3BucketRegion = "ca-central-1" + S3BucketRegionSaEast1 S3BucketRegion = "sa-east-1" + S3BucketRegionEuNorth1 S3BucketRegion = "eu-north-1" + S3BucketRegionEuWest1 S3BucketRegion = "eu-west-1" + S3BucketRegionEuWest2 S3BucketRegion = "eu-west-2" + S3BucketRegionEuWest3 S3BucketRegion = "eu-west-3" + S3BucketRegionEuCentral1 S3BucketRegion = "eu-central-1" + S3BucketRegionMeSouth1 S3BucketRegion = "me-south-1" + S3BucketRegionAfSouth1 S3BucketRegion = "af-south-1" + S3BucketRegionApEast1 S3BucketRegion = "ap-east-1" + S3BucketRegionApNortheast1 S3BucketRegion = "ap-northeast-1" + S3BucketRegionApNortheast2 S3BucketRegion = "ap-northeast-2" + S3BucketRegionApSoutheast1 S3BucketRegion = "ap-southeast-1" + S3BucketRegionApSoutheast2 S3BucketRegion = "ap-southeast-2" + S3BucketRegionApSouth1 S3BucketRegion = "ap-south-1" + S3BucketRegionCnNorth1 S3BucketRegion = "cn-north-1" + S3BucketRegionCnNorthwest1 S3BucketRegion = "cn-northwest-1" + S3BucketRegionUsGovWest1 S3BucketRegion = "us-gov-west-1" + S3BucketRegionUsGovEast1 S3BucketRegion = "us-gov-east-1" +) + +// Values returns all known values for S3BucketRegion. 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 (S3BucketRegion) Values() []S3BucketRegion { + return []S3BucketRegion{ + "us-east-1", + "us-east-2", + "us-west-1", + "us-west-2", + "ca-central-1", + "sa-east-1", + "eu-north-1", + "eu-west-1", + "eu-west-2", + "eu-west-3", + "eu-central-1", + "me-south-1", + "af-south-1", + "ap-east-1", + "ap-northeast-1", + "ap-northeast-2", + "ap-southeast-1", + "ap-southeast-2", + "ap-south-1", + "cn-north-1", + "cn-northwest-1", + "us-gov-west-1", + "us-gov-east-1", + } +} + +type StatisticsAutoGenerationMode string + +// Enum values for StatisticsAutoGenerationMode +const ( + StatisticsAutoGenerationModeDisableAutocompute StatisticsAutoGenerationMode = "disableAutoCompute" + StatisticsAutoGenerationModeEnableAutocompute StatisticsAutoGenerationMode = "enableAutoCompute" + StatisticsAutoGenerationModeRefresh StatisticsAutoGenerationMode = "refresh" +) + +// Values returns all known values for StatisticsAutoGenerationMode. 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 (StatisticsAutoGenerationMode) Values() []StatisticsAutoGenerationMode { + return []StatisticsAutoGenerationMode{ + "disableAutoCompute", + "enableAutoCompute", + "refresh", + } +} diff --git a/service/neptunedata/types/errors.go b/service/neptunedata/types/errors.go new file mode 100644 index 00000000000..8e520831bc4 --- /dev/null +++ b/service/neptunedata/types/errors.go @@ -0,0 +1,1034 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// Raised in case of an authentication or authorization failure. +type AccessDeniedException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *AccessDeniedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *AccessDeniedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *AccessDeniedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "AccessDeniedException" + } + return *e.ErrorCodeOverride +} +func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a request is submitted that cannot be processed. +type BadRequestException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *BadRequestException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *BadRequestException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *BadRequestException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "BadRequestException" + } + return *e.ErrorCodeOverride +} +func (e *BadRequestException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a specified bulk-load job ID cannot be found. +type BulkLoadIdNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *BulkLoadIdNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *BulkLoadIdNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *BulkLoadIdNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "BulkLoadIdNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *BulkLoadIdNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a user cancelled a request. +type CancelledByUserException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *CancelledByUserException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *CancelledByUserException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *CancelledByUserException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "CancelledByUserException" + } + return *e.ErrorCodeOverride +} +func (e *CancelledByUserException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when a request timed out in the client. +type ClientTimeoutException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *ClientTimeoutException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ClientTimeoutException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ClientTimeoutException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ClientTimeoutException" + } + return *e.ErrorCodeOverride +} +func (e *ClientTimeoutException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a request attempts to modify data that is concurrently being +// modified by another process. +type ConcurrentModificationException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *ConcurrentModificationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ConcurrentModificationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ConcurrentModificationException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ConcurrentModificationException" + } + return *e.ErrorCodeOverride +} +func (e *ConcurrentModificationException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when a value in a request field did not satisfy required constraints. +type ConstraintViolationException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *ConstraintViolationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ConstraintViolationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ConstraintViolationException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ConstraintViolationException" + } + return *e.ErrorCodeOverride +} +func (e *ConstraintViolationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a request attempts to access an stream that has expired. +type ExpiredStreamException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *ExpiredStreamException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ExpiredStreamException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ExpiredStreamException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ExpiredStreamException" + } + return *e.ErrorCodeOverride +} +func (e *ExpiredStreamException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a request fails. +type FailureByQueryException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *FailureByQueryException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *FailureByQueryException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *FailureByQueryException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "FailureByQueryException" + } + return *e.ErrorCodeOverride +} +func (e *FailureByQueryException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when an argument in a request is not supported. +type IllegalArgumentException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *IllegalArgumentException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *IllegalArgumentException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *IllegalArgumentException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "IllegalArgumentException" + } + return *e.ErrorCodeOverride +} +func (e *IllegalArgumentException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when the processing of the request failed unexpectedly. +type InternalFailureException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *InternalFailureException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *InternalFailureException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *InternalFailureException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "InternalFailureException" + } + return *e.ErrorCodeOverride +} +func (e *InternalFailureException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when an argument in a request has an invalid value. +type InvalidArgumentException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *InvalidArgumentException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *InvalidArgumentException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *InvalidArgumentException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "InvalidArgumentException" + } + return *e.ErrorCodeOverride +} +func (e *InvalidArgumentException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when invalid numerical data is encountered when servicing a request. +type InvalidNumericDataException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *InvalidNumericDataException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *InvalidNumericDataException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *InvalidNumericDataException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "InvalidNumericDataException" + } + return *e.ErrorCodeOverride +} +func (e *InvalidNumericDataException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a parameter value is not valid. +type InvalidParameterException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *InvalidParameterException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *InvalidParameterException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *InvalidParameterException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "InvalidParameterException" + } + return *e.ErrorCodeOverride +} +func (e *InvalidParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when access is denied to a specified load URL. +type LoadUrlAccessDeniedException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *LoadUrlAccessDeniedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *LoadUrlAccessDeniedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *LoadUrlAccessDeniedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "LoadUrlAccessDeniedException" + } + return *e.ErrorCodeOverride +} +func (e *LoadUrlAccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a query is submitted that is syntactically incorrect or does not +// pass additional validation. +type MalformedQueryException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *MalformedQueryException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *MalformedQueryException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *MalformedQueryException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "MalformedQueryException" + } + return *e.ErrorCodeOverride +} +func (e *MalformedQueryException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a request fails because of insufficient memory resources. The +// request can be retried. +type MemoryLimitExceededException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *MemoryLimitExceededException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *MemoryLimitExceededException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *MemoryLimitExceededException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "MemoryLimitExceededException" + } + return *e.ErrorCodeOverride +} +func (e *MemoryLimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when the HTTP method used by a request is not supported by the endpoint +// being used. +type MethodNotAllowedException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *MethodNotAllowedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *MethodNotAllowedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *MethodNotAllowedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "MethodNotAllowedException" + } + return *e.ErrorCodeOverride +} +func (e *MethodNotAllowedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a required parameter is missing. +type MissingParameterException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *MissingParameterException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *MissingParameterException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *MissingParameterException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "MissingParameterException" + } + return *e.ErrorCodeOverride +} +func (e *MissingParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a specified machine-learning resource could not be found. +type MLResourceNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *MLResourceNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *MLResourceNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *MLResourceNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "MLResourceNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *MLResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a parsing issue is encountered. +type ParsingException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *ParsingException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ParsingException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ParsingException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ParsingException" + } + return *e.ErrorCodeOverride +} +func (e *ParsingException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a precondition for processing a request is not satisfied. +type PreconditionsFailedException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *PreconditionsFailedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *PreconditionsFailedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *PreconditionsFailedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "PreconditionsFailedException" + } + return *e.ErrorCodeOverride +} +func (e *PreconditionsFailedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when the number of active queries exceeds what the server can process. +// The query in question can be retried when the system is less busy. +type QueryLimitExceededException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *QueryLimitExceededException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *QueryLimitExceededException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *QueryLimitExceededException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "QueryLimitExceededException" + } + return *e.ErrorCodeOverride +} +func (e *QueryLimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when the size of a query exceeds the system limit. +type QueryLimitException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *QueryLimitException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *QueryLimitException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *QueryLimitException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "QueryLimitException" + } + return *e.ErrorCodeOverride +} +func (e *QueryLimitException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when the body of a query is too large. +type QueryTooLargeException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *QueryTooLargeException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *QueryTooLargeException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *QueryTooLargeException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "QueryTooLargeException" + } + return *e.ErrorCodeOverride +} +func (e *QueryTooLargeException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a request attempts to write to a read-only resource. +type ReadOnlyViolationException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *ReadOnlyViolationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ReadOnlyViolationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ReadOnlyViolationException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ReadOnlyViolationException" + } + return *e.ErrorCodeOverride +} +func (e *ReadOnlyViolationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when there is a problem accessing Amazon S3. +type S3Exception struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *S3Exception) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *S3Exception) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *S3Exception) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "S3Exception" + } + return *e.ErrorCodeOverride +} +func (e *S3Exception) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when the server shuts down while processing a request. +type ServerShutdownException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *ServerShutdownException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ServerShutdownException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ServerShutdownException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ServerShutdownException" + } + return *e.ErrorCodeOverride +} +func (e *ServerShutdownException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when statistics needed to satisfy a request are not available. +type StatisticsNotAvailableException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *StatisticsNotAvailableException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *StatisticsNotAvailableException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *StatisticsNotAvailableException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "StatisticsNotAvailableException" + } + return *e.ErrorCodeOverride +} +func (e *StatisticsNotAvailableException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when stream records requested by a query cannot be found. +type StreamRecordsNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *StreamRecordsNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *StreamRecordsNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *StreamRecordsNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "StreamRecordsNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *StreamRecordsNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when the rate of requests exceeds the maximum throughput. Requests can +// be retried after encountering this exception. +type ThrottlingException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *ThrottlingException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ThrottlingException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ThrottlingException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ThrottlingException" + } + return *e.ErrorCodeOverride +} +func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when the an operation exceeds the time limit allowed for it. +type TimeLimitExceededException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *TimeLimitExceededException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *TimeLimitExceededException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *TimeLimitExceededException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "TimeLimitExceededException" + } + return *e.ErrorCodeOverride +} +func (e *TimeLimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// Raised when the number of requests being processed exceeds the limit. +type TooManyRequestsException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *TooManyRequestsException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *TooManyRequestsException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *TooManyRequestsException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "TooManyRequestsException" + } + return *e.ErrorCodeOverride +} +func (e *TooManyRequestsException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Raised when a request attempts to initiate an operation that is not supported. +type UnsupportedOperationException struct { + Message *string + + ErrorCodeOverride *string + + DetailedMessage *string + RequestId *string + Code *string + + noSmithyDocumentSerde +} + +func (e *UnsupportedOperationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *UnsupportedOperationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *UnsupportedOperationException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "UnsupportedOperationException" + } + return *e.ErrorCodeOverride +} +func (e *UnsupportedOperationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } diff --git a/service/neptunedata/types/types.go b/service/neptunedata/types/types.go new file mode 100644 index 00000000000..8cc4a9304b1 --- /dev/null +++ b/service/neptunedata/types/types.go @@ -0,0 +1,522 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "github.com/aws/aws-sdk-go-v2/service/neptunedata/document" + smithydocument "github.com/aws/smithy-go/document" + "time" +) + +// Contains custom model training parameters. See Custom models in Neptune ML (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-custom-models.html) +// . +type CustomModelTrainingParameters struct { + + // The path to the Amazon S3 location where the Python module implementing your + // model is located. This must point to a valid existing Amazon S3 location that + // contains, at a minimum, a training script, a transform script, and a + // model-hpo-configuration.json file. + // + // This member is required. + SourceS3DirectoryPath *string + + // The name of the entry point in your module of a script that performs model + // training and takes hyperparameters as command-line arguments, including fixed + // hyperparameters. The default is training.py . + TrainingEntryPointScript *string + + // The name of the entry point in your module of a script that should be run after + // the best model from the hyperparameter search has been identified, to compute + // the model artifacts necessary for model deployment. It should be able to run + // with no command-line arguments.The default is transform.py . + TransformEntryPointScript *string + + noSmithyDocumentSerde +} + +// Contains custom model transform parameters. See Use a trained model to generate +// new model artifacts (https://docs.aws.amazon.com/neptune/latest/userguide/machine-learning-model-transform.html) +// . +type CustomModelTransformParameters struct { + + // The path to the Amazon S3 location where the Python module implementing your + // model is located. This must point to a valid existing Amazon S3 location that + // contains, at a minimum, a training script, a transform script, and a + // model-hpo-configuration.json file. + // + // This member is required. + SourceS3DirectoryPath *string + + // The name of the entry point in your module of a script that should be run after + // the best model from the hyperparameter search has been identified, to compute + // the model artifacts necessary for model deployment. It should be able to run + // with no command-line arguments. The default is transform.py . + TransformEntryPointScript *string + + noSmithyDocumentSerde +} + +// The payload for DeleteStatistics. +type DeleteStatisticsValueMap struct { + + // The current status of the statistics. + Active *bool + + // The ID of the statistics generation run that is currently occurring. + StatisticsId *string + + noSmithyDocumentSerde +} + +// An edge structure. +type EdgeStructure struct { + + // The number of edges that have this specific structure. + Count *int64 + + // A list of edge properties present in this specific structure. + EdgeProperties []string + + noSmithyDocumentSerde +} + +// A structure containing the fast reset token used to initiate a fast reset. +type FastResetToken struct { + + // A UUID generated by the database in the initiateDatabaseReset action, and then + // consumed by the performDatabaseReset to reset the database. + Token *string + + noSmithyDocumentSerde +} + +// Captures the status of a Gremlin query (see the Gremlin query status API (https://docs.aws.amazon.com/neptune/latest/userguide/gremlin-api-status.html) +// page). +type GremlinQueryStatus struct { + + // The query statistics of the Gremlin query. + QueryEvalStats *QueryEvalStats + + // The ID of the Gremlin query. + QueryId *string + + // The query string of the Gremlin query. + QueryString *string + + noSmithyDocumentSerde +} + +// Contains status components of a Gremlin query. +type GremlinQueryStatusAttributes struct { + + // Attributes of the Gremlin query status. + Attributes document.Interface + + // The HTTP response code returned fro the Gremlin query request.. + Code *int32 + + // The status message. + Message *string + + noSmithyDocumentSerde +} + +// Contains a list of load IDs. +type LoaderIdResult struct { + + // A list of load IDs. + LoadIds []string + + noSmithyDocumentSerde +} + +// Contains a Neptune ML configuration. +type MlConfigDefinition struct { + + // The ARN for the configuration. + Arn *string + + // The configuration name. + Name *string + + noSmithyDocumentSerde +} + +// Defines a Neptune ML resource. +type MlResourceDefinition struct { + + // The resource ARN. + Arn *string + + // The CloudWatch log URL for the resource. + CloudwatchLogUrl *string + + // The failure reason, in case of a failure. + FailureReason *string + + // The resource name. + Name *string + + // The output location. + OutputLocation *string + + // The resource status. + Status *string + + noSmithyDocumentSerde +} + +// A node structure. +type NodeStructure struct { + + // Number of nodes that have this specific structure. + Count *int64 + + // A list of distinct outgoing edge labels present in this specific structure. + DistinctOutgoingEdgeLabels []string + + // A list of the node properties present in this specific structure. + NodeProperties []string + + noSmithyDocumentSerde +} + +// A Gremlin or openCypher change record. +type PropertygraphData struct { + + // The ID of the Gremlin or openCypher element. + // + // This member is required. + Id *string + + // The property name. For element labels, this is label . + // + // This member is required. + Key *string + + // The type of this Gremlin or openCypher element. Must be one of: + // - v1 - Vertex label for Gremlin, or node label for openCypher. + // - vp - Vertex properties for Gremlin, or node properties for openCypher. + // - e - Edge and edge label for Gremlin, or relationship and relationship type + // for openCypher. + // - ep - Edge properties for Gremlin, or relationship properties for openCypher. + // + // This member is required. + Type *string + + // This is a JSON object that contains a value field for the value itself, and a + // datatype field for the JSON data type of that value: + // + // This member is required. + Value document.Interface + + // If this is an edge (type = e ), the ID of the corresponding from vertex or + // source node. + From *string + + // If this is an edge (type = e ), the ID of the corresponding to vertex or target + // node. + To *string + + noSmithyDocumentSerde +} + +// Structure of a property graph record. +type PropertygraphRecord struct { + + // The time at which the commit for the transaction was requested, in milliseconds + // from the Unix epoch. + // + // This member is required. + CommitTimestampInMillis *int64 + + // The serialized Gremlin or openCypher change record. + // + // This member is required. + Data *PropertygraphData + + // The sequence identifier of the stream change record. + // + // This member is required. + EventId map[string]string + + // The operation that created the change. + // + // This member is required. + Op *string + + // Only present if this operation is the last one in its transaction. If present, + // it is set to true. It is useful for ensuring that an entire transaction is + // consumed. + IsLastOp *bool + + noSmithyDocumentSerde +} + +// The graph summary API returns a read-only list of node and edge labels and +// property keys, along with counts of nodes, edges, and properties. See Graph +// summary response for a property graph (PG) (https://docs.aws.amazon.com/neptune/latest/userguide/neptune-graph-summary.html#neptune-graph-summary-pg-response) +// . +type PropertygraphSummary struct { + + // A list of the distinct edge labels in the graph. + EdgeLabels []string + + // A list of the distinct edge properties in the graph, along with the count of + // edges where each property is used. + EdgeProperties []map[string]int64 + + // This field is only present when the requested mode is DETAILED . It contains a + // list of edge structures. + EdgeStructures []EdgeStructure + + // A list of the distinct node labels in the graph. + NodeLabels []string + + // The number of distinct node properties in the graph. + NodeProperties []map[string]int64 + + // This field is only present when the requested mode is DETAILED . It contains a + // list of node structures. + NodeStructures []NodeStructure + + // The number of distinct edge labels in the graph. + NumEdgeLabels *int64 + + // The number of distinct edge properties in the graph. + NumEdgeProperties *int64 + + // The number of edges in the graph. + NumEdges *int64 + + // The number of distinct node labels in the graph. + NumNodeLabels *int64 + + // A list of the distinct node properties in the graph, along with the count of + // nodes where each property is used. + NumNodeProperties *int64 + + // The number of nodes in the graph. + NumNodes *int64 + + // The total number of usages of all edge properties. + TotalEdgePropertyValues *int64 + + // The total number of usages of all node properties. + TotalNodePropertyValues *int64 + + noSmithyDocumentSerde +} + +// Payload for the property graph summary response. +type PropertygraphSummaryValueMap struct { + + // The graph summary. + GraphSummary *PropertygraphSummary + + // The timestamp, in ISO 8601 format, of the time at which Neptune last computed + // statistics. + LastStatisticsComputationTime *time.Time + + // The version of this graph summary response. + Version *string + + noSmithyDocumentSerde +} + +// Structure to capture query statistics such as how many queries are running, +// accepted or waiting and their details. +type QueryEvalStats struct { + + // Set to TRUE if the query was cancelled, or FALSE otherwise. + Cancelled *bool + + // The number of milliseconds the query has been running so far. + Elapsed *int32 + + // The number of subqueries in this query. + Subqueries document.Interface + + // Indicates how long the query waited, in milliseconds. + Waited *int32 + + noSmithyDocumentSerde +} + +// Structure for expressing the query language version. +type QueryLanguageVersion struct { + + // The version of the query language. + // + // This member is required. + Version *string + + noSmithyDocumentSerde +} + +// The RDF graph summary API returns a read-only list of classes and predicate +// keys, along with counts of quads, subjects, and predicates. +type RDFGraphSummary struct { + + // A list of the classes in the graph. + Classes []string + + // The number of classes in the graph. + NumClasses *int64 + + // The number of distinct predicates in the graph. + NumDistinctPredicates *int64 + + // The number of distinct subjects in the graph. + NumDistinctSubjects *int64 + + // The number of quads in the graph. + NumQuads *int64 + + // "A list of predicates in the graph, along with the predicate counts. + Predicates []map[string]int64 + + // This field is only present when the request mode is DETAILED . It contains a + // list of subject structures. + SubjectStructures []SubjectStructure + + noSmithyDocumentSerde +} + +// Payload for an RDF graph summary response. +type RDFGraphSummaryValueMap struct { + + // The graph summary of an RDF graph. See Graph summary response for an RDF graph (https://docs.aws.amazon.com/neptune-graph-summary.html#neptune-graph-summary-rdf-response) + // . + GraphSummary *RDFGraphSummary + + // The timestamp, in ISO 8601 format, of the time at which Neptune last computed + // statistics. + LastStatisticsComputationTime *time.Time + + // The version of this graph summary response. + Version *string + + noSmithyDocumentSerde +} + +// Statistics for REFRESH mode. +type RefreshStatisticsIdMap struct { + + // The ID of the statistics generation run that is currently occurring. + StatisticsId *string + + noSmithyDocumentSerde +} + +// Neptune logs are converted to SPARQL quads in the graph using the Resource +// Description Framework (RDF) N-QUADS (https://www.w3.org/TR/n-quads/) language +// defined in the W3C RDF 1.1 N-Quads specification +type SparqlData struct { + + // Holds an N-QUADS (https://www.w3.org/TR/n-quads/) statement expressing the + // changed quad. + // + // This member is required. + Stmt *string + + noSmithyDocumentSerde +} + +// A serialized SPARQL stream record capturing a change-log entry for the RDF +// graph. +type SparqlRecord struct { + + // The time at which the commit for the transaction was requested, in milliseconds + // from the Unix epoch. + // + // This member is required. + CommitTimestampInMillis *int64 + + // The serialized SPARQL change record. The serialization formats of each record + // are described in more detail in Serialization Formats in Neptune Streams (https://docs.aws.amazon.com/neptune/latest/userguide/streams-change-formats.html) + // . + // + // This member is required. + Data *SparqlData + + // The sequence identifier of the stream change record. + // + // This member is required. + EventId map[string]string + + // The operation that created the change. + // + // This member is required. + Op *string + + // Only present if this operation is the last one in its transaction. If present, + // it is set to true. It is useful for ensuring that an entire transaction is + // consumed. + IsLastOp *bool + + noSmithyDocumentSerde +} + +// Contains statistics information. The DFE engine uses information about the data +// in your Neptune graph to make effective trade-offs when planning query +// execution. This information takes the form of statistics that include so-called +// characteristic sets and predicate statistics that can guide query planning. See +// Managing statistics for the Neptune DFE to use (https://docs.aws.amazon.com/neptune/latest/userguide/neptune-dfe-statistics.html) +// . +type Statistics struct { + + // Indicates whether or not DFE statistics generation is enabled at all. + Active *bool + + // Indicates whether or not automatic statistics generation is enabled. + AutoCompute *bool + + // The UTC time at which DFE statistics have most recently been generated. + Date *time.Time + + // A note about problems in the case where statistics are invalid. + Note *string + + // A StatisticsSummary structure that contains: + // - signatureCount - The total number of signatures across all characteristic + // sets. + // - instanceCount - The total number of characteristic-set instances. + // - predicateCount - The total number of unique predicates. + SignatureInfo *StatisticsSummary + + // Reports the ID of the current statistics generation run. A value of -1 + // indicates that no statistics have been generated. + StatisticsId *string + + noSmithyDocumentSerde +} + +// Information about the characteristic sets generated in the statistics. +type StatisticsSummary struct { + + // The total number of characteristic-set instances. + InstanceCount *int32 + + // The total number of unique predicates. + PredicateCount *int32 + + // The total number of signatures across all characteristic sets. + SignatureCount *int32 + + noSmithyDocumentSerde +} + +// A subject structure. +type SubjectStructure struct { + + // Number of occurrences of this specific structure. + Count *int64 + + // A list of predicates present in this specific structure. + Predicates []string + + noSmithyDocumentSerde +} + +type noSmithyDocumentSerde = smithydocument.NoSerde diff --git a/service/neptunedata/validators.go b/service/neptunedata/validators.go new file mode 100644 index 00000000000..d391e9f6da4 --- /dev/null +++ b/service/neptunedata/validators.go @@ -0,0 +1,1005 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package neptunedata + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/neptunedata/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpCancelGremlinQuery struct { +} + +func (*validateOpCancelGremlinQuery) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCancelGremlinQuery) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CancelGremlinQueryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCancelGremlinQueryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCancelLoaderJob struct { +} + +func (*validateOpCancelLoaderJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCancelLoaderJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CancelLoaderJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCancelLoaderJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCancelMLDataProcessingJob struct { +} + +func (*validateOpCancelMLDataProcessingJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCancelMLDataProcessingJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CancelMLDataProcessingJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCancelMLDataProcessingJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCancelMLModelTrainingJob struct { +} + +func (*validateOpCancelMLModelTrainingJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCancelMLModelTrainingJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CancelMLModelTrainingJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCancelMLModelTrainingJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCancelMLModelTransformJob struct { +} + +func (*validateOpCancelMLModelTransformJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCancelMLModelTransformJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CancelMLModelTransformJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCancelMLModelTransformJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCancelOpenCypherQuery struct { +} + +func (*validateOpCancelOpenCypherQuery) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCancelOpenCypherQuery) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CancelOpenCypherQueryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCancelOpenCypherQueryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteMLEndpoint struct { +} + +func (*validateOpDeleteMLEndpoint) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteMLEndpoint) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteMLEndpointInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteMLEndpointInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpExecuteFastReset struct { +} + +func (*validateOpExecuteFastReset) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpExecuteFastReset) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ExecuteFastResetInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpExecuteFastResetInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpExecuteGremlinExplainQuery struct { +} + +func (*validateOpExecuteGremlinExplainQuery) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpExecuteGremlinExplainQuery) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ExecuteGremlinExplainQueryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpExecuteGremlinExplainQueryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpExecuteGremlinProfileQuery struct { +} + +func (*validateOpExecuteGremlinProfileQuery) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpExecuteGremlinProfileQuery) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ExecuteGremlinProfileQueryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpExecuteGremlinProfileQueryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpExecuteGremlinQuery struct { +} + +func (*validateOpExecuteGremlinQuery) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpExecuteGremlinQuery) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ExecuteGremlinQueryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpExecuteGremlinQueryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpExecuteOpenCypherExplainQuery struct { +} + +func (*validateOpExecuteOpenCypherExplainQuery) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpExecuteOpenCypherExplainQuery) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ExecuteOpenCypherExplainQueryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpExecuteOpenCypherExplainQueryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpExecuteOpenCypherQuery struct { +} + +func (*validateOpExecuteOpenCypherQuery) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpExecuteOpenCypherQuery) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ExecuteOpenCypherQueryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpExecuteOpenCypherQueryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetGremlinQueryStatus struct { +} + +func (*validateOpGetGremlinQueryStatus) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetGremlinQueryStatus) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetGremlinQueryStatusInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetGremlinQueryStatusInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetLoaderJobStatus struct { +} + +func (*validateOpGetLoaderJobStatus) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetLoaderJobStatus) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetLoaderJobStatusInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetLoaderJobStatusInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetMLDataProcessingJob struct { +} + +func (*validateOpGetMLDataProcessingJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetMLDataProcessingJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetMLDataProcessingJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetMLDataProcessingJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetMLEndpoint struct { +} + +func (*validateOpGetMLEndpoint) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetMLEndpoint) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetMLEndpointInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetMLEndpointInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetMLModelTrainingJob struct { +} + +func (*validateOpGetMLModelTrainingJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetMLModelTrainingJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetMLModelTrainingJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetMLModelTrainingJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetMLModelTransformJob struct { +} + +func (*validateOpGetMLModelTransformJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetMLModelTransformJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetMLModelTransformJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetMLModelTransformJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetOpenCypherQueryStatus struct { +} + +func (*validateOpGetOpenCypherQueryStatus) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetOpenCypherQueryStatus) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetOpenCypherQueryStatusInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetOpenCypherQueryStatusInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStartLoaderJob struct { +} + +func (*validateOpStartLoaderJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartLoaderJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartLoaderJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartLoaderJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStartMLDataProcessingJob struct { +} + +func (*validateOpStartMLDataProcessingJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartMLDataProcessingJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartMLDataProcessingJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartMLDataProcessingJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStartMLModelTrainingJob struct { +} + +func (*validateOpStartMLModelTrainingJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartMLModelTrainingJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartMLModelTrainingJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartMLModelTrainingJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpStartMLModelTransformJob struct { +} + +func (*validateOpStartMLModelTransformJob) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpStartMLModelTransformJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*StartMLModelTransformJobInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpStartMLModelTransformJobInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpCancelGremlinQueryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCancelGremlinQuery{}, middleware.After) +} + +func addOpCancelLoaderJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCancelLoaderJob{}, middleware.After) +} + +func addOpCancelMLDataProcessingJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCancelMLDataProcessingJob{}, middleware.After) +} + +func addOpCancelMLModelTrainingJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCancelMLModelTrainingJob{}, middleware.After) +} + +func addOpCancelMLModelTransformJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCancelMLModelTransformJob{}, middleware.After) +} + +func addOpCancelOpenCypherQueryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCancelOpenCypherQuery{}, middleware.After) +} + +func addOpDeleteMLEndpointValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteMLEndpoint{}, middleware.After) +} + +func addOpExecuteFastResetValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpExecuteFastReset{}, middleware.After) +} + +func addOpExecuteGremlinExplainQueryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpExecuteGremlinExplainQuery{}, middleware.After) +} + +func addOpExecuteGremlinProfileQueryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpExecuteGremlinProfileQuery{}, middleware.After) +} + +func addOpExecuteGremlinQueryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpExecuteGremlinQuery{}, middleware.After) +} + +func addOpExecuteOpenCypherExplainQueryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpExecuteOpenCypherExplainQuery{}, middleware.After) +} + +func addOpExecuteOpenCypherQueryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpExecuteOpenCypherQuery{}, middleware.After) +} + +func addOpGetGremlinQueryStatusValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetGremlinQueryStatus{}, middleware.After) +} + +func addOpGetLoaderJobStatusValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetLoaderJobStatus{}, middleware.After) +} + +func addOpGetMLDataProcessingJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetMLDataProcessingJob{}, middleware.After) +} + +func addOpGetMLEndpointValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetMLEndpoint{}, middleware.After) +} + +func addOpGetMLModelTrainingJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetMLModelTrainingJob{}, middleware.After) +} + +func addOpGetMLModelTransformJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetMLModelTransformJob{}, middleware.After) +} + +func addOpGetOpenCypherQueryStatusValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetOpenCypherQueryStatus{}, middleware.After) +} + +func addOpStartLoaderJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartLoaderJob{}, middleware.After) +} + +func addOpStartMLDataProcessingJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartMLDataProcessingJob{}, middleware.After) +} + +func addOpStartMLModelTrainingJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartMLModelTrainingJob{}, middleware.After) +} + +func addOpStartMLModelTransformJobValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpStartMLModelTransformJob{}, middleware.After) +} + +func validateCustomModelTrainingParameters(v *types.CustomModelTrainingParameters) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CustomModelTrainingParameters"} + if v.SourceS3DirectoryPath == nil { + invalidParams.Add(smithy.NewErrParamRequired("SourceS3DirectoryPath")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateCustomModelTransformParameters(v *types.CustomModelTransformParameters) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CustomModelTransformParameters"} + if v.SourceS3DirectoryPath == nil { + invalidParams.Add(smithy.NewErrParamRequired("SourceS3DirectoryPath")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCancelGremlinQueryInput(v *CancelGremlinQueryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CancelGremlinQueryInput"} + if v.QueryId == nil { + invalidParams.Add(smithy.NewErrParamRequired("QueryId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCancelLoaderJobInput(v *CancelLoaderJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CancelLoaderJobInput"} + if v.LoadId == nil { + invalidParams.Add(smithy.NewErrParamRequired("LoadId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCancelMLDataProcessingJobInput(v *CancelMLDataProcessingJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CancelMLDataProcessingJobInput"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCancelMLModelTrainingJobInput(v *CancelMLModelTrainingJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CancelMLModelTrainingJobInput"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCancelMLModelTransformJobInput(v *CancelMLModelTransformJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CancelMLModelTransformJobInput"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCancelOpenCypherQueryInput(v *CancelOpenCypherQueryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CancelOpenCypherQueryInput"} + if v.QueryId == nil { + invalidParams.Add(smithy.NewErrParamRequired("QueryId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteMLEndpointInput(v *DeleteMLEndpointInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteMLEndpointInput"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpExecuteFastResetInput(v *ExecuteFastResetInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExecuteFastResetInput"} + if len(v.Action) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Action")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpExecuteGremlinExplainQueryInput(v *ExecuteGremlinExplainQueryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExecuteGremlinExplainQueryInput"} + if v.GremlinQuery == nil { + invalidParams.Add(smithy.NewErrParamRequired("GremlinQuery")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpExecuteGremlinProfileQueryInput(v *ExecuteGremlinProfileQueryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExecuteGremlinProfileQueryInput"} + if v.GremlinQuery == nil { + invalidParams.Add(smithy.NewErrParamRequired("GremlinQuery")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpExecuteGremlinQueryInput(v *ExecuteGremlinQueryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExecuteGremlinQueryInput"} + if v.GremlinQuery == nil { + invalidParams.Add(smithy.NewErrParamRequired("GremlinQuery")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpExecuteOpenCypherExplainQueryInput(v *ExecuteOpenCypherExplainQueryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExecuteOpenCypherExplainQueryInput"} + if v.OpenCypherQuery == nil { + invalidParams.Add(smithy.NewErrParamRequired("OpenCypherQuery")) + } + if len(v.ExplainMode) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ExplainMode")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpExecuteOpenCypherQueryInput(v *ExecuteOpenCypherQueryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExecuteOpenCypherQueryInput"} + if v.OpenCypherQuery == nil { + invalidParams.Add(smithy.NewErrParamRequired("OpenCypherQuery")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetGremlinQueryStatusInput(v *GetGremlinQueryStatusInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetGremlinQueryStatusInput"} + if v.QueryId == nil { + invalidParams.Add(smithy.NewErrParamRequired("QueryId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetLoaderJobStatusInput(v *GetLoaderJobStatusInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetLoaderJobStatusInput"} + if v.LoadId == nil { + invalidParams.Add(smithy.NewErrParamRequired("LoadId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetMLDataProcessingJobInput(v *GetMLDataProcessingJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetMLDataProcessingJobInput"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetMLEndpointInput(v *GetMLEndpointInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetMLEndpointInput"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetMLModelTrainingJobInput(v *GetMLModelTrainingJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetMLModelTrainingJobInput"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetMLModelTransformJobInput(v *GetMLModelTransformJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetMLModelTransformJobInput"} + if v.Id == nil { + invalidParams.Add(smithy.NewErrParamRequired("Id")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetOpenCypherQueryStatusInput(v *GetOpenCypherQueryStatusInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetOpenCypherQueryStatusInput"} + if v.QueryId == nil { + invalidParams.Add(smithy.NewErrParamRequired("QueryId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStartLoaderJobInput(v *StartLoaderJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartLoaderJobInput"} + if v.Source == nil { + invalidParams.Add(smithy.NewErrParamRequired("Source")) + } + if len(v.Format) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Format")) + } + if len(v.S3BucketRegion) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("S3BucketRegion")) + } + if v.IamRoleArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("IamRoleArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStartMLDataProcessingJobInput(v *StartMLDataProcessingJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartMLDataProcessingJobInput"} + if v.InputDataS3Location == nil { + invalidParams.Add(smithy.NewErrParamRequired("InputDataS3Location")) + } + if v.ProcessedDataS3Location == nil { + invalidParams.Add(smithy.NewErrParamRequired("ProcessedDataS3Location")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStartMLModelTrainingJobInput(v *StartMLModelTrainingJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartMLModelTrainingJobInput"} + if v.DataProcessingJobId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DataProcessingJobId")) + } + if v.TrainModelS3Location == nil { + invalidParams.Add(smithy.NewErrParamRequired("TrainModelS3Location")) + } + if v.CustomModelTrainingParameters != nil { + if err := validateCustomModelTrainingParameters(v.CustomModelTrainingParameters); err != nil { + invalidParams.AddNested("CustomModelTrainingParameters", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpStartMLModelTransformJobInput(v *StartMLModelTransformJobInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "StartMLModelTransformJobInput"} + if v.ModelTransformOutputS3Location == nil { + invalidParams.Add(smithy.NewErrParamRequired("ModelTransformOutputS3Location")) + } + if v.CustomModelTransformParameters != nil { + if err := validateCustomModelTransformParameters(v.CustomModelTransformParameters); err != nil { + invalidParams.AddNested("CustomModelTransformParameters", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/networkfirewall/api_op_CreateTLSInspectionConfiguration.go b/service/networkfirewall/api_op_CreateTLSInspectionConfiguration.go index 003b423ea3d..1380bb229bc 100644 --- a/service/networkfirewall/api_op_CreateTLSInspectionConfiguration.go +++ b/service/networkfirewall/api_op_CreateTLSInspectionConfiguration.go @@ -19,8 +19,8 @@ import ( // Creates an Network Firewall TLS inspection configuration. A TLS inspection // configuration contains the Certificate Manager certificate references that // Network Firewall uses to decrypt and re-encrypt inbound traffic. After you -// create a TLS inspection configuration, you associate it with a firewall policy. -// To update the settings for a TLS inspection configuration, use +// create a TLS inspection configuration, you associate it with a new firewall +// policy. To update the settings for a TLS inspection configuration, use // UpdateTLSInspectionConfiguration . To manage a TLS inspection configuration's // tags, use the standard Amazon Web Services resource tagging operations, // ListTagsForResource , TagResource , and UntagResource . To retrieve information @@ -52,12 +52,12 @@ type CreateTLSInspectionConfigurationInput struct { // DescribeTLSInspectionConfiguration . Network Firewall uses a TLS inspection // configuration to decrypt traffic. Network Firewall re-encrypts the traffic // before sending it to its destination. To use a TLS inspection configuration, you - // add it to a Network Firewall firewall policy, then you apply the firewall policy - // to a firewall. Network Firewall acts as a proxy service to decrypt and inspect - // inbound traffic. You can reference a TLS inspection configuration from more than - // one firewall policy, and you can use a firewall policy in more than one - // firewall. For more information about using TLS inspection configurations, see - // Decrypting SSL/TLS traffic with TLS inspection configurations (https://docs.aws.amazon.com/network-firewall/latest/developerguide/tls-inspection.html) + // add it to a new Network Firewall firewall policy, then you apply the firewall + // policy to a firewall. Network Firewall acts as a proxy service to decrypt and + // inspect inbound traffic. You can reference a TLS inspection configuration from + // more than one firewall policy, and you can use a firewall policy in more than + // one firewall. For more information about using TLS inspection configurations, + // see Decrypting SSL/TLS traffic with TLS inspection configurations (https://docs.aws.amazon.com/network-firewall/latest/developerguide/tls-inspection.html) // in the Network Firewall Developer Guide. // // This member is required. diff --git a/service/networkfirewall/api_op_DescribeTLSInspectionConfiguration.go b/service/networkfirewall/api_op_DescribeTLSInspectionConfiguration.go index 831c7084703..968bd21a2ca 100644 --- a/service/networkfirewall/api_op_DescribeTLSInspectionConfiguration.go +++ b/service/networkfirewall/api_op_DescribeTLSInspectionConfiguration.go @@ -76,12 +76,12 @@ type DescribeTLSInspectionConfigurationOutput struct { // DescribeTLSInspectionConfiguration . Network Firewall uses a TLS inspection // configuration to decrypt traffic. Network Firewall re-encrypts the traffic // before sending it to its destination. To use a TLS inspection configuration, you - // add it to a Network Firewall firewall policy, then you apply the firewall policy - // to a firewall. Network Firewall acts as a proxy service to decrypt and inspect - // inbound traffic. You can reference a TLS inspection configuration from more than - // one firewall policy, and you can use a firewall policy in more than one - // firewall. For more information about using TLS inspection configurations, see - // Decrypting SSL/TLS traffic with TLS inspection configurations (https://docs.aws.amazon.com/network-firewall/latest/developerguide/tls-inspection.html) + // add it to a new Network Firewall firewall policy, then you apply the firewall + // policy to a firewall. Network Firewall acts as a proxy service to decrypt and + // inspect inbound traffic. You can reference a TLS inspection configuration from + // more than one firewall policy, and you can use a firewall policy in more than + // one firewall. For more information about using TLS inspection configurations, + // see Decrypting SSL/TLS traffic with TLS inspection configurations (https://docs.aws.amazon.com/network-firewall/latest/developerguide/tls-inspection.html) // in the Network Firewall Developer Guide. TLSInspectionConfiguration *types.TLSInspectionConfiguration diff --git a/service/networkfirewall/api_op_UpdateFirewallPolicy.go b/service/networkfirewall/api_op_UpdateFirewallPolicy.go index e2e42b84a9d..c3dd62b3a99 100644 --- a/service/networkfirewall/api_op_UpdateFirewallPolicy.go +++ b/service/networkfirewall/api_op_UpdateFirewallPolicy.go @@ -34,7 +34,10 @@ func (c *Client) UpdateFirewallPolicy(ctx context.Context, params *UpdateFirewal type UpdateFirewallPolicyInput struct { - // The updated firewall policy to use for the firewall. + // The updated firewall policy to use for the firewall. You can't add or remove a + // TLSInspectionConfiguration after you create a firewall policy. However, you can + // replace an existing TLS inspection configuration with another + // TLSInspectionConfiguration . // // This member is required. FirewallPolicy *types.FirewallPolicy diff --git a/service/networkfirewall/api_op_UpdateTLSInspectionConfiguration.go b/service/networkfirewall/api_op_UpdateTLSInspectionConfiguration.go index c21d62ec198..22e274043c5 100644 --- a/service/networkfirewall/api_op_UpdateTLSInspectionConfiguration.go +++ b/service/networkfirewall/api_op_UpdateTLSInspectionConfiguration.go @@ -47,12 +47,12 @@ type UpdateTLSInspectionConfigurationInput struct { // DescribeTLSInspectionConfiguration . Network Firewall uses a TLS inspection // configuration to decrypt traffic. Network Firewall re-encrypts the traffic // before sending it to its destination. To use a TLS inspection configuration, you - // add it to a Network Firewall firewall policy, then you apply the firewall policy - // to a firewall. Network Firewall acts as a proxy service to decrypt and inspect - // inbound traffic. You can reference a TLS inspection configuration from more than - // one firewall policy, and you can use a firewall policy in more than one - // firewall. For more information about using TLS inspection configurations, see - // Decrypting SSL/TLS traffic with TLS inspection configurations (https://docs.aws.amazon.com/network-firewall/latest/developerguide/tls-inspection.html) + // add it to a new Network Firewall firewall policy, then you apply the firewall + // policy to a firewall. Network Firewall acts as a proxy service to decrypt and + // inspect inbound traffic. You can reference a TLS inspection configuration from + // more than one firewall policy, and you can use a firewall policy in more than + // one firewall. For more information about using TLS inspection configurations, + // see Decrypting SSL/TLS traffic with TLS inspection configurations (https://docs.aws.amazon.com/network-firewall/latest/developerguide/tls-inspection.html) // in the Network Firewall Developer Guide. // // This member is required. diff --git a/service/networkfirewall/deserializers.go b/service/networkfirewall/deserializers.go index f800ce637a1..55f85320934 100644 --- a/service/networkfirewall/deserializers.go +++ b/service/networkfirewall/deserializers.go @@ -744,12 +744,18 @@ func awsAwsjson10_deserializeOpErrorCreateTLSInspectionConfiguration(response *s } switch { + case strings.EqualFold("InsufficientCapacityException", errorCode): + return awsAwsjson10_deserializeErrorInsufficientCapacityException(response, errorBody) + case strings.EqualFold("InternalServerError", errorCode): return awsAwsjson10_deserializeErrorInternalServerError(response, errorBody) case strings.EqualFold("InvalidRequestException", errorCode): return awsAwsjson10_deserializeErrorInvalidRequestException(response, errorBody) + case strings.EqualFold("LimitExceededException", errorCode): + return awsAwsjson10_deserializeErrorLimitExceededException(response, errorBody) + case strings.EqualFold("ThrottlingException", errorCode): return awsAwsjson10_deserializeErrorThrottlingException(response, errorBody) diff --git a/service/networkfirewall/types/types.go b/service/networkfirewall/types/types.go index 6410d8b059c..bf69af6a78f 100644 --- a/service/networkfirewall/types/types.go +++ b/service/networkfirewall/types/types.go @@ -921,12 +921,19 @@ type RuleGroupResponse struct { // configuration. type RuleOption struct { - // + // The keyword for the Suricata compatible rule option. You must include a sid + // (signature ID), and can optionally include other keywords. For information about + // Suricata compatible keywords, see Rule options (https://suricata.readthedocs.io/en/suricata-6.0.9/rules/intro.html#rule-options) + // in the Suricata documentation. // // This member is required. Keyword *string - // + // The settings of the Suricata compatible rule option. Rule options have zero or + // more setting values, and the number of possible and required settings depends on + // the Keyword . For more information about the settings for specific options, see + // Rule options (https://suricata.readthedocs.io/en/suricata-6.0.9/rules/intro.html#rule-options) + // . Settings []string noSmithyDocumentSerde @@ -951,7 +958,7 @@ type RulesSource struct { // An array of individual stateful rules inspection criteria to be used together // in a stateful rule group. Use this option to specify simple Suricata rules with // protocol, source and destination, ports, direction, and rule options. For - // information about the Suricata Rules format, see Rules Format (https://suricata.readthedocs.iorules/intro.html#) + // information about the Suricata Rules format, see Rules Format (https://suricata.readthedocs.io/en/suricata-6.0.9/rules/intro.html) // . StatefulRules []StatefulRule @@ -1138,7 +1145,7 @@ type StatefulEngineOptions struct { // A single Suricata rules specification, for use in a stateful rule group. Use // this option to specify a simple Suricata rule with protocol, source and // destination, ports, direction, and rule options. For information about the -// Suricata Rules format, see Rules Format (https://suricata.readthedocs.iorules/intro.html#) +// Suricata Rules format, see Rules Format (https://suricata.readthedocs.io/en/suricata-6.0.9/rules/intro.html) // . type StatefulRule struct { @@ -1156,12 +1163,6 @@ type StatefulRule struct { // to use to drop traffic. You can enable the rule with ALERT action, verify in // the logs that the rule is filtering as you want, then change the action to // DROP . - // - REJECT - Drops TCP traffic that matches the conditions of the stateful - // rule, and sends a TCP reset packet back to sender of the packet. A TCP reset - // packet is a packet with no payload and a RST bit contained in the TCP header - // flags. Also sends an alert log mesage if alert logging is configured in the - // Firewall LoggingConfiguration . REJECT isn't currently available for use with - // IMAP and FTP protocols. // // This member is required. Action StatefulAction @@ -1414,12 +1415,12 @@ type TlsCertificateData struct { // DescribeTLSInspectionConfiguration . Network Firewall uses a TLS inspection // configuration to decrypt traffic. Network Firewall re-encrypts the traffic // before sending it to its destination. To use a TLS inspection configuration, you -// add it to a Network Firewall firewall policy, then you apply the firewall policy -// to a firewall. Network Firewall acts as a proxy service to decrypt and inspect -// inbound traffic. You can reference a TLS inspection configuration from more than -// one firewall policy, and you can use a firewall policy in more than one -// firewall. For more information about using TLS inspection configurations, see -// Decrypting SSL/TLS traffic with TLS inspection configurations (https://docs.aws.amazon.com/network-firewall/latest/developerguide/tls-inspection.html) +// add it to a new Network Firewall firewall policy, then you apply the firewall +// policy to a firewall. Network Firewall acts as a proxy service to decrypt and +// inspect inbound traffic. You can reference a TLS inspection configuration from +// more than one firewall policy, and you can use a firewall policy in more than +// one firewall. For more information about using TLS inspection configurations, +// see Decrypting SSL/TLS traffic with TLS inspection configurations (https://docs.aws.amazon.com/network-firewall/latest/developerguide/tls-inspection.html) // in the Network Firewall Developer Guide. type TLSInspectionConfiguration struct { diff --git a/service/pcaconnectorad/LICENSE.txt b/service/pcaconnectorad/LICENSE.txt new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/service/pcaconnectorad/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/pcaconnectorad/api_client.go b/service/pcaconnectorad/api_client.go new file mode 100644 index 00000000000..a673be15eb2 --- /dev/null +++ b/service/pcaconnectorad/api_client.go @@ -0,0 +1,545 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + cryptorand "crypto/rand" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/aws/defaults" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/retry" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" + internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" + smithy "github.com/aws/smithy-go" + smithydocument "github.com/aws/smithy-go/document" + "github.com/aws/smithy-go/logging" + "github.com/aws/smithy-go/middleware" + smithyrand "github.com/aws/smithy-go/rand" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net" + "net/http" + "time" +) + +const ServiceID = "Pca Connector Ad" +const ServiceAPIVersion = "2018-05-10" + +// Client provides the API client to make operations call for PcaConnectorAd. +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) + + resolveIdempotencyTokenProvider(&options) + + for _, fn := range optFns { + fn(&options) + } + + client := &Client{ + options: options, + } + + return client +} + +type Options struct { + // Set of options to modify how an operation is invoked. These apply to all + // operations invoked for this client. Use functional options on operation call to + // modify this list for per operation behavior. + APIOptions []func(*middleware.Stack) error + + // The optional application specific identifier appended to the User-Agent header. + AppID string + + // This endpoint will be given as input to an EndpointResolverV2. It is used for + // providing a custom base endpoint that is subject to modifications by the + // processing EndpointResolverV2. + BaseEndpoint *string + + // 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. + // + // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a + // value for this field will likely prevent you from using any endpoint-related + // service features released after the introduction of EndpointResolverV2 and + // BaseEndpoint. To migrate an EndpointResolver implementation that uses a custom + // endpoint, set the client option BaseEndpoint instead. + EndpointResolver EndpointResolver + + // Resolves the endpoint used for a particular service. This should be used over + // the deprecated EndpointResolver + EndpointResolverV2 EndpointResolverV2 + + // Signature Version 4 (SigV4) Signer + HTTPSignerV4 HTTPSignerV4 + + // Provides idempotency tokens values that will be automatically populated into + // idempotent API operations. + IdempotencyTokenProvider IdempotencyTokenProvider + + // The logger writer interface to write logging messages to. + Logger logging.Logger + + // The region to send requests to. (Required) + Region string + + // RetryMaxAttempts specifies the maximum number attempts an API client will call + // an operation that fails with a retryable error. A value of 0 is ignored, and + // will not be used to configure the API client created default retryer, or modify + // per operation call's retry max attempts. When creating a new API Clients this + // member will only be used if the Retryer Options member is nil. This value will + // be ignored if Retryer is not nil. If specified in an operation call's functional + // options with a value that is different than the constructed client's Options, + // the Client's Retryer will be wrapped to use the operation's specific + // RetryMaxAttempts value. + RetryMaxAttempts int + + // RetryMode specifies the retry mode the API client will be created with, if + // Retryer option is not also specified. When creating a new API Clients this + // member will only be used if the Retryer Options member is nil. This value will + // be ignored if Retryer is not nil. Currently does not support per operation call + // overrides, may in the future. + RetryMode aws.RetryMode + + // Retryer guides how HTTP requests should be retried in case of recoverable + // failures. When nil the API client will use a default retryer. The kind of + // default retry created by the API client can be changed with the RetryMode + // option. + Retryer aws.Retryer + + // The RuntimeEnvironment configuration, only populated if the DefaultsMode is set + // to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You + // should not populate this structure programmatically, or rely on the values here + // within your applications. + RuntimeEnvironment aws.RuntimeEnvironment + + // The initial DefaultsMode used when the client options were constructed. If the + // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved + // value was at that point in time. Currently does not support per operation call + // overrides, may in the future. + resolvedDefaultsMode aws.DefaultsMode + + // The HTTP client to invoke API calls with. Defaults to client's default HTTP + // implementation if nil. + HTTPClient HTTPClient +} + +// WithAPIOptions returns a functional option for setting the Client's APIOptions +// option. +func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { + return func(o *Options) { + o.APIOptions = append(o.APIOptions, optFns...) + } +} + +// Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for +// this field will likely prevent you from using any endpoint-related service +// features released after the introduction of EndpointResolverV2 and BaseEndpoint. +// To migrate an EndpointResolver implementation that uses a custom endpoint, set +// the client option BaseEndpoint instead. +func WithEndpointResolver(v EndpointResolver) func(*Options) { + return func(o *Options) { + o.EndpointResolver = v + } +} + +// WithEndpointResolverV2 returns a functional option for setting the Client's +// EndpointResolverV2 option. +func WithEndpointResolverV2(v EndpointResolverV2) func(*Options) { + return func(o *Options) { + o.EndpointResolverV2 = 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() + resolveEndpointResolverV2(&options) + + 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 + +type legacyEndpointContextSetter struct { + LegacyResolver EndpointResolver +} + +func (*legacyEndpointContextSetter) ID() string { + return "legacyEndpointContextSetter" +} + +func (m *legacyEndpointContextSetter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.LegacyResolver != nil { + ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, true) + } + + return next.HandleInitialize(ctx, in) + +} +func addlegacyEndpointContextSetter(stack *middleware.Stack, o Options) error { + return stack.Initialize.Add(&legacyEndpointContextSetter{ + LegacyResolver: o.EndpointResolver, + }, middleware.Before) +} + +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, + AppID: cfg.AppID, + } + 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) +} + +func addClientUserAgent(stack *middleware.Stack, options Options) error { + if err := awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "pcaconnectorad", goModuleVersion)(stack); err != nil { + return err + } + + if len(options.AppID) > 0 { + return awsmiddleware.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)(stack) + } + + return nil +} + +func addHTTPSignerV4Middleware(stack *middleware.Stack, o Options) error { + mw := v4.NewSignHTTPRequestMiddleware(v4.SignHTTPRequestMiddlewareOptions{ + CredentialsProvider: o.Credentials, + Signer: o.HTTPSignerV4, + LogSigning: o.ClientLogMode.IsSigning(), + }) + return stack.Finalize.Add(mw, middleware.After) +} + +type HTTPSignerV4 interface { + SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error +} + +func resolveHTTPSignerV4(o *Options) { + if o.HTTPSignerV4 != nil { + return + } + o.HTTPSignerV4 = newDefaultV4Signer(*o) +} + +func newDefaultV4Signer(o Options) *v4.Signer { + return v4.NewSigner(func(so *v4.SignerOptions) { + so.Logger = o.Logger + so.LogSigning = o.ClientLogMode.IsSigning() + }) +} + +func resolveIdempotencyTokenProvider(o *Options) { + if o.IdempotencyTokenProvider != nil { + return + } + o.IdempotencyTokenProvider = smithyrand.NewUUIDIdempotencyToken(cryptorand.Reader) +} + +func addRetryMiddlewares(stack *middleware.Stack, o Options) error { + mo := retry.AddRetryMiddlewaresOptions{ + Retryer: o.Retryer, + LogRetryAttempts: o.ClientLogMode.IsRetries(), + } + return retry.AddRetryMiddlewares(stack, mo) +} + +// resolves dual-stack endpoint configuration +func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + o.EndpointOptions.UseDualStackEndpoint = value + } + return nil +} + +// resolves FIPS endpoint configuration +func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error { + if len(cfg.ConfigSources) == 0 { + return nil + } + value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources) + if err != nil { + return err + } + if found { + o.EndpointOptions.UseFIPSEndpoint = value + } + return nil +} + +// IdempotencyTokenProvider interface for providing idempotency token +type IdempotencyTokenProvider interface { + GetIdempotencyToken() (string, error) +} + +func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { + return awsmiddleware.AddRequestIDRetrieverMiddleware(stack) +} + +func addResponseErrorMiddleware(stack *middleware.Stack) error { + return awshttp.AddResponseErrorMiddleware(stack) +} + +func addRequestResponseLogging(stack *middleware.Stack, o Options) error { + return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{ + LogRequest: o.ClientLogMode.IsRequest(), + LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(), + LogResponse: o.ClientLogMode.IsResponse(), + LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(), + }, middleware.After) +} + +type endpointDisableHTTPSMiddleware struct { + EndpointDisableHTTPS bool +} + +func (*endpointDisableHTTPSMiddleware) ID() string { + return "endpointDisableHTTPSMiddleware" +} + +func (m *endpointDisableHTTPSMiddleware) 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.EndpointDisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) { + req.URL.Scheme = "http" + } + + return next.HandleSerialize(ctx, in) + +} +func addendpointDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error { + return stack.Serialize.Insert(&endpointDisableHTTPSMiddleware{ + EndpointDisableHTTPS: o.EndpointOptions.DisableHTTPS, + }, "OperationSerializer", middleware.Before) +} diff --git a/service/pcaconnectorad/api_client_test.go b/service/pcaconnectorad/api_client_test.go new file mode 100644 index 00000000000..d41cc271c6c --- /dev/null +++ b/service/pcaconnectorad/api_client_test.go @@ -0,0 +1,123 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +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/pcaconnectorad/api_op_CreateConnector.go b/service/pcaconnectorad/api_op_CreateConnector.go new file mode 100644 index 00000000000..b5d2d2d486c --- /dev/null +++ b/service/pcaconnectorad/api_op_CreateConnector.go @@ -0,0 +1,315 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a connector between Amazon Web Services Private CA and an Active +// Directory. You must specify the private CA, directory ID, and security groups. +func (c *Client) CreateConnector(ctx context.Context, params *CreateConnectorInput, optFns ...func(*Options)) (*CreateConnectorOutput, error) { + if params == nil { + params = &CreateConnectorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateConnector", params, optFns, c.addOperationCreateConnectorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateConnectorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateConnectorInput struct { + + // The Amazon Resource Name (ARN) of the certificate authority being used. + // + // This member is required. + CertificateAuthorityArn *string + + // The identifier of the Active Directory. + // + // This member is required. + DirectoryId *string + + // Security group IDs that describe the inbound and outbound rules. + // + // This member is required. + VpcInformation *types.VpcInformation + + // Idempotency token. + ClientToken *string + + // Metadata assigned to a connector consisting of a key-value pair. + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateConnectorOutput struct { + + // If successful, the Amazon Resource Name (ARN) of the connector for Active + // Directory. + ConnectorArn *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateConnectorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateConnector{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateConnector{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCreateConnectorResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addIdempotencyToken_opCreateConnectorMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateConnectorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateConnector(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateConnector struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateConnector) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateConnector) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.tokenProvider == nil { + return next.HandleInitialize(ctx, in) + } + + input, ok := in.Parameters.(*CreateConnectorInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateConnectorInput ") + } + + if input.ClientToken == nil { + t, err := m.tokenProvider.GetIdempotencyToken() + if err != nil { + return out, metadata, err + } + input.ClientToken = &t + } + return next.HandleInitialize(ctx, in) +} +func addIdempotencyToken_opCreateConnectorMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateConnector{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateConnector(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "CreateConnector", + } +} + +type opCreateConnectorResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCreateConnectorResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCreateConnectorResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCreateConnectorResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCreateConnectorResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_CreateDirectoryRegistration.go b/service/pcaconnectorad/api_op_CreateDirectoryRegistration.go new file mode 100644 index 00000000000..a5b0e45f797 --- /dev/null +++ b/service/pcaconnectorad/api_op_CreateDirectoryRegistration.go @@ -0,0 +1,305 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a directory registration that authorizes communication between Amazon +// Web Services Private CA and an Active Directory +func (c *Client) CreateDirectoryRegistration(ctx context.Context, params *CreateDirectoryRegistrationInput, optFns ...func(*Options)) (*CreateDirectoryRegistrationOutput, error) { + if params == nil { + params = &CreateDirectoryRegistrationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateDirectoryRegistration", params, optFns, c.addOperationCreateDirectoryRegistrationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateDirectoryRegistrationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateDirectoryRegistrationInput struct { + + // The identifier of the Active Directory. + // + // This member is required. + DirectoryId *string + + // Idempotency token. + ClientToken *string + + // Metadata assigned to a directory registration consisting of a key-value pair. + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateDirectoryRegistrationOutput struct { + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + DirectoryRegistrationArn *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateDirectoryRegistrationMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateDirectoryRegistration{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateDirectoryRegistration{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCreateDirectoryRegistrationResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addIdempotencyToken_opCreateDirectoryRegistrationMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateDirectoryRegistrationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateDirectoryRegistration(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateDirectoryRegistration struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateDirectoryRegistration) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateDirectoryRegistration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.tokenProvider == nil { + return next.HandleInitialize(ctx, in) + } + + input, ok := in.Parameters.(*CreateDirectoryRegistrationInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateDirectoryRegistrationInput ") + } + + if input.ClientToken == nil { + t, err := m.tokenProvider.GetIdempotencyToken() + if err != nil { + return out, metadata, err + } + input.ClientToken = &t + } + return next.HandleInitialize(ctx, in) +} +func addIdempotencyToken_opCreateDirectoryRegistrationMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateDirectoryRegistration{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateDirectoryRegistration(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "CreateDirectoryRegistration", + } +} + +type opCreateDirectoryRegistrationResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCreateDirectoryRegistrationResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCreateDirectoryRegistrationResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCreateDirectoryRegistrationResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCreateDirectoryRegistrationResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_CreateServicePrincipalName.go b/service/pcaconnectorad/api_op_CreateServicePrincipalName.go new file mode 100644 index 00000000000..8d0eef356f8 --- /dev/null +++ b/service/pcaconnectorad/api_op_CreateServicePrincipalName.go @@ -0,0 +1,305 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates a service principal name (SPN) for the service account in Active +// Directory. Kerberos authentication uses SPNs to associate a service instance +// with a service sign-in account. +func (c *Client) CreateServicePrincipalName(ctx context.Context, params *CreateServicePrincipalNameInput, optFns ...func(*Options)) (*CreateServicePrincipalNameOutput, error) { + if params == nil { + params = &CreateServicePrincipalNameInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateServicePrincipalName", params, optFns, c.addOperationCreateServicePrincipalNameMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateServicePrincipalNameOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateServicePrincipalNameInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + // + // This member is required. + ConnectorArn *string + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + // + // This member is required. + DirectoryRegistrationArn *string + + // Idempotency token. + ClientToken *string + + noSmithyDocumentSerde +} + +type CreateServicePrincipalNameOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateServicePrincipalNameMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateServicePrincipalName{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateServicePrincipalName{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCreateServicePrincipalNameResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addIdempotencyToken_opCreateServicePrincipalNameMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateServicePrincipalNameValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateServicePrincipalName(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateServicePrincipalName struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateServicePrincipalName) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateServicePrincipalName) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.tokenProvider == nil { + return next.HandleInitialize(ctx, in) + } + + input, ok := in.Parameters.(*CreateServicePrincipalNameInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateServicePrincipalNameInput ") + } + + if input.ClientToken == nil { + t, err := m.tokenProvider.GetIdempotencyToken() + if err != nil { + return out, metadata, err + } + input.ClientToken = &t + } + return next.HandleInitialize(ctx, in) +} +func addIdempotencyToken_opCreateServicePrincipalNameMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateServicePrincipalName{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateServicePrincipalName(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "CreateServicePrincipalName", + } +} + +type opCreateServicePrincipalNameResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCreateServicePrincipalNameResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCreateServicePrincipalNameResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCreateServicePrincipalNameResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCreateServicePrincipalNameResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_CreateTemplate.go b/service/pcaconnectorad/api_op_CreateTemplate.go new file mode 100644 index 00000000000..a2c277f9ebc --- /dev/null +++ b/service/pcaconnectorad/api_op_CreateTemplate.go @@ -0,0 +1,319 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Creates an Active Directory compatible certificate template. The connectors +// issues certificates using these templates based on the requester’s Active +// Directory group membership. +func (c *Client) CreateTemplate(ctx context.Context, params *CreateTemplateInput, optFns ...func(*Options)) (*CreateTemplateOutput, error) { + if params == nil { + params = &CreateTemplateInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateTemplate", params, optFns, c.addOperationCreateTemplateMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateTemplateOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateTemplateInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + // + // This member is required. + ConnectorArn *string + + // Template configuration to define the information included in certificates. + // Define certificate validity and renewal periods, certificate request handling + // and enrollment options, key usage extensions, application policies, and + // cryptography settings. + // + // This member is required. + Definition types.TemplateDefinition + + // Name of the template. The template name must be unique. + // + // This member is required. + Name *string + + // Idempotency token. + ClientToken *string + + // Metadata assigned to a template consisting of a key-value pair. + Tags map[string]string + + noSmithyDocumentSerde +} + +type CreateTemplateOutput struct { + + // If successful, the Amazon Resource Name (ARN) of the template. + TemplateArn *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateTemplateMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateTemplate{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateTemplate{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCreateTemplateResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addIdempotencyToken_opCreateTemplateMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateTemplateValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTemplate(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateTemplate struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateTemplate) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateTemplate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.tokenProvider == nil { + return next.HandleInitialize(ctx, in) + } + + input, ok := in.Parameters.(*CreateTemplateInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateTemplateInput ") + } + + if input.ClientToken == nil { + t, err := m.tokenProvider.GetIdempotencyToken() + if err != nil { + return out, metadata, err + } + input.ClientToken = &t + } + return next.HandleInitialize(ctx, in) +} +func addIdempotencyToken_opCreateTemplateMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateTemplate{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateTemplate(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "CreateTemplate", + } +} + +type opCreateTemplateResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCreateTemplateResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCreateTemplateResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCreateTemplateResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCreateTemplateResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_CreateTemplateGroupAccessControlEntry.go b/service/pcaconnectorad/api_op_CreateTemplateGroupAccessControlEntry.go new file mode 100644 index 00000000000..9f79fbd89fb --- /dev/null +++ b/service/pcaconnectorad/api_op_CreateTemplateGroupAccessControlEntry.go @@ -0,0 +1,317 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Create a group access control entry. Allow or deny Active Directory groups from +// enrolling and/or autoenrolling with the template based on the group security +// identifiers (SIDs). +func (c *Client) CreateTemplateGroupAccessControlEntry(ctx context.Context, params *CreateTemplateGroupAccessControlEntryInput, optFns ...func(*Options)) (*CreateTemplateGroupAccessControlEntryOutput, error) { + if params == nil { + params = &CreateTemplateGroupAccessControlEntryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "CreateTemplateGroupAccessControlEntry", params, optFns, c.addOperationCreateTemplateGroupAccessControlEntryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*CreateTemplateGroupAccessControlEntryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type CreateTemplateGroupAccessControlEntryInput struct { + + // Allow or deny permissions for an Active Directory group to enroll or autoenroll + // certificates for a template. + // + // This member is required. + AccessRights *types.AccessRights + + // Name of the Active Directory group. This name does not need to match the group + // name in Active Directory. + // + // This member is required. + GroupDisplayName *string + + // Security identifier (SID) of the group object from Active Directory. The SID + // starts with "S-". + // + // This member is required. + GroupSecurityIdentifier *string + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + // + // This member is required. + TemplateArn *string + + // Idempotency token. + ClientToken *string + + noSmithyDocumentSerde +} + +type CreateTemplateGroupAccessControlEntryOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationCreateTemplateGroupAccessControlEntryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateTemplateGroupAccessControlEntry{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateTemplateGroupAccessControlEntry{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addCreateTemplateGroupAccessControlEntryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addIdempotencyToken_opCreateTemplateGroupAccessControlEntryMiddleware(stack, options); err != nil { + return err + } + if err = addOpCreateTemplateGroupAccessControlEntryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTemplateGroupAccessControlEntry(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpCreateTemplateGroupAccessControlEntry struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpCreateTemplateGroupAccessControlEntry) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpCreateTemplateGroupAccessControlEntry) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.tokenProvider == nil { + return next.HandleInitialize(ctx, in) + } + + input, ok := in.Parameters.(*CreateTemplateGroupAccessControlEntryInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateTemplateGroupAccessControlEntryInput ") + } + + if input.ClientToken == nil { + t, err := m.tokenProvider.GetIdempotencyToken() + if err != nil { + return out, metadata, err + } + input.ClientToken = &t + } + return next.HandleInitialize(ctx, in) +} +func addIdempotencyToken_opCreateTemplateGroupAccessControlEntryMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpCreateTemplateGroupAccessControlEntry{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opCreateTemplateGroupAccessControlEntry(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "CreateTemplateGroupAccessControlEntry", + } +} + +type opCreateTemplateGroupAccessControlEntryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opCreateTemplateGroupAccessControlEntryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opCreateTemplateGroupAccessControlEntryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addCreateTemplateGroupAccessControlEntryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opCreateTemplateGroupAccessControlEntryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_DeleteConnector.go b/service/pcaconnectorad/api_op_DeleteConnector.go new file mode 100644 index 00000000000..edc8644ce6a --- /dev/null +++ b/service/pcaconnectorad/api_op_DeleteConnector.go @@ -0,0 +1,264 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a connector for Active Directory. You must provide the Amazon Resource +// Name (ARN) of the connector that you want to delete. You can find the ARN by +// calling the +// https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_ListConnectors (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_ListConnectors) +// action. Deleting a connector does not deregister your directory with Amazon Web +// Services Private CA. You can deregister your directory by calling the +// https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_DeleteDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_DeleteDirectoryRegistration) +// action. +func (c *Client) DeleteConnector(ctx context.Context, params *DeleteConnectorInput, optFns ...func(*Options)) (*DeleteConnectorOutput, error) { + if params == nil { + params = &DeleteConnectorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteConnector", params, optFns, c.addOperationDeleteConnectorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteConnectorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteConnectorInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + // + // This member is required. + ConnectorArn *string + + noSmithyDocumentSerde +} + +type DeleteConnectorOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteConnectorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteConnector{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteConnector{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addDeleteConnectorResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpDeleteConnectorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteConnector(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteConnector(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "DeleteConnector", + } +} + +type opDeleteConnectorResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opDeleteConnectorResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opDeleteConnectorResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addDeleteConnectorResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opDeleteConnectorResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_DeleteDirectoryRegistration.go b/service/pcaconnectorad/api_op_DeleteDirectoryRegistration.go new file mode 100644 index 00000000000..c7e8fecb124 --- /dev/null +++ b/service/pcaconnectorad/api_op_DeleteDirectoryRegistration.go @@ -0,0 +1,259 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a directory registration. Deleting a directory registration +// deauthorizes Amazon Web Services Private CA with the directory. +func (c *Client) DeleteDirectoryRegistration(ctx context.Context, params *DeleteDirectoryRegistrationInput, optFns ...func(*Options)) (*DeleteDirectoryRegistrationOutput, error) { + if params == nil { + params = &DeleteDirectoryRegistrationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteDirectoryRegistration", params, optFns, c.addOperationDeleteDirectoryRegistrationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteDirectoryRegistrationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteDirectoryRegistrationInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + // + // This member is required. + DirectoryRegistrationArn *string + + noSmithyDocumentSerde +} + +type DeleteDirectoryRegistrationOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteDirectoryRegistrationMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteDirectoryRegistration{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteDirectoryRegistration{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addDeleteDirectoryRegistrationResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpDeleteDirectoryRegistrationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteDirectoryRegistration(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteDirectoryRegistration(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "DeleteDirectoryRegistration", + } +} + +type opDeleteDirectoryRegistrationResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opDeleteDirectoryRegistrationResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opDeleteDirectoryRegistrationResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addDeleteDirectoryRegistrationResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opDeleteDirectoryRegistrationResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_DeleteServicePrincipalName.go b/service/pcaconnectorad/api_op_DeleteServicePrincipalName.go new file mode 100644 index 00000000000..c4922bd54e1 --- /dev/null +++ b/service/pcaconnectorad/api_op_DeleteServicePrincipalName.go @@ -0,0 +1,265 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes the service principal name (SPN) used by a connector to authenticate +// with your Active Directory. +func (c *Client) DeleteServicePrincipalName(ctx context.Context, params *DeleteServicePrincipalNameInput, optFns ...func(*Options)) (*DeleteServicePrincipalNameOutput, error) { + if params == nil { + params = &DeleteServicePrincipalNameInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteServicePrincipalName", params, optFns, c.addOperationDeleteServicePrincipalNameMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteServicePrincipalNameOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteServicePrincipalNameInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + // + // This member is required. + ConnectorArn *string + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + // + // This member is required. + DirectoryRegistrationArn *string + + noSmithyDocumentSerde +} + +type DeleteServicePrincipalNameOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteServicePrincipalNameMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteServicePrincipalName{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteServicePrincipalName{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addDeleteServicePrincipalNameResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpDeleteServicePrincipalNameValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteServicePrincipalName(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteServicePrincipalName(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "DeleteServicePrincipalName", + } +} + +type opDeleteServicePrincipalNameResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opDeleteServicePrincipalNameResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opDeleteServicePrincipalNameResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addDeleteServicePrincipalNameResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opDeleteServicePrincipalNameResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_DeleteTemplate.go b/service/pcaconnectorad/api_op_DeleteTemplate.go new file mode 100644 index 00000000000..c3e0a5db2f8 --- /dev/null +++ b/service/pcaconnectorad/api_op_DeleteTemplate.go @@ -0,0 +1,258 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a template. Certificates issued using the template are still valid +// until they are revoked or expired. +func (c *Client) DeleteTemplate(ctx context.Context, params *DeleteTemplateInput, optFns ...func(*Options)) (*DeleteTemplateOutput, error) { + if params == nil { + params = &DeleteTemplateInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteTemplate", params, optFns, c.addOperationDeleteTemplateMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteTemplateOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteTemplateInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + // + // This member is required. + TemplateArn *string + + noSmithyDocumentSerde +} + +type DeleteTemplateOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteTemplateMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteTemplate{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteTemplate{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addDeleteTemplateResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpDeleteTemplateValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteTemplate(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteTemplate(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "DeleteTemplate", + } +} + +type opDeleteTemplateResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opDeleteTemplateResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opDeleteTemplateResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addDeleteTemplateResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opDeleteTemplateResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_DeleteTemplateGroupAccessControlEntry.go b/service/pcaconnectorad/api_op_DeleteTemplateGroupAccessControlEntry.go new file mode 100644 index 00000000000..376a50ee695 --- /dev/null +++ b/service/pcaconnectorad/api_op_DeleteTemplateGroupAccessControlEntry.go @@ -0,0 +1,263 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes a group access control entry. +func (c *Client) DeleteTemplateGroupAccessControlEntry(ctx context.Context, params *DeleteTemplateGroupAccessControlEntryInput, optFns ...func(*Options)) (*DeleteTemplateGroupAccessControlEntryOutput, error) { + if params == nil { + params = &DeleteTemplateGroupAccessControlEntryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteTemplateGroupAccessControlEntry", params, optFns, c.addOperationDeleteTemplateGroupAccessControlEntryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteTemplateGroupAccessControlEntryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteTemplateGroupAccessControlEntryInput struct { + + // Security identifier (SID) of the group object from Active Directory. The SID + // starts with "S-". + // + // This member is required. + GroupSecurityIdentifier *string + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + // + // This member is required. + TemplateArn *string + + noSmithyDocumentSerde +} + +type DeleteTemplateGroupAccessControlEntryOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteTemplateGroupAccessControlEntryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDeleteTemplateGroupAccessControlEntry{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteTemplateGroupAccessControlEntry{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addDeleteTemplateGroupAccessControlEntryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpDeleteTemplateGroupAccessControlEntryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteTemplateGroupAccessControlEntry(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opDeleteTemplateGroupAccessControlEntry(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "DeleteTemplateGroupAccessControlEntry", + } +} + +type opDeleteTemplateGroupAccessControlEntryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opDeleteTemplateGroupAccessControlEntryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opDeleteTemplateGroupAccessControlEntryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addDeleteTemplateGroupAccessControlEntryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opDeleteTemplateGroupAccessControlEntryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_GetConnector.go b/service/pcaconnectorad/api_op_GetConnector.go new file mode 100644 index 00000000000..a78e8d41f59 --- /dev/null +++ b/service/pcaconnectorad/api_op_GetConnector.go @@ -0,0 +1,263 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists information about your connector. You specify the connector on input by +// its ARN (Amazon Resource Name). +func (c *Client) GetConnector(ctx context.Context, params *GetConnectorInput, optFns ...func(*Options)) (*GetConnectorOutput, error) { + if params == nil { + params = &GetConnectorInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetConnector", params, optFns, c.addOperationGetConnectorMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetConnectorOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetConnectorInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + // + // This member is required. + ConnectorArn *string + + noSmithyDocumentSerde +} + +type GetConnectorOutput struct { + + // A structure that contains information about your connector. + Connector *types.Connector + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetConnectorMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetConnector{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetConnector{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetConnectorResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetConnectorValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetConnector(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetConnector(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "GetConnector", + } +} + +type opGetConnectorResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetConnectorResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetConnectorResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetConnectorResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetConnectorResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_GetDirectoryRegistration.go b/service/pcaconnectorad/api_op_GetDirectoryRegistration.go new file mode 100644 index 00000000000..7a4d7012ab7 --- /dev/null +++ b/service/pcaconnectorad/api_op_GetDirectoryRegistration.go @@ -0,0 +1,264 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// A structure that contains information about your directory registration. +func (c *Client) GetDirectoryRegistration(ctx context.Context, params *GetDirectoryRegistrationInput, optFns ...func(*Options)) (*GetDirectoryRegistrationOutput, error) { + if params == nil { + params = &GetDirectoryRegistrationInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetDirectoryRegistration", params, optFns, c.addOperationGetDirectoryRegistrationMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetDirectoryRegistrationOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetDirectoryRegistrationInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + // + // This member is required. + DirectoryRegistrationArn *string + + noSmithyDocumentSerde +} + +type GetDirectoryRegistrationOutput struct { + + // The directory registration represents the authorization of the connector + // service with a directory. + DirectoryRegistration *types.DirectoryRegistration + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetDirectoryRegistrationMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetDirectoryRegistration{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetDirectoryRegistration{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetDirectoryRegistrationResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetDirectoryRegistrationValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDirectoryRegistration(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetDirectoryRegistration(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "GetDirectoryRegistration", + } +} + +type opGetDirectoryRegistrationResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetDirectoryRegistrationResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetDirectoryRegistrationResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetDirectoryRegistrationResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetDirectoryRegistrationResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_GetServicePrincipalName.go b/service/pcaconnectorad/api_op_GetServicePrincipalName.go new file mode 100644 index 00000000000..39f1c22c583 --- /dev/null +++ b/service/pcaconnectorad/api_op_GetServicePrincipalName.go @@ -0,0 +1,271 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the service principal name that the connector uses to authenticate with +// Active Directory. +func (c *Client) GetServicePrincipalName(ctx context.Context, params *GetServicePrincipalNameInput, optFns ...func(*Options)) (*GetServicePrincipalNameOutput, error) { + if params == nil { + params = &GetServicePrincipalNameInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetServicePrincipalName", params, optFns, c.addOperationGetServicePrincipalNameMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetServicePrincipalNameOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetServicePrincipalNameInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + // + // This member is required. + ConnectorArn *string + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + // + // This member is required. + DirectoryRegistrationArn *string + + noSmithyDocumentSerde +} + +type GetServicePrincipalNameOutput struct { + + // The service principal name that the connector uses to authenticate with Active + // Directory. + ServicePrincipalName *types.ServicePrincipalName + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetServicePrincipalNameMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetServicePrincipalName{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetServicePrincipalName{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetServicePrincipalNameResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetServicePrincipalNameValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetServicePrincipalName(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetServicePrincipalName(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "GetServicePrincipalName", + } +} + +type opGetServicePrincipalNameResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetServicePrincipalNameResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetServicePrincipalNameResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetServicePrincipalNameResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetServicePrincipalNameResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_GetTemplate.go b/service/pcaconnectorad/api_op_GetTemplate.go new file mode 100644 index 00000000000..f9102d990a3 --- /dev/null +++ b/service/pcaconnectorad/api_op_GetTemplate.go @@ -0,0 +1,264 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves a certificate template that the connector uses to issue certificates +// from a private CA. +func (c *Client) GetTemplate(ctx context.Context, params *GetTemplateInput, optFns ...func(*Options)) (*GetTemplateOutput, error) { + if params == nil { + params = &GetTemplateInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetTemplate", params, optFns, c.addOperationGetTemplateMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetTemplateOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetTemplateInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + // + // This member is required. + TemplateArn *string + + noSmithyDocumentSerde +} + +type GetTemplateOutput struct { + + // A certificate template that the connector uses to issue certificates from a + // private CA. + Template *types.Template + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetTemplateMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetTemplate{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetTemplate{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetTemplateResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetTemplateValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTemplate(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetTemplate(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "GetTemplate", + } +} + +type opGetTemplateResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetTemplateResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetTemplateResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetTemplateResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetTemplateResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_GetTemplateGroupAccessControlEntry.go b/service/pcaconnectorad/api_op_GetTemplateGroupAccessControlEntry.go new file mode 100644 index 00000000000..e0b4a7b3523 --- /dev/null +++ b/service/pcaconnectorad/api_op_GetTemplateGroupAccessControlEntry.go @@ -0,0 +1,269 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves the group access control entries for a template. +func (c *Client) GetTemplateGroupAccessControlEntry(ctx context.Context, params *GetTemplateGroupAccessControlEntryInput, optFns ...func(*Options)) (*GetTemplateGroupAccessControlEntryOutput, error) { + if params == nil { + params = &GetTemplateGroupAccessControlEntryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetTemplateGroupAccessControlEntry", params, optFns, c.addOperationGetTemplateGroupAccessControlEntryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetTemplateGroupAccessControlEntryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetTemplateGroupAccessControlEntryInput struct { + + // Security identifier (SID) of the group object from Active Directory. The SID + // starts with "S-". + // + // This member is required. + GroupSecurityIdentifier *string + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + // + // This member is required. + TemplateArn *string + + noSmithyDocumentSerde +} + +type GetTemplateGroupAccessControlEntryOutput struct { + + // An access control entry allows or denies an Active Directory group from + // enrolling and/or autoenrolling with a template. + AccessControlEntry *types.AccessControlEntry + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetTemplateGroupAccessControlEntryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetTemplateGroupAccessControlEntry{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetTemplateGroupAccessControlEntry{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addGetTemplateGroupAccessControlEntryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpGetTemplateGroupAccessControlEntryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetTemplateGroupAccessControlEntry(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opGetTemplateGroupAccessControlEntry(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "GetTemplateGroupAccessControlEntry", + } +} + +type opGetTemplateGroupAccessControlEntryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opGetTemplateGroupAccessControlEntryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opGetTemplateGroupAccessControlEntryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addGetTemplateGroupAccessControlEntryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opGetTemplateGroupAccessControlEntryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_ListConnectors.go b/service/pcaconnectorad/api_op_ListConnectors.go new file mode 100644 index 00000000000..dc710e68168 --- /dev/null +++ b/service/pcaconnectorad/api_op_ListConnectors.go @@ -0,0 +1,364 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the connectors that you created by using the +// https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector) +// action. +func (c *Client) ListConnectors(ctx context.Context, params *ListConnectorsInput, optFns ...func(*Options)) (*ListConnectorsOutput, error) { + if params == nil { + params = &ListConnectorsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListConnectors", params, optFns, c.addOperationListConnectorsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListConnectorsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListConnectorsInput struct { + + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + MaxResults *int32 + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + noSmithyDocumentSerde +} + +type ListConnectorsOutput struct { + + // Summary information about each connector you have created. + Connectors []types.ConnectorSummary + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListConnectorsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListConnectors{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListConnectors{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListConnectorsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListConnectors(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListConnectorsAPIClient is a client that implements the ListConnectors +// operation. +type ListConnectorsAPIClient interface { + ListConnectors(context.Context, *ListConnectorsInput, ...func(*Options)) (*ListConnectorsOutput, error) +} + +var _ ListConnectorsAPIClient = (*Client)(nil) + +// ListConnectorsPaginatorOptions is the paginator options for ListConnectors +type ListConnectorsPaginatorOptions struct { + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListConnectorsPaginator is a paginator for ListConnectors +type ListConnectorsPaginator struct { + options ListConnectorsPaginatorOptions + client ListConnectorsAPIClient + params *ListConnectorsInput + nextToken *string + firstPage bool +} + +// NewListConnectorsPaginator returns a new ListConnectorsPaginator +func NewListConnectorsPaginator(client ListConnectorsAPIClient, params *ListConnectorsInput, optFns ...func(*ListConnectorsPaginatorOptions)) *ListConnectorsPaginator { + if params == nil { + params = &ListConnectorsInput{} + } + + options := ListConnectorsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListConnectorsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListConnectorsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListConnectors page. +func (p *ListConnectorsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListConnectorsOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + result, err := p.client.ListConnectors(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_opListConnectors(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "ListConnectors", + } +} + +type opListConnectorsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListConnectorsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListConnectorsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListConnectorsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListConnectorsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_ListDirectoryRegistrations.go b/service/pcaconnectorad/api_op_ListDirectoryRegistrations.go new file mode 100644 index 00000000000..d6233de6c25 --- /dev/null +++ b/service/pcaconnectorad/api_op_ListDirectoryRegistrations.go @@ -0,0 +1,367 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the directory registrations that you created by using the +// https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration) +// action. +func (c *Client) ListDirectoryRegistrations(ctx context.Context, params *ListDirectoryRegistrationsInput, optFns ...func(*Options)) (*ListDirectoryRegistrationsOutput, error) { + if params == nil { + params = &ListDirectoryRegistrationsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListDirectoryRegistrations", params, optFns, c.addOperationListDirectoryRegistrationsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListDirectoryRegistrationsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListDirectoryRegistrationsInput struct { + + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + MaxResults *int32 + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + noSmithyDocumentSerde +} + +type ListDirectoryRegistrationsOutput struct { + + // Summary information about each directory registration you have created. + DirectoryRegistrations []types.DirectoryRegistrationSummary + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListDirectoryRegistrationsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListDirectoryRegistrations{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListDirectoryRegistrations{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListDirectoryRegistrationsResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListDirectoryRegistrations(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListDirectoryRegistrationsAPIClient is a client that implements the +// ListDirectoryRegistrations operation. +type ListDirectoryRegistrationsAPIClient interface { + ListDirectoryRegistrations(context.Context, *ListDirectoryRegistrationsInput, ...func(*Options)) (*ListDirectoryRegistrationsOutput, error) +} + +var _ ListDirectoryRegistrationsAPIClient = (*Client)(nil) + +// ListDirectoryRegistrationsPaginatorOptions is the paginator options for +// ListDirectoryRegistrations +type ListDirectoryRegistrationsPaginatorOptions struct { + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListDirectoryRegistrationsPaginator is a paginator for +// ListDirectoryRegistrations +type ListDirectoryRegistrationsPaginator struct { + options ListDirectoryRegistrationsPaginatorOptions + client ListDirectoryRegistrationsAPIClient + params *ListDirectoryRegistrationsInput + nextToken *string + firstPage bool +} + +// NewListDirectoryRegistrationsPaginator returns a new +// ListDirectoryRegistrationsPaginator +func NewListDirectoryRegistrationsPaginator(client ListDirectoryRegistrationsAPIClient, params *ListDirectoryRegistrationsInput, optFns ...func(*ListDirectoryRegistrationsPaginatorOptions)) *ListDirectoryRegistrationsPaginator { + if params == nil { + params = &ListDirectoryRegistrationsInput{} + } + + options := ListDirectoryRegistrationsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListDirectoryRegistrationsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListDirectoryRegistrationsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListDirectoryRegistrations page. +func (p *ListDirectoryRegistrationsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListDirectoryRegistrationsOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + result, err := p.client.ListDirectoryRegistrations(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_opListDirectoryRegistrations(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "ListDirectoryRegistrations", + } +} + +type opListDirectoryRegistrationsResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListDirectoryRegistrationsResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListDirectoryRegistrationsResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListDirectoryRegistrationsResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListDirectoryRegistrationsResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_ListServicePrincipalNames.go b/service/pcaconnectorad/api_op_ListServicePrincipalNames.go new file mode 100644 index 00000000000..7b03aa42acb --- /dev/null +++ b/service/pcaconnectorad/api_op_ListServicePrincipalNames.go @@ -0,0 +1,376 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the service principal names that the connector uses to authenticate with +// Active Directory. +func (c *Client) ListServicePrincipalNames(ctx context.Context, params *ListServicePrincipalNamesInput, optFns ...func(*Options)) (*ListServicePrincipalNamesOutput, error) { + if params == nil { + params = &ListServicePrincipalNamesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListServicePrincipalNames", params, optFns, c.addOperationListServicePrincipalNamesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListServicePrincipalNamesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListServicePrincipalNamesInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + // + // This member is required. + DirectoryRegistrationArn *string + + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + MaxResults *int32 + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + noSmithyDocumentSerde +} + +type ListServicePrincipalNamesOutput struct { + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + // The service principal name, if any, that the connector uses to authenticate + // with Active Directory. + ServicePrincipalNames []types.ServicePrincipalNameSummary + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListServicePrincipalNamesMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListServicePrincipalNames{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListServicePrincipalNames{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListServicePrincipalNamesResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpListServicePrincipalNamesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListServicePrincipalNames(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListServicePrincipalNamesAPIClient is a client that implements the +// ListServicePrincipalNames operation. +type ListServicePrincipalNamesAPIClient interface { + ListServicePrincipalNames(context.Context, *ListServicePrincipalNamesInput, ...func(*Options)) (*ListServicePrincipalNamesOutput, error) +} + +var _ ListServicePrincipalNamesAPIClient = (*Client)(nil) + +// ListServicePrincipalNamesPaginatorOptions is the paginator options for +// ListServicePrincipalNames +type ListServicePrincipalNamesPaginatorOptions struct { + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListServicePrincipalNamesPaginator is a paginator for ListServicePrincipalNames +type ListServicePrincipalNamesPaginator struct { + options ListServicePrincipalNamesPaginatorOptions + client ListServicePrincipalNamesAPIClient + params *ListServicePrincipalNamesInput + nextToken *string + firstPage bool +} + +// NewListServicePrincipalNamesPaginator returns a new +// ListServicePrincipalNamesPaginator +func NewListServicePrincipalNamesPaginator(client ListServicePrincipalNamesAPIClient, params *ListServicePrincipalNamesInput, optFns ...func(*ListServicePrincipalNamesPaginatorOptions)) *ListServicePrincipalNamesPaginator { + if params == nil { + params = &ListServicePrincipalNamesInput{} + } + + options := ListServicePrincipalNamesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListServicePrincipalNamesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListServicePrincipalNamesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListServicePrincipalNames page. +func (p *ListServicePrincipalNamesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListServicePrincipalNamesOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + result, err := p.client.ListServicePrincipalNames(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_opListServicePrincipalNames(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "ListServicePrincipalNames", + } +} + +type opListServicePrincipalNamesResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListServicePrincipalNamesResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListServicePrincipalNamesResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListServicePrincipalNamesResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListServicePrincipalNamesResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_ListTagsForResource.go b/service/pcaconnectorad/api_op_ListTagsForResource.go new file mode 100644 index 00000000000..e070b267a75 --- /dev/null +++ b/service/pcaconnectorad/api_op_ListTagsForResource.go @@ -0,0 +1,260 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the tags, if any, that are associated with your resource. +func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) { + if params == nil { + params = &ListTagsForResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListTagsForResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListTagsForResourceInput struct { + + // The Amazon Resource Name (ARN) that was returned when you created the resource. + // + // This member is required. + ResourceArn *string + + noSmithyDocumentSerde +} + +type ListTagsForResourceOutput struct { + + // The tags, if any, that are associated with your resource. + Tags map[string]string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListTagsForResource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTagsForResource{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListTagsForResourceResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "ListTagsForResource", + } +} + +type opListTagsForResourceResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListTagsForResourceResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListTagsForResourceResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListTagsForResourceResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListTagsForResourceResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_ListTemplateGroupAccessControlEntries.go b/service/pcaconnectorad/api_op_ListTemplateGroupAccessControlEntries.go new file mode 100644 index 00000000000..19a7889b9b2 --- /dev/null +++ b/service/pcaconnectorad/api_op_ListTemplateGroupAccessControlEntries.go @@ -0,0 +1,375 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists group access control entries you created. +func (c *Client) ListTemplateGroupAccessControlEntries(ctx context.Context, params *ListTemplateGroupAccessControlEntriesInput, optFns ...func(*Options)) (*ListTemplateGroupAccessControlEntriesOutput, error) { + if params == nil { + params = &ListTemplateGroupAccessControlEntriesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListTemplateGroupAccessControlEntries", params, optFns, c.addOperationListTemplateGroupAccessControlEntriesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListTemplateGroupAccessControlEntriesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListTemplateGroupAccessControlEntriesInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + // + // This member is required. + TemplateArn *string + + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + MaxResults *int32 + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + noSmithyDocumentSerde +} + +type ListTemplateGroupAccessControlEntriesOutput struct { + + // An access control entry grants or denies permission to an Active Directory + // group to enroll certificates for a template. + AccessControlEntries []types.AccessControlEntrySummary + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListTemplateGroupAccessControlEntriesMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListTemplateGroupAccessControlEntries{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTemplateGroupAccessControlEntries{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListTemplateGroupAccessControlEntriesResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpListTemplateGroupAccessControlEntriesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTemplateGroupAccessControlEntries(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListTemplateGroupAccessControlEntriesAPIClient is a client that implements the +// ListTemplateGroupAccessControlEntries operation. +type ListTemplateGroupAccessControlEntriesAPIClient interface { + ListTemplateGroupAccessControlEntries(context.Context, *ListTemplateGroupAccessControlEntriesInput, ...func(*Options)) (*ListTemplateGroupAccessControlEntriesOutput, error) +} + +var _ ListTemplateGroupAccessControlEntriesAPIClient = (*Client)(nil) + +// ListTemplateGroupAccessControlEntriesPaginatorOptions is the paginator options +// for ListTemplateGroupAccessControlEntries +type ListTemplateGroupAccessControlEntriesPaginatorOptions struct { + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListTemplateGroupAccessControlEntriesPaginator is a paginator for +// ListTemplateGroupAccessControlEntries +type ListTemplateGroupAccessControlEntriesPaginator struct { + options ListTemplateGroupAccessControlEntriesPaginatorOptions + client ListTemplateGroupAccessControlEntriesAPIClient + params *ListTemplateGroupAccessControlEntriesInput + nextToken *string + firstPage bool +} + +// NewListTemplateGroupAccessControlEntriesPaginator returns a new +// ListTemplateGroupAccessControlEntriesPaginator +func NewListTemplateGroupAccessControlEntriesPaginator(client ListTemplateGroupAccessControlEntriesAPIClient, params *ListTemplateGroupAccessControlEntriesInput, optFns ...func(*ListTemplateGroupAccessControlEntriesPaginatorOptions)) *ListTemplateGroupAccessControlEntriesPaginator { + if params == nil { + params = &ListTemplateGroupAccessControlEntriesInput{} + } + + options := ListTemplateGroupAccessControlEntriesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListTemplateGroupAccessControlEntriesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListTemplateGroupAccessControlEntriesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListTemplateGroupAccessControlEntries page. +func (p *ListTemplateGroupAccessControlEntriesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListTemplateGroupAccessControlEntriesOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + result, err := p.client.ListTemplateGroupAccessControlEntries(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_opListTemplateGroupAccessControlEntries(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "ListTemplateGroupAccessControlEntries", + } +} + +type opListTemplateGroupAccessControlEntriesResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListTemplateGroupAccessControlEntriesResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListTemplateGroupAccessControlEntriesResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListTemplateGroupAccessControlEntriesResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListTemplateGroupAccessControlEntriesResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_ListTemplates.go b/service/pcaconnectorad/api_op_ListTemplates.go new file mode 100644 index 00000000000..257cd94b367 --- /dev/null +++ b/service/pcaconnectorad/api_op_ListTemplates.go @@ -0,0 +1,370 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists the templates, if any, that are associated with a connector. +func (c *Client) ListTemplates(ctx context.Context, params *ListTemplatesInput, optFns ...func(*Options)) (*ListTemplatesOutput, error) { + if params == nil { + params = &ListTemplatesInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListTemplates", params, optFns, c.addOperationListTemplatesMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListTemplatesOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListTemplatesInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + // + // This member is required. + ConnectorArn *string + + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + MaxResults *int32 + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + noSmithyDocumentSerde +} + +type ListTemplatesOutput struct { + + // Use this parameter when paginating results in a subsequent request after you + // receive a response with truncated results. Set it to the value of the NextToken + // parameter from the response you just received. + NextToken *string + + // Custom configuration templates used when issuing a certificate. + Templates []types.TemplateSummary + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListTemplatesMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListTemplates{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListTemplates{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addListTemplatesResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpListTemplatesValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTemplates(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +// ListTemplatesAPIClient is a client that implements the ListTemplates operation. +type ListTemplatesAPIClient interface { + ListTemplates(context.Context, *ListTemplatesInput, ...func(*Options)) (*ListTemplatesOutput, error) +} + +var _ ListTemplatesAPIClient = (*Client)(nil) + +// ListTemplatesPaginatorOptions is the paginator options for ListTemplates +type ListTemplatesPaginatorOptions struct { + // Use this parameter when paginating results to specify the maximum number of + // items to return in the response on each page. If additional items exist beyond + // the number you specify, the NextToken element is sent in the response. Use this + // NextToken value in a subsequent request to retrieve additional items. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListTemplatesPaginator is a paginator for ListTemplates +type ListTemplatesPaginator struct { + options ListTemplatesPaginatorOptions + client ListTemplatesAPIClient + params *ListTemplatesInput + nextToken *string + firstPage bool +} + +// NewListTemplatesPaginator returns a new ListTemplatesPaginator +func NewListTemplatesPaginator(client ListTemplatesAPIClient, params *ListTemplatesInput, optFns ...func(*ListTemplatesPaginatorOptions)) *ListTemplatesPaginator { + if params == nil { + params = &ListTemplatesInput{} + } + + options := ListTemplatesPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListTemplatesPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListTemplatesPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListTemplates page. +func (p *ListTemplatesPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListTemplatesOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + result, err := p.client.ListTemplates(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_opListTemplates(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "ListTemplates", + } +} + +type opListTemplatesResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opListTemplatesResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opListTemplatesResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addListTemplatesResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opListTemplatesResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_TagResource.go b/service/pcaconnectorad/api_op_TagResource.go new file mode 100644 index 00000000000..5d05b4e8aac --- /dev/null +++ b/service/pcaconnectorad/api_op_TagResource.go @@ -0,0 +1,261 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Adds one or more tags to your resource. +func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) { + if params == nil { + params = &TagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*TagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type TagResourceInput struct { + + // The Amazon Resource Name (ARN) that was returned when you created the resource. + // + // This member is required. + ResourceArn *string + + // Metadata assigned to a directory registration consisting of a key-value pair. + // + // This member is required. + Tags map[string]string + + noSmithyDocumentSerde +} + +type TagResourceOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpTagResource{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpTagResource{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addTagResourceResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpTagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "TagResource", + } +} + +type opTagResourceResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opTagResourceResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opTagResourceResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addTagResourceResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opTagResourceResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_UntagResource.go b/service/pcaconnectorad/api_op_UntagResource.go new file mode 100644 index 00000000000..36eb022d25b --- /dev/null +++ b/service/pcaconnectorad/api_op_UntagResource.go @@ -0,0 +1,262 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Removes one or more tags from your resource. +func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) { + if params == nil { + params = &UntagResourceInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UntagResourceOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UntagResourceInput struct { + + // The Amazon Resource Name (ARN) that was returned when you created the resource. + // + // This member is required. + ResourceArn *string + + // Specifies a list of tag keys that you want to remove from the specified + // resources. + // + // 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 = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addUntagResourceResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpUntagResourceValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "UntagResource", + } +} + +type opUntagResourceResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opUntagResourceResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opUntagResourceResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addUntagResourceResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opUntagResourceResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_UpdateTemplate.go b/service/pcaconnectorad/api_op_UpdateTemplate.go new file mode 100644 index 00000000000..f33a2f221de --- /dev/null +++ b/service/pcaconnectorad/api_op_UpdateTemplate.go @@ -0,0 +1,270 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Update template configuration to define the information included in +// certificates. +func (c *Client) UpdateTemplate(ctx context.Context, params *UpdateTemplateInput, optFns ...func(*Options)) (*UpdateTemplateOutput, error) { + if params == nil { + params = &UpdateTemplateInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateTemplate", params, optFns, c.addOperationUpdateTemplateMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateTemplateOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateTemplateInput struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + // + // This member is required. + TemplateArn *string + + // Template configuration to define the information included in certificates. + // Define certificate validity and renewal periods, certificate request handling + // and enrollment options, key usage extensions, application policies, and + // cryptography settings. + Definition types.TemplateDefinition + + // This setting allows the major version of a template to be increased + // automatically. All members of Active Directory groups that are allowed to enroll + // with a template will receive a new certificate issued using that template. + ReenrollAllCertificateHolders *bool + + noSmithyDocumentSerde +} + +type UpdateTemplateOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateTemplateMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateTemplate{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateTemplate{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addUpdateTemplateResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpUpdateTemplateValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateTemplate(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateTemplate(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "UpdateTemplate", + } +} + +type opUpdateTemplateResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opUpdateTemplateResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opUpdateTemplateResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addUpdateTemplateResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opUpdateTemplateResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/api_op_UpdateTemplateGroupAccessControlEntry.go b/service/pcaconnectorad/api_op_UpdateTemplateGroupAccessControlEntry.go new file mode 100644 index 00000000000..feee5c66b9b --- /dev/null +++ b/service/pcaconnectorad/api_op_UpdateTemplateGroupAccessControlEntry.go @@ -0,0 +1,274 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Update a group access control entry you created using +// CreateTemplateGroupAccessControlEntry (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplateGroupAccessControlEntry.html) +// . +func (c *Client) UpdateTemplateGroupAccessControlEntry(ctx context.Context, params *UpdateTemplateGroupAccessControlEntryInput, optFns ...func(*Options)) (*UpdateTemplateGroupAccessControlEntryOutput, error) { + if params == nil { + params = &UpdateTemplateGroupAccessControlEntryInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "UpdateTemplateGroupAccessControlEntry", params, optFns, c.addOperationUpdateTemplateGroupAccessControlEntryMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*UpdateTemplateGroupAccessControlEntryOutput) + out.ResultMetadata = metadata + return out, nil +} + +type UpdateTemplateGroupAccessControlEntryInput struct { + + // Security identifier (SID) of the group object from Active Directory. The SID + // starts with "S-". + // + // This member is required. + GroupSecurityIdentifier *string + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + // + // This member is required. + TemplateArn *string + + // Allow or deny permissions for an Active Directory group to enroll or autoenroll + // certificates for a template. + AccessRights *types.AccessRights + + // Name of the Active Directory group. This name does not need to match the group + // name in Active Directory. + GroupDisplayName *string + + noSmithyDocumentSerde +} + +type UpdateTemplateGroupAccessControlEntryOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationUpdateTemplateGroupAccessControlEntryMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateTemplateGroupAccessControlEntry{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateTemplateGroupAccessControlEntry{}, middleware.After) + if err != nil { + return err + } + if err = addlegacyEndpointContextSetter(stack, options); 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, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addUpdateTemplateGroupAccessControlEntryResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addOpUpdateTemplateGroupAccessControlEntryValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateTemplateGroupAccessControlEntry(options.Region), middleware.Before); err != nil { + return err + } + if err = awsmiddleware.AddRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addendpointDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func newServiceMetadataMiddleware_opUpdateTemplateGroupAccessControlEntry(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "pca-connector-ad", + OperationName: "UpdateTemplateGroupAccessControlEntry", + } +} + +type opUpdateTemplateGroupAccessControlEntryResolveEndpointMiddleware struct { + EndpointResolver EndpointResolverV2 + BuiltInResolver builtInParameterResolver +} + +func (*opUpdateTemplateGroupAccessControlEntryResolveEndpointMiddleware) ID() string { + return "ResolveEndpointV2" +} + +func (m *opUpdateTemplateGroupAccessControlEntryResolveEndpointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + req, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) + } + + if m.EndpointResolver == nil { + return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") + } + + params := EndpointParameters{} + + m.BuiltInResolver.ResolveBuiltIns(¶ms) + + var resolvedEndpoint smithyendpoints.Endpoint + resolvedEndpoint, err = m.EndpointResolver.ResolveEndpoint(ctx, params) + if err != nil { + return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) + } + + req.URL = &resolvedEndpoint.URI + + for k := range resolvedEndpoint.Headers { + req.Header.Set( + k, + resolvedEndpoint.Headers.Get(k), + ) + } + + authSchemes, err := internalauth.GetAuthenticationSchemes(&resolvedEndpoint.Properties) + if err != nil { + var nfe *internalauth.NoAuthenticationSchemesFoundError + if errors.As(err, &nfe) { + // if no auth scheme is found, default to sigv4 + signingName := "pca-connector-ad" + signingRegion := m.BuiltInResolver.(*builtInResolver).Region + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + + } + var ue *internalauth.UnSupportedAuthenticationSchemeSpecifiedError + if errors.As(err, &ue) { + return out, metadata, fmt.Errorf( + "This operation requests signer version(s) %v but the client only supports %v", + ue.UnsupportedSchemes, + internalauth.SupportedSchemes, + ) + } + } + + for _, authScheme := range authSchemes { + switch authScheme.(type) { + case *internalauth.AuthenticationSchemeV4: + v4Scheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4) + var signingName, signingRegion string + if v4Scheme.SigningName == nil { + signingName = "pca-connector-ad" + } else { + signingName = *v4Scheme.SigningName + } + if v4Scheme.SigningRegion == nil { + signingRegion = m.BuiltInResolver.(*builtInResolver).Region + } else { + signingRegion = *v4Scheme.SigningRegion + } + if v4Scheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4Scheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, signingName) + ctx = awsmiddleware.SetSigningRegion(ctx, signingRegion) + break + case *internalauth.AuthenticationSchemeV4A: + v4aScheme, _ := authScheme.(*internalauth.AuthenticationSchemeV4A) + if v4aScheme.SigningName == nil { + v4aScheme.SigningName = aws.String("pca-connector-ad") + } + if v4aScheme.DisableDoubleEncoding != nil { + // The signer sets an equivalent value at client initialization time. + // Setting this context value will cause the signer to extract it + // and override the value set at client initialization time. + ctx = internalauth.SetDisableDoubleEncoding(ctx, *v4aScheme.DisableDoubleEncoding) + } + ctx = awsmiddleware.SetSigningName(ctx, *v4aScheme.SigningName) + ctx = awsmiddleware.SetSigningRegion(ctx, v4aScheme.SigningRegionSet[0]) + break + case *internalauth.AuthenticationSchemeNone: + break + } + } + + return next.HandleSerialize(ctx, in) +} + +func addUpdateTemplateGroupAccessControlEntryResolveEndpointMiddleware(stack *middleware.Stack, options Options) error { + return stack.Serialize.Insert(&opUpdateTemplateGroupAccessControlEntryResolveEndpointMiddleware{ + EndpointResolver: options.EndpointResolverV2, + BuiltInResolver: &builtInResolver{ + Region: options.Region, + UseDualStack: options.EndpointOptions.UseDualStackEndpoint, + UseFIPS: options.EndpointOptions.UseFIPSEndpoint, + Endpoint: options.BaseEndpoint, + }, + }, "ResolveEndpoint", middleware.After) +} diff --git a/service/pcaconnectorad/deserializers.go b/service/pcaconnectorad/deserializers.go new file mode 100644 index 00000000000..48c2934e31e --- /dev/null +++ b/service/pcaconnectorad/deserializers.go @@ -0,0 +1,7647 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/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" + "io/ioutil" + "strings" +) + +type awsRestjson1_deserializeOpCreateConnector struct { +} + +func (*awsRestjson1_deserializeOpCreateConnector) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateConnector) 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_deserializeOpErrorCreateConnector(response, &metadata) + } + output := &CreateConnectorOutput{} + 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_deserializeOpDocumentCreateConnectorOutput(&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_deserializeOpErrorCreateConnector(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateConnectorOutput(v **CreateConnectorOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateConnectorOutput + if *v == nil { + sv = &CreateConnectorOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ConnectorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorArn to be of type string, got %T instead", value) + } + sv.ConnectorArn = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateDirectoryRegistration struct { +} + +func (*awsRestjson1_deserializeOpCreateDirectoryRegistration) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateDirectoryRegistration) 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_deserializeOpErrorCreateDirectoryRegistration(response, &metadata) + } + output := &CreateDirectoryRegistrationOutput{} + 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_deserializeOpDocumentCreateDirectoryRegistrationOutput(&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_deserializeOpErrorCreateDirectoryRegistration(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateDirectoryRegistrationOutput(v **CreateDirectoryRegistrationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateDirectoryRegistrationOutput + if *v == nil { + sv = &CreateDirectoryRegistrationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DirectoryRegistrationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationArn to be of type string, got %T instead", value) + } + sv.DirectoryRegistrationArn = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateServicePrincipalName struct { +} + +func (*awsRestjson1_deserializeOpCreateServicePrincipalName) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateServicePrincipalName) 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_deserializeOpErrorCreateServicePrincipalName(response, &metadata) + } + output := &CreateServicePrincipalNameOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorCreateServicePrincipalName(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpCreateTemplate struct { +} + +func (*awsRestjson1_deserializeOpCreateTemplate) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateTemplate) 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_deserializeOpErrorCreateTemplate(response, &metadata) + } + output := &CreateTemplateOutput{} + 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_deserializeOpDocumentCreateTemplateOutput(&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_deserializeOpErrorCreateTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentCreateTemplateOutput(v **CreateTemplateOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *CreateTemplateOutput + if *v == nil { + sv = &CreateTemplateOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "TemplateArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateArn to be of type string, got %T instead", value) + } + sv.TemplateArn = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpCreateTemplateGroupAccessControlEntry struct { +} + +func (*awsRestjson1_deserializeOpCreateTemplateGroupAccessControlEntry) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpCreateTemplateGroupAccessControlEntry) 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_deserializeOpErrorCreateTemplateGroupAccessControlEntry(response, &metadata) + } + output := &CreateTemplateGroupAccessControlEntryOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorCreateTemplateGroupAccessControlEntry(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteConnector struct { +} + +func (*awsRestjson1_deserializeOpDeleteConnector) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteConnector) 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_deserializeOpErrorDeleteConnector(response, &metadata) + } + output := &DeleteConnectorOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteConnector(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteDirectoryRegistration struct { +} + +func (*awsRestjson1_deserializeOpDeleteDirectoryRegistration) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteDirectoryRegistration) 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_deserializeOpErrorDeleteDirectoryRegistration(response, &metadata) + } + output := &DeleteDirectoryRegistrationOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteDirectoryRegistration(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteServicePrincipalName struct { +} + +func (*awsRestjson1_deserializeOpDeleteServicePrincipalName) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteServicePrincipalName) 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_deserializeOpErrorDeleteServicePrincipalName(response, &metadata) + } + output := &DeleteServicePrincipalNameOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteServicePrincipalName(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteTemplate struct { +} + +func (*awsRestjson1_deserializeOpDeleteTemplate) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteTemplate) 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_deserializeOpErrorDeleteTemplate(response, &metadata) + } + output := &DeleteTemplateOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpDeleteTemplateGroupAccessControlEntry struct { +} + +func (*awsRestjson1_deserializeOpDeleteTemplateGroupAccessControlEntry) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDeleteTemplateGroupAccessControlEntry) 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_deserializeOpErrorDeleteTemplateGroupAccessControlEntry(response, &metadata) + } + output := &DeleteTemplateGroupAccessControlEntryOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDeleteTemplateGroupAccessControlEntry(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpGetConnector struct { +} + +func (*awsRestjson1_deserializeOpGetConnector) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetConnector) 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_deserializeOpErrorGetConnector(response, &metadata) + } + output := &GetConnectorOutput{} + 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_deserializeOpDocumentGetConnectorOutput(&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_deserializeOpErrorGetConnector(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetConnectorOutput(v **GetConnectorOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetConnectorOutput + if *v == nil { + sv = &GetConnectorOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Connector": + if err := awsRestjson1_deserializeDocumentConnector(&sv.Connector, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetDirectoryRegistration struct { +} + +func (*awsRestjson1_deserializeOpGetDirectoryRegistration) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetDirectoryRegistration) 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_deserializeOpErrorGetDirectoryRegistration(response, &metadata) + } + output := &GetDirectoryRegistrationOutput{} + 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_deserializeOpDocumentGetDirectoryRegistrationOutput(&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_deserializeOpErrorGetDirectoryRegistration(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetDirectoryRegistrationOutput(v **GetDirectoryRegistrationOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetDirectoryRegistrationOutput + if *v == nil { + sv = &GetDirectoryRegistrationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DirectoryRegistration": + if err := awsRestjson1_deserializeDocumentDirectoryRegistration(&sv.DirectoryRegistration, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetServicePrincipalName struct { +} + +func (*awsRestjson1_deserializeOpGetServicePrincipalName) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetServicePrincipalName) 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_deserializeOpErrorGetServicePrincipalName(response, &metadata) + } + output := &GetServicePrincipalNameOutput{} + 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_deserializeOpDocumentGetServicePrincipalNameOutput(&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_deserializeOpErrorGetServicePrincipalName(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetServicePrincipalNameOutput(v **GetServicePrincipalNameOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetServicePrincipalNameOutput + if *v == nil { + sv = &GetServicePrincipalNameOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ServicePrincipalName": + if err := awsRestjson1_deserializeDocumentServicePrincipalName(&sv.ServicePrincipalName, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetTemplate struct { +} + +func (*awsRestjson1_deserializeOpGetTemplate) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetTemplate) 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_deserializeOpErrorGetTemplate(response, &metadata) + } + output := &GetTemplateOutput{} + 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_deserializeOpDocumentGetTemplateOutput(&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_deserializeOpErrorGetTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetTemplateOutput(v **GetTemplateOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetTemplateOutput + if *v == nil { + sv = &GetTemplateOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Template": + if err := awsRestjson1_deserializeDocumentTemplate(&sv.Template, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetTemplateGroupAccessControlEntry struct { +} + +func (*awsRestjson1_deserializeOpGetTemplateGroupAccessControlEntry) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetTemplateGroupAccessControlEntry) 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_deserializeOpErrorGetTemplateGroupAccessControlEntry(response, &metadata) + } + output := &GetTemplateGroupAccessControlEntryOutput{} + 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_deserializeOpDocumentGetTemplateGroupAccessControlEntryOutput(&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_deserializeOpErrorGetTemplateGroupAccessControlEntry(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetTemplateGroupAccessControlEntryOutput(v **GetTemplateGroupAccessControlEntryOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetTemplateGroupAccessControlEntryOutput + if *v == nil { + sv = &GetTemplateGroupAccessControlEntryOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AccessControlEntry": + if err := awsRestjson1_deserializeDocumentAccessControlEntry(&sv.AccessControlEntry, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListConnectors struct { +} + +func (*awsRestjson1_deserializeOpListConnectors) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListConnectors) 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_deserializeOpErrorListConnectors(response, &metadata) + } + output := &ListConnectorsOutput{} + 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_deserializeOpDocumentListConnectorsOutput(&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_deserializeOpErrorListConnectors(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListConnectorsOutput(v **ListConnectorsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListConnectorsOutput + if *v == nil { + sv = &ListConnectorsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Connectors": + if err := awsRestjson1_deserializeDocumentConnectorList(&sv.Connectors, value); err != nil { + return err + } + + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListDirectoryRegistrations struct { +} + +func (*awsRestjson1_deserializeOpListDirectoryRegistrations) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListDirectoryRegistrations) 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_deserializeOpErrorListDirectoryRegistrations(response, &metadata) + } + output := &ListDirectoryRegistrationsOutput{} + 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_deserializeOpDocumentListDirectoryRegistrationsOutput(&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_deserializeOpErrorListDirectoryRegistrations(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListDirectoryRegistrationsOutput(v **ListDirectoryRegistrationsOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListDirectoryRegistrationsOutput + if *v == nil { + sv = &ListDirectoryRegistrationsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DirectoryRegistrations": + if err := awsRestjson1_deserializeDocumentDirectoryRegistrationList(&sv.DirectoryRegistrations, value); err != nil { + return err + } + + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListServicePrincipalNames struct { +} + +func (*awsRestjson1_deserializeOpListServicePrincipalNames) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListServicePrincipalNames) 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_deserializeOpErrorListServicePrincipalNames(response, &metadata) + } + output := &ListServicePrincipalNamesOutput{} + 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_deserializeOpDocumentListServicePrincipalNamesOutput(&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_deserializeOpErrorListServicePrincipalNames(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListServicePrincipalNamesOutput(v **ListServicePrincipalNamesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListServicePrincipalNamesOutput + if *v == nil { + sv = &ListServicePrincipalNamesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "ServicePrincipalNames": + if err := awsRestjson1_deserializeDocumentServicePrincipalNameList(&sv.ServicePrincipalNames, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListTagsForResource struct { +} + +func (*awsRestjson1_deserializeOpListTagsForResource) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorListTagsForResource(response, &metadata) + } + output := &ListTagsForResourceOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_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_deserializeDocumentTags(&sv.Tags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListTemplateGroupAccessControlEntries struct { +} + +func (*awsRestjson1_deserializeOpListTemplateGroupAccessControlEntries) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListTemplateGroupAccessControlEntries) 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_deserializeOpErrorListTemplateGroupAccessControlEntries(response, &metadata) + } + output := &ListTemplateGroupAccessControlEntriesOutput{} + 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_deserializeOpDocumentListTemplateGroupAccessControlEntriesOutput(&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_deserializeOpErrorListTemplateGroupAccessControlEntries(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListTemplateGroupAccessControlEntriesOutput(v **ListTemplateGroupAccessControlEntriesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListTemplateGroupAccessControlEntriesOutput + if *v == nil { + sv = &ListTemplateGroupAccessControlEntriesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AccessControlEntries": + if err := awsRestjson1_deserializeDocumentAccessControlEntryList(&sv.AccessControlEntries, value); err != nil { + return err + } + + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpListTemplates struct { +} + +func (*awsRestjson1_deserializeOpListTemplates) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpListTemplates) 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_deserializeOpErrorListTemplates(response, &metadata) + } + output := &ListTemplatesOutput{} + 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_deserializeOpDocumentListTemplatesOutput(&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_deserializeOpErrorListTemplates(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentListTemplatesOutput(v **ListTemplatesOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ListTemplatesOutput + if *v == nil { + sv = &ListTemplatesOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected NextToken to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "Templates": + if err := awsRestjson1_deserializeDocumentTemplateList(&sv.Templates, 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 + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +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 + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUpdateTemplate struct { +} + +func (*awsRestjson1_deserializeOpUpdateTemplate) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateTemplate) 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_deserializeOpErrorUpdateTemplate(response, &metadata) + } + output := &UpdateTemplateOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateTemplate(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpUpdateTemplateGroupAccessControlEntry struct { +} + +func (*awsRestjson1_deserializeOpUpdateTemplateGroupAccessControlEntry) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpUpdateTemplateGroupAccessControlEntry) 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_deserializeOpErrorUpdateTemplateGroupAccessControlEntry(response, &metadata) + } + output := &UpdateTemplateGroupAccessControlEntryOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorUpdateTemplateGroupAccessControlEntry(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ThrottlingException", errorCode): + return awsRestjson1_deserializeErrorThrottlingException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.AccessDeniedException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ConflictException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentConflictException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.InternalServerException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ResourceNotFoundException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentResourceNotFoundException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ServiceQuotaExceededException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentServiceQuotaExceededException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ThrottlingException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentThrottlingException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ValidationException{} + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + err := awsRestjson1_deserializeDocumentValidationException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + + return output +} + +func awsRestjson1_deserializeDocumentAccessControlEntry(v **types.AccessControlEntry, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AccessControlEntry + if *v == nil { + sv = &types.AccessControlEntry{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AccessRights": + if err := awsRestjson1_deserializeDocumentAccessRights(&sv.AccessRights, value); err != nil { + return err + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "GroupDisplayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DisplayName to be of type string, got %T instead", value) + } + sv.GroupDisplayName = ptr.String(jtv) + } + + case "GroupSecurityIdentifier": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GroupSecurityIdentifier to be of type string, got %T instead", value) + } + sv.GroupSecurityIdentifier = ptr.String(jtv) + } + + case "TemplateArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateArn to be of type string, got %T instead", value) + } + sv.TemplateArn = ptr.String(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentAccessControlEntryList(v *[]types.AccessControlEntrySummary, 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.AccessControlEntrySummary + if *v == nil { + cv = []types.AccessControlEntrySummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.AccessControlEntrySummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentAccessControlEntrySummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentAccessControlEntrySummary(v **types.AccessControlEntrySummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AccessControlEntrySummary + if *v == nil { + sv = &types.AccessControlEntrySummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AccessRights": + if err := awsRestjson1_deserializeDocumentAccessRights(&sv.AccessRights, value); err != nil { + return err + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "GroupDisplayName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DisplayName to be of type string, got %T instead", value) + } + sv.GroupDisplayName = ptr.String(jtv) + } + + case "GroupSecurityIdentifier": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected GroupSecurityIdentifier to be of type string, got %T instead", value) + } + sv.GroupSecurityIdentifier = ptr.String(jtv) + } + + case "TemplateArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateArn to be of type string, got %T instead", value) + } + sv.TemplateArn = ptr.String(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func 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_deserializeDocumentAccessRights(v **types.AccessRights, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.AccessRights + if *v == nil { + sv = &types.AccessRights{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AutoEnroll": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AccessRight to be of type string, got %T instead", value) + } + sv.AutoEnroll = types.AccessRight(jtv) + } + + case "Enroll": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected AccessRight to be of type string, got %T instead", value) + } + sv.Enroll = types.AccessRight(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentApplicationPolicies(v **types.ApplicationPolicies, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ApplicationPolicies + if *v == nil { + sv = &types.ApplicationPolicies{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Critical": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Critical = ptr.Bool(jtv) + } + + case "Policies": + if err := awsRestjson1_deserializeDocumentApplicationPolicyList(&sv.Policies, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentApplicationPolicy(v *types.ApplicationPolicy, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.ApplicationPolicy +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "PolicyObjectIdentifier": + var mv string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CustomObjectIdentifier to be of type string, got %T instead", value) + } + mv = jtv + } + uv = &types.ApplicationPolicyMemberPolicyObjectIdentifier{Value: mv} + break loop + + case "PolicyType": + var mv types.ApplicationPolicyType + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ApplicationPolicyType to be of type string, got %T instead", value) + } + mv = types.ApplicationPolicyType(jtv) + } + uv = &types.ApplicationPolicyMemberPolicyType{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentApplicationPolicyList(v *[]types.ApplicationPolicy, 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.ApplicationPolicy + if *v == nil { + cv = []types.ApplicationPolicy{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ApplicationPolicy + if err := awsRestjson1_deserializeDocumentApplicationPolicy(&col, value); err != nil { + return err + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentCertificateValidity(v **types.CertificateValidity, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.CertificateValidity + if *v == nil { + sv = &types.CertificateValidity{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "RenewalPeriod": + if err := awsRestjson1_deserializeDocumentValidityPeriod(&sv.RenewalPeriod, value); err != nil { + return err + } + + case "ValidityPeriod": + if err := awsRestjson1_deserializeDocumentValidityPeriod(&sv.ValidityPeriod, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ConflictException + if *v == nil { + sv = &types.ConflictException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "ResourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceId = ptr.String(jtv) + } + + case "ResourceType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceType = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentConnector(v **types.Connector, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Connector + if *v == nil { + sv = &types.Connector{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "CertificateAuthorityArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CertificateAuthorityArn to be of type string, got %T instead", value) + } + sv.CertificateAuthorityArn = ptr.String(jtv) + } + + case "CertificateEnrollmentPolicyServerEndpoint": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.CertificateEnrollmentPolicyServerEndpoint = ptr.String(jtv) + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "DirectoryId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryId to be of type string, got %T instead", value) + } + sv.DirectoryId = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorStatus to be of type string, got %T instead", value) + } + sv.Status = types.ConnectorStatus(jtv) + } + + case "StatusReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorStatusReason to be of type string, got %T instead", value) + } + sv.StatusReason = types.ConnectorStatusReason(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "VpcInformation": + if err := awsRestjson1_deserializeDocumentVpcInformation(&sv.VpcInformation, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentConnectorList(v *[]types.ConnectorSummary, 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.ConnectorSummary + if *v == nil { + cv = []types.ConnectorSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ConnectorSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentConnectorSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentConnectorSummary(v **types.ConnectorSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ConnectorSummary + if *v == nil { + sv = &types.ConnectorSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "CertificateAuthorityArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CertificateAuthorityArn to be of type string, got %T instead", value) + } + sv.CertificateAuthorityArn = ptr.String(jtv) + } + + case "CertificateEnrollmentPolicyServerEndpoint": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.CertificateEnrollmentPolicyServerEndpoint = ptr.String(jtv) + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "DirectoryId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryId to be of type string, got %T instead", value) + } + sv.DirectoryId = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorStatus to be of type string, got %T instead", value) + } + sv.Status = types.ConnectorStatus(jtv) + } + + case "StatusReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorStatusReason to be of type string, got %T instead", value) + } + sv.StatusReason = types.ConnectorStatusReason(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "VpcInformation": + if err := awsRestjson1_deserializeDocumentVpcInformation(&sv.VpcInformation, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentCryptoProvidersList(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_deserializeDocumentDirectoryRegistration(v **types.DirectoryRegistration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DirectoryRegistration + if *v == nil { + sv = &types.DirectoryRegistration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "DirectoryId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryId to be of type string, got %T instead", value) + } + sv.DirectoryId = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationStatus to be of type string, got %T instead", value) + } + sv.Status = types.DirectoryRegistrationStatus(jtv) + } + + case "StatusReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationStatusReason to be of type string, got %T instead", value) + } + sv.StatusReason = types.DirectoryRegistrationStatusReason(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDirectoryRegistrationList(v *[]types.DirectoryRegistrationSummary, 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.DirectoryRegistrationSummary + if *v == nil { + cv = []types.DirectoryRegistrationSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DirectoryRegistrationSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentDirectoryRegistrationSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentDirectoryRegistrationSummary(v **types.DirectoryRegistrationSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.DirectoryRegistrationSummary + if *v == nil { + sv = &types.DirectoryRegistrationSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "DirectoryId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryId to be of type string, got %T instead", value) + } + sv.DirectoryId = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationStatus to be of type string, got %T instead", value) + } + sv.Status = types.DirectoryRegistrationStatus(jtv) + } + + case "StatusReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationStatusReason to be of type string, got %T instead", value) + } + sv.StatusReason = types.DirectoryRegistrationStatusReason(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEnrollmentFlagsV2(v **types.EnrollmentFlagsV2, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EnrollmentFlagsV2 + if *v == nil { + sv = &types.EnrollmentFlagsV2{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "EnableKeyReuseOnNtTokenKeysetStorageFull": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.EnableKeyReuseOnNtTokenKeysetStorageFull = ptr.Bool(jtv) + } + + case "IncludeSymmetricAlgorithms": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IncludeSymmetricAlgorithms = ptr.Bool(jtv) + } + + case "NoSecurityExtension": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.NoSecurityExtension = ptr.Bool(jtv) + } + + case "RemoveInvalidCertificateFromPersonalStore": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RemoveInvalidCertificateFromPersonalStore = ptr.Bool(jtv) + } + + case "UserInteractionRequired": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.UserInteractionRequired = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEnrollmentFlagsV3(v **types.EnrollmentFlagsV3, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EnrollmentFlagsV3 + if *v == nil { + sv = &types.EnrollmentFlagsV3{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "EnableKeyReuseOnNtTokenKeysetStorageFull": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.EnableKeyReuseOnNtTokenKeysetStorageFull = ptr.Bool(jtv) + } + + case "IncludeSymmetricAlgorithms": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IncludeSymmetricAlgorithms = ptr.Bool(jtv) + } + + case "NoSecurityExtension": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.NoSecurityExtension = ptr.Bool(jtv) + } + + case "RemoveInvalidCertificateFromPersonalStore": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RemoveInvalidCertificateFromPersonalStore = ptr.Bool(jtv) + } + + case "UserInteractionRequired": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.UserInteractionRequired = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentEnrollmentFlagsV4(v **types.EnrollmentFlagsV4, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.EnrollmentFlagsV4 + if *v == nil { + sv = &types.EnrollmentFlagsV4{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "EnableKeyReuseOnNtTokenKeysetStorageFull": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.EnableKeyReuseOnNtTokenKeysetStorageFull = ptr.Bool(jtv) + } + + case "IncludeSymmetricAlgorithms": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.IncludeSymmetricAlgorithms = ptr.Bool(jtv) + } + + case "NoSecurityExtension": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.NoSecurityExtension = ptr.Bool(jtv) + } + + case "RemoveInvalidCertificateFromPersonalStore": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RemoveInvalidCertificateFromPersonalStore = ptr.Bool(jtv) + } + + case "UserInteractionRequired": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.UserInteractionRequired = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentExtensionsV2(v **types.ExtensionsV2, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ExtensionsV2 + if *v == nil { + sv = &types.ExtensionsV2{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ApplicationPolicies": + if err := awsRestjson1_deserializeDocumentApplicationPolicies(&sv.ApplicationPolicies, value); err != nil { + return err + } + + case "KeyUsage": + if err := awsRestjson1_deserializeDocumentKeyUsage(&sv.KeyUsage, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentExtensionsV3(v **types.ExtensionsV3, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ExtensionsV3 + if *v == nil { + sv = &types.ExtensionsV3{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ApplicationPolicies": + if err := awsRestjson1_deserializeDocumentApplicationPolicies(&sv.ApplicationPolicies, value); err != nil { + return err + } + + case "KeyUsage": + if err := awsRestjson1_deserializeDocumentKeyUsage(&sv.KeyUsage, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentExtensionsV4(v **types.ExtensionsV4, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ExtensionsV4 + if *v == nil { + sv = &types.ExtensionsV4{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ApplicationPolicies": + if err := awsRestjson1_deserializeDocumentApplicationPolicies(&sv.ApplicationPolicies, value); err != nil { + return err + } + + case "KeyUsage": + if err := awsRestjson1_deserializeDocumentKeyUsage(&sv.KeyUsage, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGeneralFlagsV2(v **types.GeneralFlagsV2, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GeneralFlagsV2 + if *v == nil { + sv = &types.GeneralFlagsV2{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AutoEnrollment": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.AutoEnrollment = ptr.Bool(jtv) + } + + case "MachineType": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.MachineType = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGeneralFlagsV3(v **types.GeneralFlagsV3, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GeneralFlagsV3 + if *v == nil { + sv = &types.GeneralFlagsV3{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AutoEnrollment": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.AutoEnrollment = ptr.Bool(jtv) + } + + case "MachineType": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.MachineType = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentGeneralFlagsV4(v **types.GeneralFlagsV4, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.GeneralFlagsV4 + if *v == nil { + sv = &types.GeneralFlagsV4{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AutoEnrollment": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.AutoEnrollment = ptr.Bool(jtv) + } + + case "MachineType": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.MachineType = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.InternalServerException + if *v == nil { + sv = &types.InternalServerException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKeyUsage(v **types.KeyUsage, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KeyUsage + if *v == nil { + sv = &types.KeyUsage{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Critical": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Critical = ptr.Bool(jtv) + } + + case "UsageFlags": + if err := awsRestjson1_deserializeDocumentKeyUsageFlags(&sv.UsageFlags, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKeyUsageFlags(v **types.KeyUsageFlags, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KeyUsageFlags + if *v == nil { + sv = &types.KeyUsageFlags{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DataEncipherment": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.DataEncipherment = ptr.Bool(jtv) + } + + case "DigitalSignature": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.DigitalSignature = ptr.Bool(jtv) + } + + case "KeyAgreement": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.KeyAgreement = ptr.Bool(jtv) + } + + case "KeyEncipherment": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.KeyEncipherment = ptr.Bool(jtv) + } + + case "NonRepudiation": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.NonRepudiation = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentKeyUsageProperty(v *types.KeyUsageProperty, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.KeyUsageProperty +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "PropertyFlags": + var mv types.KeyUsagePropertyFlags + destAddr := &mv + if err := awsRestjson1_deserializeDocumentKeyUsagePropertyFlags(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.KeyUsagePropertyMemberPropertyFlags{Value: mv} + break loop + + case "PropertyType": + var mv types.KeyUsagePropertyType + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KeyUsagePropertyType to be of type string, got %T instead", value) + } + mv = types.KeyUsagePropertyType(jtv) + } + uv = &types.KeyUsagePropertyMemberPropertyType{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentKeyUsagePropertyFlags(v **types.KeyUsagePropertyFlags, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.KeyUsagePropertyFlags + if *v == nil { + sv = &types.KeyUsagePropertyFlags{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Decrypt": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Decrypt = ptr.Bool(jtv) + } + + case "KeyAgreement": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.KeyAgreement = ptr.Bool(jtv) + } + + case "Sign": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.Sign = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPrivateKeyAttributesV2(v **types.PrivateKeyAttributesV2, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PrivateKeyAttributesV2 + if *v == nil { + sv = &types.PrivateKeyAttributesV2{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "CryptoProviders": + if err := awsRestjson1_deserializeDocumentCryptoProvidersList(&sv.CryptoProviders, value); err != nil { + return err + } + + case "KeySpec": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KeySpec to be of type string, got %T instead", value) + } + sv.KeySpec = types.KeySpec(jtv) + } + + case "MinimalKeyLength": + 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.MinimalKeyLength = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPrivateKeyAttributesV3(v **types.PrivateKeyAttributesV3, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PrivateKeyAttributesV3 + if *v == nil { + sv = &types.PrivateKeyAttributesV3{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Algorithm": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PrivateKeyAlgorithm to be of type string, got %T instead", value) + } + sv.Algorithm = types.PrivateKeyAlgorithm(jtv) + } + + case "CryptoProviders": + if err := awsRestjson1_deserializeDocumentCryptoProvidersList(&sv.CryptoProviders, value); err != nil { + return err + } + + case "KeySpec": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KeySpec to be of type string, got %T instead", value) + } + sv.KeySpec = types.KeySpec(jtv) + } + + case "KeyUsageProperty": + if err := awsRestjson1_deserializeDocumentKeyUsageProperty(&sv.KeyUsageProperty, value); err != nil { + return err + } + + case "MinimalKeyLength": + 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.MinimalKeyLength = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPrivateKeyAttributesV4(v **types.PrivateKeyAttributesV4, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PrivateKeyAttributesV4 + if *v == nil { + sv = &types.PrivateKeyAttributesV4{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Algorithm": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PrivateKeyAlgorithm to be of type string, got %T instead", value) + } + sv.Algorithm = types.PrivateKeyAlgorithm(jtv) + } + + case "CryptoProviders": + if err := awsRestjson1_deserializeDocumentCryptoProvidersList(&sv.CryptoProviders, value); err != nil { + return err + } + + case "KeySpec": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected KeySpec to be of type string, got %T instead", value) + } + sv.KeySpec = types.KeySpec(jtv) + } + + case "KeyUsageProperty": + if err := awsRestjson1_deserializeDocumentKeyUsageProperty(&sv.KeyUsageProperty, value); err != nil { + return err + } + + case "MinimalKeyLength": + 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.MinimalKeyLength = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPrivateKeyFlagsV2(v **types.PrivateKeyFlagsV2, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PrivateKeyFlagsV2 + if *v == nil { + sv = &types.PrivateKeyFlagsV2{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ClientVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ClientCompatibilityV2 to be of type string, got %T instead", value) + } + sv.ClientVersion = types.ClientCompatibilityV2(jtv) + } + + case "ExportableKey": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.ExportableKey = ptr.Bool(jtv) + } + + case "StrongKeyProtectionRequired": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.StrongKeyProtectionRequired = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPrivateKeyFlagsV3(v **types.PrivateKeyFlagsV3, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PrivateKeyFlagsV3 + if *v == nil { + sv = &types.PrivateKeyFlagsV3{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ClientVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ClientCompatibilityV3 to be of type string, got %T instead", value) + } + sv.ClientVersion = types.ClientCompatibilityV3(jtv) + } + + case "ExportableKey": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.ExportableKey = ptr.Bool(jtv) + } + + case "RequireAlternateSignatureAlgorithm": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireAlternateSignatureAlgorithm = ptr.Bool(jtv) + } + + case "StrongKeyProtectionRequired": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.StrongKeyProtectionRequired = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentPrivateKeyFlagsV4(v **types.PrivateKeyFlagsV4, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.PrivateKeyFlagsV4 + if *v == nil { + sv = &types.PrivateKeyFlagsV4{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ClientVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ClientCompatibilityV4 to be of type string, got %T instead", value) + } + sv.ClientVersion = types.ClientCompatibilityV4(jtv) + } + + case "ExportableKey": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.ExportableKey = ptr.Bool(jtv) + } + + case "RequireAlternateSignatureAlgorithm": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireAlternateSignatureAlgorithm = ptr.Bool(jtv) + } + + case "RequireSameKeyRenewal": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireSameKeyRenewal = ptr.Bool(jtv) + } + + case "StrongKeyProtectionRequired": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.StrongKeyProtectionRequired = ptr.Bool(jtv) + } + + case "UseLegacyProvider": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.UseLegacyProvider = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ResourceNotFoundException + if *v == nil { + sv = &types.ResourceNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "ResourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceId = ptr.String(jtv) + } + + case "ResourceType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceType = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSecurityGroupIdList(v *[]string, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []string + if *v == nil { + cv = []string{} + } else { + cv = *v + } + + for _, value := range shape { + var col string + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SecurityGroupId to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentServicePrincipalName(v **types.ServicePrincipalName, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ServicePrincipalName + if *v == nil { + sv = &types.ServicePrincipalName{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ConnectorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorArn to be of type string, got %T instead", value) + } + sv.ConnectorArn = ptr.String(jtv) + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "DirectoryRegistrationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationArn to be of type string, got %T instead", value) + } + sv.DirectoryRegistrationArn = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServicePrincipalNameStatus to be of type string, got %T instead", value) + } + sv.Status = types.ServicePrincipalNameStatus(jtv) + } + + case "StatusReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServicePrincipalNameStatusReason to be of type string, got %T instead", value) + } + sv.StatusReason = types.ServicePrincipalNameStatusReason(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentServicePrincipalNameList(v *[]types.ServicePrincipalNameSummary, 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.ServicePrincipalNameSummary + if *v == nil { + cv = []types.ServicePrincipalNameSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ServicePrincipalNameSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentServicePrincipalNameSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentServicePrincipalNameSummary(v **types.ServicePrincipalNameSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ServicePrincipalNameSummary + if *v == nil { + sv = &types.ServicePrincipalNameSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ConnectorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorArn to be of type string, got %T instead", value) + } + sv.ConnectorArn = ptr.String(jtv) + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "DirectoryRegistrationArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DirectoryRegistrationArn to be of type string, got %T instead", value) + } + sv.DirectoryRegistrationArn = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServicePrincipalNameStatus to be of type string, got %T instead", value) + } + sv.Status = types.ServicePrincipalNameStatus(jtv) + } + + case "StatusReason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServicePrincipalNameStatusReason to be of type string, got %T instead", value) + } + sv.StatusReason = types.ServicePrincipalNameStatusReason(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ServiceQuotaExceededException + if *v == nil { + sv = &types.ServiceQuotaExceededException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "QuotaCode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.QuotaCode = ptr.String(jtv) + } + + case "ResourceId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceId = ptr.String(jtv) + } + + case "ResourceType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ResourceType = ptr.String(jtv) + } + + case "ServiceCode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ServiceCode = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSubjectNameFlagsV2(v **types.SubjectNameFlagsV2, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SubjectNameFlagsV2 + if *v == nil { + sv = &types.SubjectNameFlagsV2{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "RequireCommonName": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireCommonName = ptr.Bool(jtv) + } + + case "RequireDirectoryPath": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireDirectoryPath = ptr.Bool(jtv) + } + + case "RequireDnsAsCn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireDnsAsCn = ptr.Bool(jtv) + } + + case "RequireEmail": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireEmail = ptr.Bool(jtv) + } + + case "SanRequireDirectoryGuid": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDirectoryGuid = ptr.Bool(jtv) + } + + case "SanRequireDns": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDns = ptr.Bool(jtv) + } + + case "SanRequireDomainDns": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDomainDns = ptr.Bool(jtv) + } + + case "SanRequireEmail": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireEmail = ptr.Bool(jtv) + } + + case "SanRequireSpn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireSpn = ptr.Bool(jtv) + } + + case "SanRequireUpn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireUpn = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSubjectNameFlagsV3(v **types.SubjectNameFlagsV3, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SubjectNameFlagsV3 + if *v == nil { + sv = &types.SubjectNameFlagsV3{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "RequireCommonName": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireCommonName = ptr.Bool(jtv) + } + + case "RequireDirectoryPath": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireDirectoryPath = ptr.Bool(jtv) + } + + case "RequireDnsAsCn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireDnsAsCn = ptr.Bool(jtv) + } + + case "RequireEmail": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireEmail = ptr.Bool(jtv) + } + + case "SanRequireDirectoryGuid": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDirectoryGuid = ptr.Bool(jtv) + } + + case "SanRequireDns": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDns = ptr.Bool(jtv) + } + + case "SanRequireDomainDns": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDomainDns = ptr.Bool(jtv) + } + + case "SanRequireEmail": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireEmail = ptr.Bool(jtv) + } + + case "SanRequireSpn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireSpn = ptr.Bool(jtv) + } + + case "SanRequireUpn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireUpn = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentSubjectNameFlagsV4(v **types.SubjectNameFlagsV4, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.SubjectNameFlagsV4 + if *v == nil { + sv = &types.SubjectNameFlagsV4{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "RequireCommonName": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireCommonName = ptr.Bool(jtv) + } + + case "RequireDirectoryPath": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireDirectoryPath = ptr.Bool(jtv) + } + + case "RequireDnsAsCn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireDnsAsCn = ptr.Bool(jtv) + } + + case "RequireEmail": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.RequireEmail = ptr.Bool(jtv) + } + + case "SanRequireDirectoryGuid": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDirectoryGuid = ptr.Bool(jtv) + } + + case "SanRequireDns": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDns = ptr.Bool(jtv) + } + + case "SanRequireDomainDns": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireDomainDns = ptr.Bool(jtv) + } + + case "SanRequireEmail": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireEmail = ptr.Bool(jtv) + } + + case "SanRequireSpn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireSpn = ptr.Bool(jtv) + } + + case "SanRequireUpn": + if value != nil { + jtv, ok := value.(bool) + if !ok { + return fmt.Errorf("expected Boolean to be of type *bool, got %T instead", value) + } + sv.SanRequireUpn = ptr.Bool(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTags(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_deserializeDocumentTemplate(v **types.Template, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.Template + if *v == nil { + sv = &types.Template{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "ConnectorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorArn to be of type string, got %T instead", value) + } + sv.ConnectorArn = ptr.String(jtv) + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Definition": + if err := awsRestjson1_deserializeDocumentTemplateDefinition(&sv.Definition, value); err != nil { + return err + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "ObjectIdentifier": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CustomObjectIdentifier to be of type string, got %T instead", value) + } + sv.ObjectIdentifier = ptr.String(jtv) + } + + case "PolicySchema": + 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.PolicySchema = ptr.Int32(int32(i64)) + } + + case "Revision": + if err := awsRestjson1_deserializeDocumentTemplateRevision(&sv.Revision, value); err != nil { + return err + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateStatus to be of type string, got %T instead", value) + } + sv.Status = types.TemplateStatus(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTemplateDefinition(v *types.TemplateDefinition, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %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.TemplateDefinition +loop: + for key, value := range shape { + if value == nil { + continue + } + switch key { + case "TemplateV2": + var mv types.TemplateV2 + destAddr := &mv + if err := awsRestjson1_deserializeDocumentTemplateV2(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.TemplateDefinitionMemberTemplateV2{Value: mv} + break loop + + case "TemplateV3": + var mv types.TemplateV3 + destAddr := &mv + if err := awsRestjson1_deserializeDocumentTemplateV3(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.TemplateDefinitionMemberTemplateV3{Value: mv} + break loop + + case "TemplateV4": + var mv types.TemplateV4 + destAddr := &mv + if err := awsRestjson1_deserializeDocumentTemplateV4(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.TemplateDefinitionMemberTemplateV4{Value: mv} + break loop + + default: + uv = &types.UnknownUnionMember{Tag: key} + break loop + + } + } + *v = uv + return nil +} + +func awsRestjson1_deserializeDocumentTemplateList(v *[]types.TemplateSummary, 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.TemplateSummary + if *v == nil { + cv = []types.TemplateSummary{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.TemplateSummary + destAddr := &col + if err := awsRestjson1_deserializeDocumentTemplateSummary(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentTemplateNameList(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 TemplateName to be of type string, got %T instead", value) + } + col = jtv + } + cv = append(cv, col) + + } + *v = cv + return nil +} + +func awsRestjson1_deserializeDocumentTemplateRevision(v **types.TemplateRevision, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TemplateRevision + if *v == nil { + sv = &types.TemplateRevision{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "MajorRevision": + 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.MajorRevision = ptr.Int32(int32(i64)) + } + + case "MinorRevision": + 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.MinorRevision = ptr.Int32(int32(i64)) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTemplateSummary(v **types.TemplateSummary, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TemplateSummary + if *v == nil { + sv = &types.TemplateSummary{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Arn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateArn to be of type string, got %T instead", value) + } + sv.Arn = ptr.String(jtv) + } + + case "ConnectorArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ConnectorArn to be of type string, got %T instead", value) + } + sv.ConnectorArn = ptr.String(jtv) + } + + case "CreatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.CreatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + case "Definition": + if err := awsRestjson1_deserializeDocumentTemplateDefinition(&sv.Definition, value); err != nil { + return err + } + + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateName to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "ObjectIdentifier": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected CustomObjectIdentifier to be of type string, got %T instead", value) + } + sv.ObjectIdentifier = ptr.String(jtv) + } + + case "PolicySchema": + 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.PolicySchema = ptr.Int32(int32(i64)) + } + + case "Revision": + if err := awsRestjson1_deserializeDocumentTemplateRevision(&sv.Revision, value); err != nil { + return err + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected TemplateStatus to be of type string, got %T instead", value) + } + sv.Status = types.TemplateStatus(jtv) + } + + case "UpdatedAt": + if value != nil { + switch jtv := value.(type) { + case json.Number: + f64, err := jtv.Float64() + if err != nil { + return err + } + sv.UpdatedAt = ptr.Time(smithytime.ParseEpochSeconds(f64)) + + default: + return fmt.Errorf("expected Timestamp to be a JSON Number, got %T instead", value) + + } + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTemplateV2(v **types.TemplateV2, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TemplateV2 + if *v == nil { + sv = &types.TemplateV2{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "CertificateValidity": + if err := awsRestjson1_deserializeDocumentCertificateValidity(&sv.CertificateValidity, value); err != nil { + return err + } + + case "EnrollmentFlags": + if err := awsRestjson1_deserializeDocumentEnrollmentFlagsV2(&sv.EnrollmentFlags, value); err != nil { + return err + } + + case "Extensions": + if err := awsRestjson1_deserializeDocumentExtensionsV2(&sv.Extensions, value); err != nil { + return err + } + + case "GeneralFlags": + if err := awsRestjson1_deserializeDocumentGeneralFlagsV2(&sv.GeneralFlags, value); err != nil { + return err + } + + case "PrivateKeyAttributes": + if err := awsRestjson1_deserializeDocumentPrivateKeyAttributesV2(&sv.PrivateKeyAttributes, value); err != nil { + return err + } + + case "PrivateKeyFlags": + if err := awsRestjson1_deserializeDocumentPrivateKeyFlagsV2(&sv.PrivateKeyFlags, value); err != nil { + return err + } + + case "SubjectNameFlags": + if err := awsRestjson1_deserializeDocumentSubjectNameFlagsV2(&sv.SubjectNameFlags, value); err != nil { + return err + } + + case "SupersededTemplates": + if err := awsRestjson1_deserializeDocumentTemplateNameList(&sv.SupersededTemplates, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTemplateV3(v **types.TemplateV3, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TemplateV3 + if *v == nil { + sv = &types.TemplateV3{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "CertificateValidity": + if err := awsRestjson1_deserializeDocumentCertificateValidity(&sv.CertificateValidity, value); err != nil { + return err + } + + case "EnrollmentFlags": + if err := awsRestjson1_deserializeDocumentEnrollmentFlagsV3(&sv.EnrollmentFlags, value); err != nil { + return err + } + + case "Extensions": + if err := awsRestjson1_deserializeDocumentExtensionsV3(&sv.Extensions, value); err != nil { + return err + } + + case "GeneralFlags": + if err := awsRestjson1_deserializeDocumentGeneralFlagsV3(&sv.GeneralFlags, value); err != nil { + return err + } + + case "HashAlgorithm": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HashAlgorithm to be of type string, got %T instead", value) + } + sv.HashAlgorithm = types.HashAlgorithm(jtv) + } + + case "PrivateKeyAttributes": + if err := awsRestjson1_deserializeDocumentPrivateKeyAttributesV3(&sv.PrivateKeyAttributes, value); err != nil { + return err + } + + case "PrivateKeyFlags": + if err := awsRestjson1_deserializeDocumentPrivateKeyFlagsV3(&sv.PrivateKeyFlags, value); err != nil { + return err + } + + case "SubjectNameFlags": + if err := awsRestjson1_deserializeDocumentSubjectNameFlagsV3(&sv.SubjectNameFlags, value); err != nil { + return err + } + + case "SupersededTemplates": + if err := awsRestjson1_deserializeDocumentTemplateNameList(&sv.SupersededTemplates, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentTemplateV4(v **types.TemplateV4, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.TemplateV4 + if *v == nil { + sv = &types.TemplateV4{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "CertificateValidity": + if err := awsRestjson1_deserializeDocumentCertificateValidity(&sv.CertificateValidity, value); err != nil { + return err + } + + case "EnrollmentFlags": + if err := awsRestjson1_deserializeDocumentEnrollmentFlagsV4(&sv.EnrollmentFlags, value); err != nil { + return err + } + + case "Extensions": + if err := awsRestjson1_deserializeDocumentExtensionsV4(&sv.Extensions, value); err != nil { + return err + } + + case "GeneralFlags": + if err := awsRestjson1_deserializeDocumentGeneralFlagsV4(&sv.GeneralFlags, value); err != nil { + return err + } + + case "HashAlgorithm": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected HashAlgorithm to be of type string, got %T instead", value) + } + sv.HashAlgorithm = types.HashAlgorithm(jtv) + } + + case "PrivateKeyAttributes": + if err := awsRestjson1_deserializeDocumentPrivateKeyAttributesV4(&sv.PrivateKeyAttributes, value); err != nil { + return err + } + + case "PrivateKeyFlags": + if err := awsRestjson1_deserializeDocumentPrivateKeyFlagsV4(&sv.PrivateKeyFlags, value); err != nil { + return err + } + + case "SubjectNameFlags": + if err := awsRestjson1_deserializeDocumentSubjectNameFlagsV4(&sv.SubjectNameFlags, value); err != nil { + return err + } + + case "SupersededTemplates": + if err := awsRestjson1_deserializeDocumentTemplateNameList(&sv.SupersededTemplates, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ThrottlingException + if *v == nil { + sv = &types.ThrottlingException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "QuotaCode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.QuotaCode = ptr.String(jtv) + } + + case "ServiceCode": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ServiceCode = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.ValidationException + if *v == nil { + sv = &types.ValidationException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "Reason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ValidationExceptionReason to be of type string, got %T instead", value) + } + sv.Reason = types.ValidationExceptionReason(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentValidityPeriod(v **types.ValidityPeriod, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.ValidityPeriod + if *v == nil { + sv = &types.ValidityPeriod{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Period": + if value != nil { + jtv, ok := value.(json.Number) + if !ok { + return fmt.Errorf("expected Long to be json.Number, got %T instead", value) + } + i64, err := jtv.Int64() + if err != nil { + return err + } + sv.Period = ptr.Int64(i64) + } + + case "PeriodType": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ValidityPeriodType to be of type string, got %T instead", value) + } + sv.PeriodType = types.ValidityPeriodType(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentVpcInformation(v **types.VpcInformation, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.VpcInformation + if *v == nil { + sv = &types.VpcInformation{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "SecurityGroupIds": + if err := awsRestjson1_deserializeDocumentSecurityGroupIdList(&sv.SecurityGroupIds, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} diff --git a/service/pcaconnectorad/doc.go b/service/pcaconnectorad/doc.go new file mode 100644 index 00000000000..66a08990750 --- /dev/null +++ b/service/pcaconnectorad/doc.go @@ -0,0 +1,12 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +// Package pcaconnectorad provides the API client, operations, and parameter types +// for PcaConnectorAd. +// +// Amazon Web Services Private CA Connector for Active Directory creates a +// connector between Amazon Web Services Private CA and Active Directory (AD) that +// enables you to provision security certificates for AD signed by a private CA +// that you own. For more information, see Amazon Web Services Private CA +// Connector for Active Directory (https://docs.aws.amazon.com/privateca/latest/userguide/ad-connector.html) +// . +package pcaconnectorad diff --git a/service/pcaconnectorad/endpoints.go b/service/pcaconnectorad/endpoints.go new file mode 100644 index 00000000000..158065a60a8 --- /dev/null +++ b/service/pcaconnectorad/endpoints.go @@ -0,0 +1,480 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "errors" + "fmt" + "github.com/aws/aws-sdk-go-v2/aws" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" + internalendpoints "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/internal/endpoints" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/middleware" + "github.com/aws/smithy-go/ptr" + smithyhttp "github.com/aws/smithy-go/transport/http" + "net/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) +} + +// 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, +) { + if !awsmiddleware.GetRequiresLegacyEndpoints(ctx) { + return next.HandleSerialize(ctx, in) + } + + 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 { + nf := (&aws.EndpointNotFoundError{}) + if errors.As(err, &nf) { + ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, false) + return next.HandleSerialize(ctx, in) + } + 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 = "pca-connector-ad" + } + 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 +} + +func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { + return w.awsResolver.ResolveEndpoint(ServiceID, 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 aws.EndpointResolverWithOptions that first delegates endpoint resolution to the awsResolver. +// If awsResolver returns aws.EndpointNotFoundError error, the v1 resolver middleware will swallow the error, +// and set an appropriate context flag such that fallback will occur when EndpointResolverV2 is invoked +// via its middleware. +// +// If another error (besides aws.EndpointNotFoundError) is returned, then that error will be propagated. +func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions) EndpointResolver { + var resolver aws.EndpointResolverWithOptions + + if awsResolverWithOptions != nil { + resolver = awsResolverWithOptions + } else if awsResolver != nil { + resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint) + } + + return &wrappedEndpointResolver{ + awsResolver: resolver, + } +} + +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 + } + } + +} + +func resolveEndpointResolverV2(options *Options) { + if options.EndpointResolverV2 == nil { + options.EndpointResolverV2 = NewDefaultEndpointResolverV2() + } +} + +// Utility function to aid with translating pseudo-regions to classical regions +// with the appropriate setting indicated by the pseudo-region +func mapPseudoRegion(pr string) (region string, fips aws.FIPSEndpointState) { + const fipsInfix = "-fips-" + const fipsPrefix = "fips-" + const fipsSuffix = "-fips" + + if strings.Contains(pr, fipsInfix) || + strings.Contains(pr, fipsPrefix) || + strings.Contains(pr, fipsSuffix) { + region = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll( + pr, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "") + fips = aws.FIPSEndpointStateEnabled + } else { + region = pr + } + + return region, fips +} + +// builtInParameterResolver is the interface responsible for resolving BuiltIn +// values during the sourcing of EndpointParameters +type builtInParameterResolver interface { + ResolveBuiltIns(*EndpointParameters) error +} + +// builtInResolver resolves modeled BuiltIn values using only the members defined +// below. +type builtInResolver struct { + // The AWS region used to dispatch the request. + Region string + + // Sourced BuiltIn value in a historical enabled or disabled state. + UseDualStack aws.DualStackEndpointState + + // Sourced BuiltIn value in a historical enabled or disabled state. + UseFIPS aws.FIPSEndpointState + + // Base endpoint that can potentially be modified during Endpoint resolution. + Endpoint *string +} + +// Invoked at runtime to resolve BuiltIn Values. Only resolution code specific to +// each BuiltIn value is generated. +func (b *builtInResolver) ResolveBuiltIns(params *EndpointParameters) error { + + region, _ := mapPseudoRegion(b.Region) + if len(region) == 0 { + return fmt.Errorf("Could not resolve AWS::Region") + } else { + params.Region = aws.String(region) + } + if b.UseDualStack == aws.DualStackEndpointStateEnabled { + params.UseDualStack = aws.Bool(true) + } else { + params.UseDualStack = aws.Bool(false) + } + if b.UseFIPS == aws.FIPSEndpointStateEnabled { + params.UseFIPS = aws.Bool(true) + } else { + params.UseFIPS = aws.Bool(false) + } + params.Endpoint = b.Endpoint + return nil +} + +// EndpointParameters provides the parameters that influence how endpoints are +// resolved. +type EndpointParameters struct { + // The AWS region used to dispatch the request. + // + // Parameter is + // required. + // + // AWS::Region + Region *string + + // When true, use the dual-stack endpoint. If the configured endpoint does not + // support dual-stack, dispatching the request MAY return an error. + // + // Defaults to + // false if no value is provided. + // + // AWS::UseDualStack + UseDualStack *bool + + // When true, send this request to the FIPS-compliant regional endpoint. If the + // configured endpoint does not have a FIPS compliant endpoint, dispatching the + // request will return an error. + // + // Defaults to false if no value is + // provided. + // + // AWS::UseFIPS + UseFIPS *bool + + // Override the endpoint used to send this request + // + // Parameter is + // required. + // + // SDK::Endpoint + Endpoint *string +} + +// ValidateRequired validates required parameters are set. +func (p EndpointParameters) ValidateRequired() error { + if p.UseDualStack == nil { + return fmt.Errorf("parameter UseDualStack is required") + } + + if p.UseFIPS == nil { + return fmt.Errorf("parameter UseFIPS is required") + } + + return nil +} + +// WithDefaults returns a shallow copy of EndpointParameterswith default values +// applied to members where applicable. +func (p EndpointParameters) WithDefaults() EndpointParameters { + if p.UseDualStack == nil { + p.UseDualStack = ptr.Bool(false) + } + + if p.UseFIPS == nil { + p.UseFIPS = ptr.Bool(false) + } + return p +} + +// EndpointResolverV2 provides the interface for resolving service endpoints. +type EndpointResolverV2 interface { + // ResolveEndpoint attempts to resolve the endpoint with the provided options, + // returning the endpoint if found. Otherwise an error is returned. + ResolveEndpoint(ctx context.Context, params EndpointParameters) ( + smithyendpoints.Endpoint, error, + ) +} + +// resolver provides the implementation for resolving endpoints. +type resolver struct{} + +func NewDefaultEndpointResolverV2() EndpointResolverV2 { + return &resolver{} +} + +// ResolveEndpoint attempts to resolve the endpoint with the provided options, +// returning the endpoint if found. Otherwise an error is returned. +func (r *resolver) ResolveEndpoint( + ctx context.Context, params EndpointParameters, +) ( + endpoint smithyendpoints.Endpoint, err error, +) { + params = params.WithDefaults() + if err = params.ValidateRequired(); err != nil { + return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) + } + _UseDualStack := *params.UseDualStack + _UseFIPS := *params.UseFIPS + + if exprVal := params.Endpoint; exprVal != nil { + _Endpoint := *exprVal + _ = _Endpoint + if _UseFIPS == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported") + } + if _UseDualStack == true { + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported") + } + uriString := _Endpoint + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + if exprVal := params.Region; exprVal != nil { + _Region := *exprVal + _ = _Region + if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { + _PartitionResult := *exprVal + _ = _PartitionResult + if _UseFIPS == true { + if _UseDualStack == true { + if true == _PartitionResult.SupportsFIPS { + if true == _PartitionResult.SupportsDualStack { + uriString := func() string { + var out strings.Builder + out.WriteString("https://pca-connector-ad-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS and DualStack are enabled, but this partition does not support one or both") + } + } + if _UseFIPS == true { + if true == _PartitionResult.SupportsFIPS { + uriString := func() string { + var out strings.Builder + out.WriteString("https://pca-connector-ad-fips.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS") + } + if _UseDualStack == true { + if true == _PartitionResult.SupportsDualStack { + uriString := func() string { + var out strings.Builder + out.WriteString("https://pca-connector-ad.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DualStackDnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack") + } + uriString := func() string { + var out strings.Builder + out.WriteString("https://pca-connector-ad.") + out.WriteString(_Region) + out.WriteString(".") + out.WriteString(_PartitionResult.DnsSuffix) + return out.String() + }() + + uri, err := url.Parse(uriString) + if err != nil { + return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) + } + + return smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + }, nil + } + return endpoint, fmt.Errorf("Endpoint resolution failed. Invalid operation or environment input.") + } + return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Missing Region") +} diff --git a/service/pcaconnectorad/endpoints_test.go b/service/pcaconnectorad/endpoints_test.go new file mode 100644 index 00000000000..118cb970071 --- /dev/null +++ b/service/pcaconnectorad/endpoints_test.go @@ -0,0 +1,856 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + smithy "github.com/aws/smithy-go" + smithyendpoints "github.com/aws/smithy-go/endpoints" + "github.com/aws/smithy-go/ptr" + "github.com/google/go-cmp/cmp" + "net/http" + "net/url" + "strings" + "testing" +) + +// For region us-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase0(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad-fips.us-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase1(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad-fips.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase2(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad.us-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase3(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad.us-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region cn-north-1 with FIPS enabled and DualStack enabled +func TestEndpointCase4(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad-fips.cn-north-1.api.amazonwebservices.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region cn-north-1 with FIPS enabled and DualStack disabled +func TestEndpointCase5(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad-fips.cn-north-1.amazonaws.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region cn-north-1 with FIPS disabled and DualStack enabled +func TestEndpointCase6(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad.cn-north-1.api.amazonwebservices.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region cn-north-1 with FIPS disabled and DualStack disabled +func TestEndpointCase7(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("cn-north-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad.cn-north-1.amazonaws.com.cn") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-gov-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase8(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad-fips.us-gov-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-gov-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase9(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad-fips.us-gov-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-gov-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase10(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad.us-gov-east-1.api.aws") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-gov-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase11(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-gov-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad.us-gov-east-1.amazonaws.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-iso-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase12(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-iso-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase13(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad-fips.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-iso-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase14(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-iso-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase15(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-iso-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad.us-iso-east-1.c2s.ic.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-isob-east-1 with FIPS enabled and DualStack enabled +func TestEndpointCase16(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "FIPS and DualStack are enabled, but this partition does not support one or both", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-isob-east-1 with FIPS enabled and DualStack disabled +func TestEndpointCase17(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad-fips.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For region us-isob-east-1 with FIPS disabled and DualStack enabled +func TestEndpointCase18(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "DualStack is enabled but this partition does not support DualStack", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For region us-isob-east-1 with FIPS disabled and DualStack disabled +func TestEndpointCase19(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-isob-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://pca-connector-ad.us-isob-east-1.sc2s.sgov.gov") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For custom endpoint with region set and fips disabled and dualstack disabled +func TestEndpointCase20(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For custom endpoint with region not set and fips disabled and dualstack disabled +func TestEndpointCase21(t *testing.T) { + var params = EndpointParameters{ + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + uri, _ := url.Parse("https://example.com") + + expectEndpoint := smithyendpoints.Endpoint{ + URI: *uri, + Headers: http.Header{}, + Properties: smithy.Properties{}, + } + + if e, a := expectEndpoint.URI, result.URI; e != a { + t.Errorf("expect %v URI, got %v", e, a) + } + + if diff := cmp.Diff(expectEndpoint.Headers, result.Headers); diff != "" { + t.Errorf("expect headers to match\n%s", diff) + } + + if diff := cmp.Diff(expectEndpoint.Properties, result.Properties, + cmp.AllowUnexported(smithy.Properties{}), + ); diff != "" { + t.Errorf("expect properties to match\n%s", diff) + } +} + +// For custom endpoint with fips enabled and dualstack disabled +func TestEndpointCase22(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(true), + UseDualStack: ptr.Bool(false), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: FIPS and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// For custom endpoint with fips disabled and dualstack enabled +func TestEndpointCase23(t *testing.T) { + var params = EndpointParameters{ + Region: ptr.String("us-east-1"), + UseFIPS: ptr.Bool(false), + UseDualStack: ptr.Bool(true), + Endpoint: ptr.String("https://example.com"), + } + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: Dualstack and custom endpoint are not supported", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} + +// Missing region +func TestEndpointCase24(t *testing.T) { + var params = EndpointParameters{} + + resolver := NewDefaultEndpointResolverV2() + result, err := resolver.ResolveEndpoint(context.Background(), params) + _, _ = result, err + + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "Invalid Configuration: Missing Region", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %v error in %v", e, a) + } +} diff --git a/service/pcaconnectorad/generated.json b/service/pcaconnectorad/generated.json new file mode 100644 index 00000000000..869654340e3 --- /dev/null +++ b/service/pcaconnectorad/generated.json @@ -0,0 +1,55 @@ +{ + "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", + "github.com/google/go-cmp": "v0.5.4" + }, + "files": [ + "api_client.go", + "api_client_test.go", + "api_op_CreateConnector.go", + "api_op_CreateDirectoryRegistration.go", + "api_op_CreateServicePrincipalName.go", + "api_op_CreateTemplate.go", + "api_op_CreateTemplateGroupAccessControlEntry.go", + "api_op_DeleteConnector.go", + "api_op_DeleteDirectoryRegistration.go", + "api_op_DeleteServicePrincipalName.go", + "api_op_DeleteTemplate.go", + "api_op_DeleteTemplateGroupAccessControlEntry.go", + "api_op_GetConnector.go", + "api_op_GetDirectoryRegistration.go", + "api_op_GetServicePrincipalName.go", + "api_op_GetTemplate.go", + "api_op_GetTemplateGroupAccessControlEntry.go", + "api_op_ListConnectors.go", + "api_op_ListDirectoryRegistrations.go", + "api_op_ListServicePrincipalNames.go", + "api_op_ListTagsForResource.go", + "api_op_ListTemplateGroupAccessControlEntries.go", + "api_op_ListTemplates.go", + "api_op_TagResource.go", + "api_op_UntagResource.go", + "api_op_UpdateTemplate.go", + "api_op_UpdateTemplateGroupAccessControlEntry.go", + "deserializers.go", + "doc.go", + "endpoints.go", + "endpoints_test.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/pcaconnectorad", + "unstable": false +} diff --git a/service/pcaconnectorad/go.mod b/service/pcaconnectorad/go.mod new file mode 100644 index 00000000000..6e0ef0abe52 --- /dev/null +++ b/service/pcaconnectorad/go.mod @@ -0,0 +1,17 @@ +module github.com/aws/aws-sdk-go-v2/service/pcaconnectorad + +go 1.15 + +require ( + github.com/aws/aws-sdk-go-v2 v1.21.0 + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41 + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35 + github.com/aws/smithy-go v1.14.2 + github.com/google/go-cmp v0.5.8 +) + +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/pcaconnectorad/go.sum b/service/pcaconnectorad/go.sum new file mode 100644 index 00000000000..0f594455d92 --- /dev/null +++ b/service/pcaconnectorad/go.sum @@ -0,0 +1,11 @@ +github.com/aws/smithy-go v1.14.2 h1:MJU9hqBGbvWZdApzpvoF2WAIJDbtjK2NDJSiJP7HblQ= +github.com/aws/smithy-go v1.14.2/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/pcaconnectorad/go_module_metadata.go b/service/pcaconnectorad/go_module_metadata.go new file mode 100644 index 00000000000..e4a07122ebc --- /dev/null +++ b/service/pcaconnectorad/go_module_metadata.go @@ -0,0 +1,6 @@ +// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. + +package pcaconnectorad + +// goModuleVersion is the tagged release for this module +const goModuleVersion = "tip" diff --git a/service/pcaconnectorad/internal/endpoints/endpoints.go b/service/pcaconnectorad/internal/endpoints/endpoints.go new file mode 100644 index 00000000000..9e0bfc49326 --- /dev/null +++ b/service/pcaconnectorad/internal/endpoints/endpoints.go @@ -0,0 +1,296 @@ +// 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 Pca Connector Ad endpoint resolver +type Resolver struct { + partitions endpoints.Partitions +} + +// ResolveEndpoint resolves the service endpoint for the given region and options +func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) { + if len(region) == 0 { + return endpoint, &aws.MissingRegionError{} + } + + opt := transformToSharedOptions(options) + return r.partitions.ResolveEndpoint(region, opt) +} + +// New returns a new Resolver +func New() *Resolver { + return &Resolver{ + partitions: defaultPartitions, + } +} + +var partitionRegexp = struct { + Aws *regexp.Regexp + AwsCn *regexp.Regexp + AwsIso *regexp.Regexp + AwsIsoB *regexp.Regexp + AwsIsoE *regexp.Regexp + AwsIsoF *regexp.Regexp + AwsUsGov *regexp.Regexp +}{ + + Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$"), + AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), + AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), + AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), + AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"), + AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"), + AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), +} + +var defaultPartitions = endpoints.Partitions{ + { + ID: "aws", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "pca-connector-ad.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "pca-connector-ad-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "pca-connector-ad-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "pca-connector-ad.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.Aws, + IsRegionalized: true, + }, + { + ID: "aws-cn", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "pca-connector-ad.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "pca-connector-ad-fips.{region}.amazonaws.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "pca-connector-ad-fips.{region}.api.amazonwebservices.com.cn", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "pca-connector-ad.{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: "pca-connector-ad-fips.{region}.c2s.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "pca-connector-ad.{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: "pca-connector-ad-fips.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "pca-connector-ad.{region}.sc2s.sgov.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoB, + IsRegionalized: true, + }, + { + ID: "aws-iso-e", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "pca-connector-ad-fips.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "pca-connector-ad.{region}.cloud.adc-e.uk", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoE, + IsRegionalized: true, + }, + { + ID: "aws-iso-f", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "pca-connector-ad-fips.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "pca-connector-ad.{region}.csp.hci.ic.gov", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsIsoF, + IsRegionalized: true, + }, + { + ID: "aws-us-gov", + Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ + { + Variant: endpoints.DualStackVariant, + }: { + Hostname: "pca-connector-ad.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant, + }: { + Hostname: "pca-connector-ad-fips.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, + }: { + Hostname: "pca-connector-ad-fips.{region}.api.aws", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + { + Variant: 0, + }: { + Hostname: "pca-connector-ad.{region}.amazonaws.com", + Protocols: []string{"https"}, + SignatureVersions: []string{"v4"}, + }, + }, + RegionRegex: partitionRegexp.AwsUsGov, + IsRegionalized: true, + }, +} diff --git a/service/pcaconnectorad/internal/endpoints/endpoints_test.go b/service/pcaconnectorad/internal/endpoints/endpoints_test.go new file mode 100644 index 00000000000..08e5da2d833 --- /dev/null +++ b/service/pcaconnectorad/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/pcaconnectorad/protocol_test.go b/service/pcaconnectorad/protocol_test.go new file mode 100644 index 00000000000..7ce11c892bb --- /dev/null +++ b/service/pcaconnectorad/protocol_test.go @@ -0,0 +1,3 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad diff --git a/service/pcaconnectorad/serializers.go b/service/pcaconnectorad/serializers.go new file mode 100644 index 00000000000..78d3228433d --- /dev/null +++ b/service/pcaconnectorad/serializers.go @@ -0,0 +1,3010 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "bytes" + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/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_serializeOpCreateConnector struct { +} + +func (*awsRestjson1_serializeOpCreateConnector) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateConnector) 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.(*CreateConnectorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/connectors") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentCreateConnectorInput(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_serializeOpHttpBindingsCreateConnectorInput(v *CreateConnectorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateConnectorInput(v *CreateConnectorInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CertificateAuthorityArn != nil { + ok := object.Key("CertificateAuthorityArn") + ok.String(*v.CertificateAuthorityArn) + } + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + if v.DirectoryId != nil { + ok := object.Key("DirectoryId") + ok.String(*v.DirectoryId) + } + + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + if v.VpcInformation != nil { + ok := object.Key("VpcInformation") + if err := awsRestjson1_serializeDocumentVpcInformation(v.VpcInformation, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateDirectoryRegistration struct { +} + +func (*awsRestjson1_serializeOpCreateDirectoryRegistration) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateDirectoryRegistration) 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.(*CreateDirectoryRegistrationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/directoryRegistrations") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentCreateDirectoryRegistrationInput(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_serializeOpHttpBindingsCreateDirectoryRegistrationInput(v *CreateDirectoryRegistrationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateDirectoryRegistrationInput(v *CreateDirectoryRegistrationInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + if v.DirectoryId != nil { + ok := object.Key("DirectoryId") + ok.String(*v.DirectoryId) + } + + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateServicePrincipalName struct { +} + +func (*awsRestjson1_serializeOpCreateServicePrincipalName) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateServicePrincipalName) 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.(*CreateServicePrincipalNameInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/directoryRegistrations/{DirectoryRegistrationArn}/servicePrincipalNames/{ConnectorArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsCreateServicePrincipalNameInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateServicePrincipalNameInput(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_serializeOpHttpBindingsCreateServicePrincipalNameInput(v *CreateServicePrincipalNameInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ConnectorArn == nil || len(*v.ConnectorArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ConnectorArn must not be empty")} + } + if v.ConnectorArn != nil { + if err := encoder.SetURI("ConnectorArn").String(*v.ConnectorArn); err != nil { + return err + } + } + + if v.DirectoryRegistrationArn == nil || len(*v.DirectoryRegistrationArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DirectoryRegistrationArn must not be empty")} + } + if v.DirectoryRegistrationArn != nil { + if err := encoder.SetURI("DirectoryRegistrationArn").String(*v.DirectoryRegistrationArn); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateServicePrincipalNameInput(v *CreateServicePrincipalNameInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + return nil +} + +type awsRestjson1_serializeOpCreateTemplate struct { +} + +func (*awsRestjson1_serializeOpCreateTemplate) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateTemplate) 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.(*CreateTemplateInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, 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_serializeOpDocumentCreateTemplateInput(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_serializeOpHttpBindingsCreateTemplateInput(v *CreateTemplateInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateTemplateInput(v *CreateTemplateInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + if v.ConnectorArn != nil { + ok := object.Key("ConnectorArn") + ok.String(*v.ConnectorArn) + } + + if v.Definition != nil { + ok := object.Key("Definition") + if err := awsRestjson1_serializeDocumentTemplateDefinition(v.Definition, ok); err != nil { + return err + } + } + + if v.Name != nil { + ok := object.Key("Name") + ok.String(*v.Name) + } + + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpCreateTemplateGroupAccessControlEntry struct { +} + +func (*awsRestjson1_serializeOpCreateTemplateGroupAccessControlEntry) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpCreateTemplateGroupAccessControlEntry) 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.(*CreateTemplateGroupAccessControlEntryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates/{TemplateArn}/accessControlEntries") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsCreateTemplateGroupAccessControlEntryInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentCreateTemplateGroupAccessControlEntryInput(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_serializeOpHttpBindingsCreateTemplateGroupAccessControlEntryInput(v *CreateTemplateGroupAccessControlEntryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TemplateArn == nil || len(*v.TemplateArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member TemplateArn must not be empty")} + } + if v.TemplateArn != nil { + if err := encoder.SetURI("TemplateArn").String(*v.TemplateArn); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentCreateTemplateGroupAccessControlEntryInput(v *CreateTemplateGroupAccessControlEntryInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccessRights != nil { + ok := object.Key("AccessRights") + if err := awsRestjson1_serializeDocumentAccessRights(v.AccessRights, ok); err != nil { + return err + } + } + + if v.ClientToken != nil { + ok := object.Key("ClientToken") + ok.String(*v.ClientToken) + } + + if v.GroupDisplayName != nil { + ok := object.Key("GroupDisplayName") + ok.String(*v.GroupDisplayName) + } + + if v.GroupSecurityIdentifier != nil { + ok := object.Key("GroupSecurityIdentifier") + ok.String(*v.GroupSecurityIdentifier) + } + + return nil +} + +type awsRestjson1_serializeOpDeleteConnector struct { +} + +func (*awsRestjson1_serializeOpDeleteConnector) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteConnector) 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.(*DeleteConnectorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/connectors/{ConnectorArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsDeleteConnectorInput(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_serializeOpHttpBindingsDeleteConnectorInput(v *DeleteConnectorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ConnectorArn == nil || len(*v.ConnectorArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ConnectorArn must not be empty")} + } + if v.ConnectorArn != nil { + if err := encoder.SetURI("ConnectorArn").String(*v.ConnectorArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteDirectoryRegistration struct { +} + +func (*awsRestjson1_serializeOpDeleteDirectoryRegistration) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteDirectoryRegistration) 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.(*DeleteDirectoryRegistrationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/directoryRegistrations/{DirectoryRegistrationArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsDeleteDirectoryRegistrationInput(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_serializeOpHttpBindingsDeleteDirectoryRegistrationInput(v *DeleteDirectoryRegistrationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DirectoryRegistrationArn == nil || len(*v.DirectoryRegistrationArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DirectoryRegistrationArn must not be empty")} + } + if v.DirectoryRegistrationArn != nil { + if err := encoder.SetURI("DirectoryRegistrationArn").String(*v.DirectoryRegistrationArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteServicePrincipalName struct { +} + +func (*awsRestjson1_serializeOpDeleteServicePrincipalName) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteServicePrincipalName) 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.(*DeleteServicePrincipalNameInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/directoryRegistrations/{DirectoryRegistrationArn}/servicePrincipalNames/{ConnectorArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsDeleteServicePrincipalNameInput(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_serializeOpHttpBindingsDeleteServicePrincipalNameInput(v *DeleteServicePrincipalNameInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ConnectorArn == nil || len(*v.ConnectorArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ConnectorArn must not be empty")} + } + if v.ConnectorArn != nil { + if err := encoder.SetURI("ConnectorArn").String(*v.ConnectorArn); err != nil { + return err + } + } + + if v.DirectoryRegistrationArn == nil || len(*v.DirectoryRegistrationArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DirectoryRegistrationArn must not be empty")} + } + if v.DirectoryRegistrationArn != nil { + if err := encoder.SetURI("DirectoryRegistrationArn").String(*v.DirectoryRegistrationArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteTemplate struct { +} + +func (*awsRestjson1_serializeOpDeleteTemplate) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteTemplate) 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.(*DeleteTemplateInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates/{TemplateArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsDeleteTemplateInput(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_serializeOpHttpBindingsDeleteTemplateInput(v *DeleteTemplateInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TemplateArn == nil || len(*v.TemplateArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member TemplateArn must not be empty")} + } + if v.TemplateArn != nil { + if err := encoder.SetURI("TemplateArn").String(*v.TemplateArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpDeleteTemplateGroupAccessControlEntry struct { +} + +func (*awsRestjson1_serializeOpDeleteTemplateGroupAccessControlEntry) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDeleteTemplateGroupAccessControlEntry) 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.(*DeleteTemplateGroupAccessControlEntryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates/{TemplateArn}/accessControlEntries/{GroupSecurityIdentifier}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsDeleteTemplateGroupAccessControlEntryInput(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_serializeOpHttpBindingsDeleteTemplateGroupAccessControlEntryInput(v *DeleteTemplateGroupAccessControlEntryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.GroupSecurityIdentifier == nil || len(*v.GroupSecurityIdentifier) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member GroupSecurityIdentifier must not be empty")} + } + if v.GroupSecurityIdentifier != nil { + if err := encoder.SetURI("GroupSecurityIdentifier").String(*v.GroupSecurityIdentifier); err != nil { + return err + } + } + + if v.TemplateArn == nil || len(*v.TemplateArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member TemplateArn must not be empty")} + } + if v.TemplateArn != nil { + if err := encoder.SetURI("TemplateArn").String(*v.TemplateArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetConnector struct { +} + +func (*awsRestjson1_serializeOpGetConnector) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetConnector) 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.(*GetConnectorInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/connectors/{ConnectorArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetConnectorInput(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_serializeOpHttpBindingsGetConnectorInput(v *GetConnectorInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ConnectorArn == nil || len(*v.ConnectorArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ConnectorArn must not be empty")} + } + if v.ConnectorArn != nil { + if err := encoder.SetURI("ConnectorArn").String(*v.ConnectorArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetDirectoryRegistration struct { +} + +func (*awsRestjson1_serializeOpGetDirectoryRegistration) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetDirectoryRegistration) 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.(*GetDirectoryRegistrationInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/directoryRegistrations/{DirectoryRegistrationArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetDirectoryRegistrationInput(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_serializeOpHttpBindingsGetDirectoryRegistrationInput(v *GetDirectoryRegistrationInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DirectoryRegistrationArn == nil || len(*v.DirectoryRegistrationArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DirectoryRegistrationArn must not be empty")} + } + if v.DirectoryRegistrationArn != nil { + if err := encoder.SetURI("DirectoryRegistrationArn").String(*v.DirectoryRegistrationArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetServicePrincipalName struct { +} + +func (*awsRestjson1_serializeOpGetServicePrincipalName) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetServicePrincipalName) 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.(*GetServicePrincipalNameInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/directoryRegistrations/{DirectoryRegistrationArn}/servicePrincipalNames/{ConnectorArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetServicePrincipalNameInput(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_serializeOpHttpBindingsGetServicePrincipalNameInput(v *GetServicePrincipalNameInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ConnectorArn == nil || len(*v.ConnectorArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ConnectorArn must not be empty")} + } + if v.ConnectorArn != nil { + if err := encoder.SetURI("ConnectorArn").String(*v.ConnectorArn); err != nil { + return err + } + } + + if v.DirectoryRegistrationArn == nil || len(*v.DirectoryRegistrationArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DirectoryRegistrationArn must not be empty")} + } + if v.DirectoryRegistrationArn != nil { + if err := encoder.SetURI("DirectoryRegistrationArn").String(*v.DirectoryRegistrationArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetTemplate struct { +} + +func (*awsRestjson1_serializeOpGetTemplate) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetTemplate) 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.(*GetTemplateInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates/{TemplateArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetTemplateInput(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_serializeOpHttpBindingsGetTemplateInput(v *GetTemplateInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TemplateArn == nil || len(*v.TemplateArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member TemplateArn must not be empty")} + } + if v.TemplateArn != nil { + if err := encoder.SetURI("TemplateArn").String(*v.TemplateArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpGetTemplateGroupAccessControlEntry struct { +} + +func (*awsRestjson1_serializeOpGetTemplateGroupAccessControlEntry) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetTemplateGroupAccessControlEntry) 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.(*GetTemplateGroupAccessControlEntryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates/{TemplateArn}/accessControlEntries/{GroupSecurityIdentifier}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsGetTemplateGroupAccessControlEntryInput(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_serializeOpHttpBindingsGetTemplateGroupAccessControlEntryInput(v *GetTemplateGroupAccessControlEntryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.GroupSecurityIdentifier == nil || len(*v.GroupSecurityIdentifier) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member GroupSecurityIdentifier must not be empty")} + } + if v.GroupSecurityIdentifier != nil { + if err := encoder.SetURI("GroupSecurityIdentifier").String(*v.GroupSecurityIdentifier); err != nil { + return err + } + } + + if v.TemplateArn == nil || len(*v.TemplateArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member TemplateArn must not be empty")} + } + if v.TemplateArn != nil { + if err := encoder.SetURI("TemplateArn").String(*v.TemplateArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpListConnectors struct { +} + +func (*awsRestjson1_serializeOpListConnectors) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListConnectors) 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.(*ListConnectorsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/connectors") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListConnectorsInput(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_serializeOpHttpBindingsListConnectorsInput(v *ListConnectorsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.MaxResults != nil { + encoder.SetQuery("MaxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("NextToken").String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListDirectoryRegistrations struct { +} + +func (*awsRestjson1_serializeOpListDirectoryRegistrations) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListDirectoryRegistrations) 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.(*ListDirectoryRegistrationsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/directoryRegistrations") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListDirectoryRegistrationsInput(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_serializeOpHttpBindingsListDirectoryRegistrationsInput(v *ListDirectoryRegistrationsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.MaxResults != nil { + encoder.SetQuery("MaxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("NextToken").String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListServicePrincipalNames struct { +} + +func (*awsRestjson1_serializeOpListServicePrincipalNames) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListServicePrincipalNames) 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.(*ListServicePrincipalNamesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/directoryRegistrations/{DirectoryRegistrationArn}/servicePrincipalNames") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListServicePrincipalNamesInput(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_serializeOpHttpBindingsListServicePrincipalNamesInput(v *ListServicePrincipalNamesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.DirectoryRegistrationArn == nil || len(*v.DirectoryRegistrationArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member DirectoryRegistrationArn must not be empty")} + } + if v.DirectoryRegistrationArn != nil { + if err := encoder.SetURI("DirectoryRegistrationArn").String(*v.DirectoryRegistrationArn); err != nil { + return err + } + } + + if v.MaxResults != nil { + encoder.SetQuery("MaxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("NextToken").String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpListTagsForResource struct { +} + +func (*awsRestjson1_serializeOpListTagsForResource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListTagsForResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*ListTagsForResourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/tags/{ResourceArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListTagsForResourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsListTagsForResourceInput(v *ListTagsForResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ResourceArn == nil || len(*v.ResourceArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceArn must not be empty")} + } + if v.ResourceArn != nil { + if err := encoder.SetURI("ResourceArn").String(*v.ResourceArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpListTemplateGroupAccessControlEntries struct { +} + +func (*awsRestjson1_serializeOpListTemplateGroupAccessControlEntries) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListTemplateGroupAccessControlEntries) 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.(*ListTemplateGroupAccessControlEntriesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates/{TemplateArn}/accessControlEntries") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListTemplateGroupAccessControlEntriesInput(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_serializeOpHttpBindingsListTemplateGroupAccessControlEntriesInput(v *ListTemplateGroupAccessControlEntriesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.MaxResults != nil { + encoder.SetQuery("MaxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("NextToken").String(*v.NextToken) + } + + if v.TemplateArn == nil || len(*v.TemplateArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member TemplateArn must not be empty")} + } + if v.TemplateArn != nil { + if err := encoder.SetURI("TemplateArn").String(*v.TemplateArn); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpListTemplates struct { +} + +func (*awsRestjson1_serializeOpListTemplates) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListTemplates) 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.(*ListTemplatesInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "GET" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsListTemplatesInput(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_serializeOpHttpBindingsListTemplatesInput(v *ListTemplatesInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ConnectorArn != nil { + encoder.SetQuery("ConnectorArn").String(*v.ConnectorArn) + } + + if v.MaxResults != nil { + encoder.SetQuery("MaxResults").Integer(*v.MaxResults) + } + + if v.NextToken != nil { + encoder.SetQuery("NextToken").String(*v.NextToken) + } + + return nil +} + +type awsRestjson1_serializeOpTagResource struct { +} + +func (*awsRestjson1_serializeOpTagResource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpTagResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*TagResourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/tags/{ResourceArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsTagResourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentTagResourceInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsTagResourceInput(v *TagResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ResourceArn == nil || len(*v.ResourceArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceArn must not be empty")} + } + if v.ResourceArn != nil { + if err := encoder.SetURI("ResourceArn").String(*v.ResourceArn); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentTagResourceInput(v *TagResourceInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsRestjson1_serializeDocumentTags(v.Tags, ok); err != nil { + return err + } + } + + return nil +} + +type awsRestjson1_serializeOpUntagResource struct { +} + +func (*awsRestjson1_serializeOpUntagResource) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUntagResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*UntagResourceInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/tags/{ResourceArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "DELETE" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsUntagResourceInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsUntagResourceInput(v *UntagResourceInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.ResourceArn == nil || len(*v.ResourceArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member ResourceArn must not be empty")} + } + if v.ResourceArn != nil { + if err := encoder.SetURI("ResourceArn").String(*v.ResourceArn); err != nil { + return err + } + } + + if v.TagKeys != nil { + for i := range v.TagKeys { + encoder.AddQuery("tagKeys").String(v.TagKeys[i]) + } + } + + return nil +} + +type awsRestjson1_serializeOpUpdateTemplate struct { +} + +func (*awsRestjson1_serializeOpUpdateTemplate) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateTemplate) 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.(*UpdateTemplateInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates/{TemplateArn}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PATCH" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsUpdateTemplateInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateTemplateInput(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_serializeOpHttpBindingsUpdateTemplateInput(v *UpdateTemplateInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.TemplateArn == nil || len(*v.TemplateArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member TemplateArn must not be empty")} + } + if v.TemplateArn != nil { + if err := encoder.SetURI("TemplateArn").String(*v.TemplateArn); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateTemplateInput(v *UpdateTemplateInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Definition != nil { + ok := object.Key("Definition") + if err := awsRestjson1_serializeDocumentTemplateDefinition(v.Definition, ok); err != nil { + return err + } + } + + if v.ReenrollAllCertificateHolders != nil { + ok := object.Key("ReenrollAllCertificateHolders") + ok.Boolean(*v.ReenrollAllCertificateHolders) + } + + return nil +} + +type awsRestjson1_serializeOpUpdateTemplateGroupAccessControlEntry struct { +} + +func (*awsRestjson1_serializeOpUpdateTemplateGroupAccessControlEntry) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpUpdateTemplateGroupAccessControlEntry) 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.(*UpdateTemplateGroupAccessControlEntryInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/templates/{TemplateArn}/accessControlEntries/{GroupSecurityIdentifier}") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "PATCH" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if err := awsRestjson1_serializeOpHttpBindingsUpdateTemplateGroupAccessControlEntryInput(input, restEncoder); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentUpdateTemplateGroupAccessControlEntryInput(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_serializeOpHttpBindingsUpdateTemplateGroupAccessControlEntryInput(v *UpdateTemplateGroupAccessControlEntryInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + if v.GroupSecurityIdentifier == nil || len(*v.GroupSecurityIdentifier) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member GroupSecurityIdentifier must not be empty")} + } + if v.GroupSecurityIdentifier != nil { + if err := encoder.SetURI("GroupSecurityIdentifier").String(*v.GroupSecurityIdentifier); err != nil { + return err + } + } + + if v.TemplateArn == nil || len(*v.TemplateArn) == 0 { + return &smithy.SerializationError{Err: fmt.Errorf("input member TemplateArn must not be empty")} + } + if v.TemplateArn != nil { + if err := encoder.SetURI("TemplateArn").String(*v.TemplateArn); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeOpDocumentUpdateTemplateGroupAccessControlEntryInput(v *UpdateTemplateGroupAccessControlEntryInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccessRights != nil { + ok := object.Key("AccessRights") + if err := awsRestjson1_serializeDocumentAccessRights(v.AccessRights, ok); err != nil { + return err + } + } + + if v.GroupDisplayName != nil { + ok := object.Key("GroupDisplayName") + ok.String(*v.GroupDisplayName) + } + + return nil +} + +func awsRestjson1_serializeDocumentAccessRights(v *types.AccessRights, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.AutoEnroll) > 0 { + ok := object.Key("AutoEnroll") + ok.String(string(v.AutoEnroll)) + } + + if len(v.Enroll) > 0 { + ok := object.Key("Enroll") + ok.String(string(v.Enroll)) + } + + return nil +} + +func awsRestjson1_serializeDocumentApplicationPolicies(v *types.ApplicationPolicies, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Critical != nil { + ok := object.Key("Critical") + ok.Boolean(*v.Critical) + } + + if v.Policies != nil { + ok := object.Key("Policies") + if err := awsRestjson1_serializeDocumentApplicationPolicyList(v.Policies, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentApplicationPolicy(v types.ApplicationPolicy, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.ApplicationPolicyMemberPolicyObjectIdentifier: + av := object.Key("PolicyObjectIdentifier") + av.String(uv.Value) + + case *types.ApplicationPolicyMemberPolicyType: + av := object.Key("PolicyType") + av.String(string(uv.Value)) + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentApplicationPolicyList(v []types.ApplicationPolicy, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if vv := v[i]; vv == nil { + continue + } + if err := awsRestjson1_serializeDocumentApplicationPolicy(v[i], av); err != nil { + return err + } + } + return nil +} + +func awsRestjson1_serializeDocumentCertificateValidity(v *types.CertificateValidity, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.RenewalPeriod != nil { + ok := object.Key("RenewalPeriod") + if err := awsRestjson1_serializeDocumentValidityPeriod(v.RenewalPeriod, ok); err != nil { + return err + } + } + + if v.ValidityPeriod != nil { + ok := object.Key("ValidityPeriod") + if err := awsRestjson1_serializeDocumentValidityPeriod(v.ValidityPeriod, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentCryptoProvidersList(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_serializeDocumentEnrollmentFlagsV2(v *types.EnrollmentFlagsV2, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EnableKeyReuseOnNtTokenKeysetStorageFull != nil { + ok := object.Key("EnableKeyReuseOnNtTokenKeysetStorageFull") + ok.Boolean(*v.EnableKeyReuseOnNtTokenKeysetStorageFull) + } + + if v.IncludeSymmetricAlgorithms != nil { + ok := object.Key("IncludeSymmetricAlgorithms") + ok.Boolean(*v.IncludeSymmetricAlgorithms) + } + + if v.NoSecurityExtension != nil { + ok := object.Key("NoSecurityExtension") + ok.Boolean(*v.NoSecurityExtension) + } + + if v.RemoveInvalidCertificateFromPersonalStore != nil { + ok := object.Key("RemoveInvalidCertificateFromPersonalStore") + ok.Boolean(*v.RemoveInvalidCertificateFromPersonalStore) + } + + if v.UserInteractionRequired != nil { + ok := object.Key("UserInteractionRequired") + ok.Boolean(*v.UserInteractionRequired) + } + + return nil +} + +func awsRestjson1_serializeDocumentEnrollmentFlagsV3(v *types.EnrollmentFlagsV3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EnableKeyReuseOnNtTokenKeysetStorageFull != nil { + ok := object.Key("EnableKeyReuseOnNtTokenKeysetStorageFull") + ok.Boolean(*v.EnableKeyReuseOnNtTokenKeysetStorageFull) + } + + if v.IncludeSymmetricAlgorithms != nil { + ok := object.Key("IncludeSymmetricAlgorithms") + ok.Boolean(*v.IncludeSymmetricAlgorithms) + } + + if v.NoSecurityExtension != nil { + ok := object.Key("NoSecurityExtension") + ok.Boolean(*v.NoSecurityExtension) + } + + if v.RemoveInvalidCertificateFromPersonalStore != nil { + ok := object.Key("RemoveInvalidCertificateFromPersonalStore") + ok.Boolean(*v.RemoveInvalidCertificateFromPersonalStore) + } + + if v.UserInteractionRequired != nil { + ok := object.Key("UserInteractionRequired") + ok.Boolean(*v.UserInteractionRequired) + } + + return nil +} + +func awsRestjson1_serializeDocumentEnrollmentFlagsV4(v *types.EnrollmentFlagsV4, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EnableKeyReuseOnNtTokenKeysetStorageFull != nil { + ok := object.Key("EnableKeyReuseOnNtTokenKeysetStorageFull") + ok.Boolean(*v.EnableKeyReuseOnNtTokenKeysetStorageFull) + } + + if v.IncludeSymmetricAlgorithms != nil { + ok := object.Key("IncludeSymmetricAlgorithms") + ok.Boolean(*v.IncludeSymmetricAlgorithms) + } + + if v.NoSecurityExtension != nil { + ok := object.Key("NoSecurityExtension") + ok.Boolean(*v.NoSecurityExtension) + } + + if v.RemoveInvalidCertificateFromPersonalStore != nil { + ok := object.Key("RemoveInvalidCertificateFromPersonalStore") + ok.Boolean(*v.RemoveInvalidCertificateFromPersonalStore) + } + + if v.UserInteractionRequired != nil { + ok := object.Key("UserInteractionRequired") + ok.Boolean(*v.UserInteractionRequired) + } + + return nil +} + +func awsRestjson1_serializeDocumentExtensionsV2(v *types.ExtensionsV2, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ApplicationPolicies != nil { + ok := object.Key("ApplicationPolicies") + if err := awsRestjson1_serializeDocumentApplicationPolicies(v.ApplicationPolicies, ok); err != nil { + return err + } + } + + if v.KeyUsage != nil { + ok := object.Key("KeyUsage") + if err := awsRestjson1_serializeDocumentKeyUsage(v.KeyUsage, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentExtensionsV3(v *types.ExtensionsV3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ApplicationPolicies != nil { + ok := object.Key("ApplicationPolicies") + if err := awsRestjson1_serializeDocumentApplicationPolicies(v.ApplicationPolicies, ok); err != nil { + return err + } + } + + if v.KeyUsage != nil { + ok := object.Key("KeyUsage") + if err := awsRestjson1_serializeDocumentKeyUsage(v.KeyUsage, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentExtensionsV4(v *types.ExtensionsV4, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ApplicationPolicies != nil { + ok := object.Key("ApplicationPolicies") + if err := awsRestjson1_serializeDocumentApplicationPolicies(v.ApplicationPolicies, ok); err != nil { + return err + } + } + + if v.KeyUsage != nil { + ok := object.Key("KeyUsage") + if err := awsRestjson1_serializeDocumentKeyUsage(v.KeyUsage, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentGeneralFlagsV2(v *types.GeneralFlagsV2, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AutoEnrollment != nil { + ok := object.Key("AutoEnrollment") + ok.Boolean(*v.AutoEnrollment) + } + + if v.MachineType != nil { + ok := object.Key("MachineType") + ok.Boolean(*v.MachineType) + } + + return nil +} + +func awsRestjson1_serializeDocumentGeneralFlagsV3(v *types.GeneralFlagsV3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AutoEnrollment != nil { + ok := object.Key("AutoEnrollment") + ok.Boolean(*v.AutoEnrollment) + } + + if v.MachineType != nil { + ok := object.Key("MachineType") + ok.Boolean(*v.MachineType) + } + + return nil +} + +func awsRestjson1_serializeDocumentGeneralFlagsV4(v *types.GeneralFlagsV4, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AutoEnrollment != nil { + ok := object.Key("AutoEnrollment") + ok.Boolean(*v.AutoEnrollment) + } + + if v.MachineType != nil { + ok := object.Key("MachineType") + ok.Boolean(*v.MachineType) + } + + return nil +} + +func awsRestjson1_serializeDocumentKeyUsage(v *types.KeyUsage, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Critical != nil { + ok := object.Key("Critical") + ok.Boolean(*v.Critical) + } + + if v.UsageFlags != nil { + ok := object.Key("UsageFlags") + if err := awsRestjson1_serializeDocumentKeyUsageFlags(v.UsageFlags, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentKeyUsageFlags(v *types.KeyUsageFlags, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DataEncipherment != nil { + ok := object.Key("DataEncipherment") + ok.Boolean(*v.DataEncipherment) + } + + if v.DigitalSignature != nil { + ok := object.Key("DigitalSignature") + ok.Boolean(*v.DigitalSignature) + } + + if v.KeyAgreement != nil { + ok := object.Key("KeyAgreement") + ok.Boolean(*v.KeyAgreement) + } + + if v.KeyEncipherment != nil { + ok := object.Key("KeyEncipherment") + ok.Boolean(*v.KeyEncipherment) + } + + if v.NonRepudiation != nil { + ok := object.Key("NonRepudiation") + ok.Boolean(*v.NonRepudiation) + } + + return nil +} + +func awsRestjson1_serializeDocumentKeyUsageProperty(v types.KeyUsageProperty, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.KeyUsagePropertyMemberPropertyFlags: + av := object.Key("PropertyFlags") + if err := awsRestjson1_serializeDocumentKeyUsagePropertyFlags(&uv.Value, av); err != nil { + return err + } + + case *types.KeyUsagePropertyMemberPropertyType: + av := object.Key("PropertyType") + av.String(string(uv.Value)) + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentKeyUsagePropertyFlags(v *types.KeyUsagePropertyFlags, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Decrypt != nil { + ok := object.Key("Decrypt") + ok.Boolean(*v.Decrypt) + } + + if v.KeyAgreement != nil { + ok := object.Key("KeyAgreement") + ok.Boolean(*v.KeyAgreement) + } + + if v.Sign != nil { + ok := object.Key("Sign") + ok.Boolean(*v.Sign) + } + + return nil +} + +func awsRestjson1_serializeDocumentPrivateKeyAttributesV2(v *types.PrivateKeyAttributesV2, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CryptoProviders != nil { + ok := object.Key("CryptoProviders") + if err := awsRestjson1_serializeDocumentCryptoProvidersList(v.CryptoProviders, ok); err != nil { + return err + } + } + + if len(v.KeySpec) > 0 { + ok := object.Key("KeySpec") + ok.String(string(v.KeySpec)) + } + + if v.MinimalKeyLength != nil { + ok := object.Key("MinimalKeyLength") + ok.Integer(*v.MinimalKeyLength) + } + + return nil +} + +func awsRestjson1_serializeDocumentPrivateKeyAttributesV3(v *types.PrivateKeyAttributesV3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Algorithm) > 0 { + ok := object.Key("Algorithm") + ok.String(string(v.Algorithm)) + } + + if v.CryptoProviders != nil { + ok := object.Key("CryptoProviders") + if err := awsRestjson1_serializeDocumentCryptoProvidersList(v.CryptoProviders, ok); err != nil { + return err + } + } + + if len(v.KeySpec) > 0 { + ok := object.Key("KeySpec") + ok.String(string(v.KeySpec)) + } + + if v.KeyUsageProperty != nil { + ok := object.Key("KeyUsageProperty") + if err := awsRestjson1_serializeDocumentKeyUsageProperty(v.KeyUsageProperty, ok); err != nil { + return err + } + } + + if v.MinimalKeyLength != nil { + ok := object.Key("MinimalKeyLength") + ok.Integer(*v.MinimalKeyLength) + } + + return nil +} + +func awsRestjson1_serializeDocumentPrivateKeyAttributesV4(v *types.PrivateKeyAttributesV4, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.Algorithm) > 0 { + ok := object.Key("Algorithm") + ok.String(string(v.Algorithm)) + } + + if v.CryptoProviders != nil { + ok := object.Key("CryptoProviders") + if err := awsRestjson1_serializeDocumentCryptoProvidersList(v.CryptoProviders, ok); err != nil { + return err + } + } + + if len(v.KeySpec) > 0 { + ok := object.Key("KeySpec") + ok.String(string(v.KeySpec)) + } + + if v.KeyUsageProperty != nil { + ok := object.Key("KeyUsageProperty") + if err := awsRestjson1_serializeDocumentKeyUsageProperty(v.KeyUsageProperty, ok); err != nil { + return err + } + } + + if v.MinimalKeyLength != nil { + ok := object.Key("MinimalKeyLength") + ok.Integer(*v.MinimalKeyLength) + } + + return nil +} + +func awsRestjson1_serializeDocumentPrivateKeyFlagsV2(v *types.PrivateKeyFlagsV2, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.ClientVersion) > 0 { + ok := object.Key("ClientVersion") + ok.String(string(v.ClientVersion)) + } + + if v.ExportableKey != nil { + ok := object.Key("ExportableKey") + ok.Boolean(*v.ExportableKey) + } + + if v.StrongKeyProtectionRequired != nil { + ok := object.Key("StrongKeyProtectionRequired") + ok.Boolean(*v.StrongKeyProtectionRequired) + } + + return nil +} + +func awsRestjson1_serializeDocumentPrivateKeyFlagsV3(v *types.PrivateKeyFlagsV3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.ClientVersion) > 0 { + ok := object.Key("ClientVersion") + ok.String(string(v.ClientVersion)) + } + + if v.ExportableKey != nil { + ok := object.Key("ExportableKey") + ok.Boolean(*v.ExportableKey) + } + + if v.RequireAlternateSignatureAlgorithm != nil { + ok := object.Key("RequireAlternateSignatureAlgorithm") + ok.Boolean(*v.RequireAlternateSignatureAlgorithm) + } + + if v.StrongKeyProtectionRequired != nil { + ok := object.Key("StrongKeyProtectionRequired") + ok.Boolean(*v.StrongKeyProtectionRequired) + } + + return nil +} + +func awsRestjson1_serializeDocumentPrivateKeyFlagsV4(v *types.PrivateKeyFlagsV4, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.ClientVersion) > 0 { + ok := object.Key("ClientVersion") + ok.String(string(v.ClientVersion)) + } + + if v.ExportableKey != nil { + ok := object.Key("ExportableKey") + ok.Boolean(*v.ExportableKey) + } + + if v.RequireAlternateSignatureAlgorithm != nil { + ok := object.Key("RequireAlternateSignatureAlgorithm") + ok.Boolean(*v.RequireAlternateSignatureAlgorithm) + } + + if v.RequireSameKeyRenewal != nil { + ok := object.Key("RequireSameKeyRenewal") + ok.Boolean(*v.RequireSameKeyRenewal) + } + + if v.StrongKeyProtectionRequired != nil { + ok := object.Key("StrongKeyProtectionRequired") + ok.Boolean(*v.StrongKeyProtectionRequired) + } + + if v.UseLegacyProvider != nil { + ok := object.Key("UseLegacyProvider") + ok.Boolean(*v.UseLegacyProvider) + } + + return nil +} + +func awsRestjson1_serializeDocumentSecurityGroupIdList(v []string, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(v[i]) + } + return nil +} + +func awsRestjson1_serializeDocumentSubjectNameFlagsV2(v *types.SubjectNameFlagsV2, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.RequireCommonName != nil { + ok := object.Key("RequireCommonName") + ok.Boolean(*v.RequireCommonName) + } + + if v.RequireDirectoryPath != nil { + ok := object.Key("RequireDirectoryPath") + ok.Boolean(*v.RequireDirectoryPath) + } + + if v.RequireDnsAsCn != nil { + ok := object.Key("RequireDnsAsCn") + ok.Boolean(*v.RequireDnsAsCn) + } + + if v.RequireEmail != nil { + ok := object.Key("RequireEmail") + ok.Boolean(*v.RequireEmail) + } + + if v.SanRequireDirectoryGuid != nil { + ok := object.Key("SanRequireDirectoryGuid") + ok.Boolean(*v.SanRequireDirectoryGuid) + } + + if v.SanRequireDns != nil { + ok := object.Key("SanRequireDns") + ok.Boolean(*v.SanRequireDns) + } + + if v.SanRequireDomainDns != nil { + ok := object.Key("SanRequireDomainDns") + ok.Boolean(*v.SanRequireDomainDns) + } + + if v.SanRequireEmail != nil { + ok := object.Key("SanRequireEmail") + ok.Boolean(*v.SanRequireEmail) + } + + if v.SanRequireSpn != nil { + ok := object.Key("SanRequireSpn") + ok.Boolean(*v.SanRequireSpn) + } + + if v.SanRequireUpn != nil { + ok := object.Key("SanRequireUpn") + ok.Boolean(*v.SanRequireUpn) + } + + return nil +} + +func awsRestjson1_serializeDocumentSubjectNameFlagsV3(v *types.SubjectNameFlagsV3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.RequireCommonName != nil { + ok := object.Key("RequireCommonName") + ok.Boolean(*v.RequireCommonName) + } + + if v.RequireDirectoryPath != nil { + ok := object.Key("RequireDirectoryPath") + ok.Boolean(*v.RequireDirectoryPath) + } + + if v.RequireDnsAsCn != nil { + ok := object.Key("RequireDnsAsCn") + ok.Boolean(*v.RequireDnsAsCn) + } + + if v.RequireEmail != nil { + ok := object.Key("RequireEmail") + ok.Boolean(*v.RequireEmail) + } + + if v.SanRequireDirectoryGuid != nil { + ok := object.Key("SanRequireDirectoryGuid") + ok.Boolean(*v.SanRequireDirectoryGuid) + } + + if v.SanRequireDns != nil { + ok := object.Key("SanRequireDns") + ok.Boolean(*v.SanRequireDns) + } + + if v.SanRequireDomainDns != nil { + ok := object.Key("SanRequireDomainDns") + ok.Boolean(*v.SanRequireDomainDns) + } + + if v.SanRequireEmail != nil { + ok := object.Key("SanRequireEmail") + ok.Boolean(*v.SanRequireEmail) + } + + if v.SanRequireSpn != nil { + ok := object.Key("SanRequireSpn") + ok.Boolean(*v.SanRequireSpn) + } + + if v.SanRequireUpn != nil { + ok := object.Key("SanRequireUpn") + ok.Boolean(*v.SanRequireUpn) + } + + return nil +} + +func awsRestjson1_serializeDocumentSubjectNameFlagsV4(v *types.SubjectNameFlagsV4, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.RequireCommonName != nil { + ok := object.Key("RequireCommonName") + ok.Boolean(*v.RequireCommonName) + } + + if v.RequireDirectoryPath != nil { + ok := object.Key("RequireDirectoryPath") + ok.Boolean(*v.RequireDirectoryPath) + } + + if v.RequireDnsAsCn != nil { + ok := object.Key("RequireDnsAsCn") + ok.Boolean(*v.RequireDnsAsCn) + } + + if v.RequireEmail != nil { + ok := object.Key("RequireEmail") + ok.Boolean(*v.RequireEmail) + } + + if v.SanRequireDirectoryGuid != nil { + ok := object.Key("SanRequireDirectoryGuid") + ok.Boolean(*v.SanRequireDirectoryGuid) + } + + if v.SanRequireDns != nil { + ok := object.Key("SanRequireDns") + ok.Boolean(*v.SanRequireDns) + } + + if v.SanRequireDomainDns != nil { + ok := object.Key("SanRequireDomainDns") + ok.Boolean(*v.SanRequireDomainDns) + } + + if v.SanRequireEmail != nil { + ok := object.Key("SanRequireEmail") + ok.Boolean(*v.SanRequireEmail) + } + + if v.SanRequireSpn != nil { + ok := object.Key("SanRequireSpn") + ok.Boolean(*v.SanRequireSpn) + } + + if v.SanRequireUpn != nil { + ok := object.Key("SanRequireUpn") + ok.Boolean(*v.SanRequireUpn) + } + + return nil +} + +func awsRestjson1_serializeDocumentTags(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_serializeDocumentTemplateDefinition(v types.TemplateDefinition, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + switch uv := v.(type) { + case *types.TemplateDefinitionMemberTemplateV2: + av := object.Key("TemplateV2") + if err := awsRestjson1_serializeDocumentTemplateV2(&uv.Value, av); err != nil { + return err + } + + case *types.TemplateDefinitionMemberTemplateV3: + av := object.Key("TemplateV3") + if err := awsRestjson1_serializeDocumentTemplateV3(&uv.Value, av); err != nil { + return err + } + + case *types.TemplateDefinitionMemberTemplateV4: + av := object.Key("TemplateV4") + if err := awsRestjson1_serializeDocumentTemplateV4(&uv.Value, av); err != nil { + return err + } + + default: + return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) + + } + return nil +} + +func awsRestjson1_serializeDocumentTemplateNameList(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_serializeDocumentTemplateV2(v *types.TemplateV2, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CertificateValidity != nil { + ok := object.Key("CertificateValidity") + if err := awsRestjson1_serializeDocumentCertificateValidity(v.CertificateValidity, ok); err != nil { + return err + } + } + + if v.EnrollmentFlags != nil { + ok := object.Key("EnrollmentFlags") + if err := awsRestjson1_serializeDocumentEnrollmentFlagsV2(v.EnrollmentFlags, ok); err != nil { + return err + } + } + + if v.Extensions != nil { + ok := object.Key("Extensions") + if err := awsRestjson1_serializeDocumentExtensionsV2(v.Extensions, ok); err != nil { + return err + } + } + + if v.GeneralFlags != nil { + ok := object.Key("GeneralFlags") + if err := awsRestjson1_serializeDocumentGeneralFlagsV2(v.GeneralFlags, ok); err != nil { + return err + } + } + + if v.PrivateKeyAttributes != nil { + ok := object.Key("PrivateKeyAttributes") + if err := awsRestjson1_serializeDocumentPrivateKeyAttributesV2(v.PrivateKeyAttributes, ok); err != nil { + return err + } + } + + if v.PrivateKeyFlags != nil { + ok := object.Key("PrivateKeyFlags") + if err := awsRestjson1_serializeDocumentPrivateKeyFlagsV2(v.PrivateKeyFlags, ok); err != nil { + return err + } + } + + if v.SubjectNameFlags != nil { + ok := object.Key("SubjectNameFlags") + if err := awsRestjson1_serializeDocumentSubjectNameFlagsV2(v.SubjectNameFlags, ok); err != nil { + return err + } + } + + if v.SupersededTemplates != nil { + ok := object.Key("SupersededTemplates") + if err := awsRestjson1_serializeDocumentTemplateNameList(v.SupersededTemplates, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentTemplateV3(v *types.TemplateV3, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CertificateValidity != nil { + ok := object.Key("CertificateValidity") + if err := awsRestjson1_serializeDocumentCertificateValidity(v.CertificateValidity, ok); err != nil { + return err + } + } + + if v.EnrollmentFlags != nil { + ok := object.Key("EnrollmentFlags") + if err := awsRestjson1_serializeDocumentEnrollmentFlagsV3(v.EnrollmentFlags, ok); err != nil { + return err + } + } + + if v.Extensions != nil { + ok := object.Key("Extensions") + if err := awsRestjson1_serializeDocumentExtensionsV3(v.Extensions, ok); err != nil { + return err + } + } + + if v.GeneralFlags != nil { + ok := object.Key("GeneralFlags") + if err := awsRestjson1_serializeDocumentGeneralFlagsV3(v.GeneralFlags, ok); err != nil { + return err + } + } + + if len(v.HashAlgorithm) > 0 { + ok := object.Key("HashAlgorithm") + ok.String(string(v.HashAlgorithm)) + } + + if v.PrivateKeyAttributes != nil { + ok := object.Key("PrivateKeyAttributes") + if err := awsRestjson1_serializeDocumentPrivateKeyAttributesV3(v.PrivateKeyAttributes, ok); err != nil { + return err + } + } + + if v.PrivateKeyFlags != nil { + ok := object.Key("PrivateKeyFlags") + if err := awsRestjson1_serializeDocumentPrivateKeyFlagsV3(v.PrivateKeyFlags, ok); err != nil { + return err + } + } + + if v.SubjectNameFlags != nil { + ok := object.Key("SubjectNameFlags") + if err := awsRestjson1_serializeDocumentSubjectNameFlagsV3(v.SubjectNameFlags, ok); err != nil { + return err + } + } + + if v.SupersededTemplates != nil { + ok := object.Key("SupersededTemplates") + if err := awsRestjson1_serializeDocumentTemplateNameList(v.SupersededTemplates, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentTemplateV4(v *types.TemplateV4, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.CertificateValidity != nil { + ok := object.Key("CertificateValidity") + if err := awsRestjson1_serializeDocumentCertificateValidity(v.CertificateValidity, ok); err != nil { + return err + } + } + + if v.EnrollmentFlags != nil { + ok := object.Key("EnrollmentFlags") + if err := awsRestjson1_serializeDocumentEnrollmentFlagsV4(v.EnrollmentFlags, ok); err != nil { + return err + } + } + + if v.Extensions != nil { + ok := object.Key("Extensions") + if err := awsRestjson1_serializeDocumentExtensionsV4(v.Extensions, ok); err != nil { + return err + } + } + + if v.GeneralFlags != nil { + ok := object.Key("GeneralFlags") + if err := awsRestjson1_serializeDocumentGeneralFlagsV4(v.GeneralFlags, ok); err != nil { + return err + } + } + + if len(v.HashAlgorithm) > 0 { + ok := object.Key("HashAlgorithm") + ok.String(string(v.HashAlgorithm)) + } + + if v.PrivateKeyAttributes != nil { + ok := object.Key("PrivateKeyAttributes") + if err := awsRestjson1_serializeDocumentPrivateKeyAttributesV4(v.PrivateKeyAttributes, ok); err != nil { + return err + } + } + + if v.PrivateKeyFlags != nil { + ok := object.Key("PrivateKeyFlags") + if err := awsRestjson1_serializeDocumentPrivateKeyFlagsV4(v.PrivateKeyFlags, ok); err != nil { + return err + } + } + + if v.SubjectNameFlags != nil { + ok := object.Key("SubjectNameFlags") + if err := awsRestjson1_serializeDocumentSubjectNameFlagsV4(v.SubjectNameFlags, ok); err != nil { + return err + } + } + + if v.SupersededTemplates != nil { + ok := object.Key("SupersededTemplates") + if err := awsRestjson1_serializeDocumentTemplateNameList(v.SupersededTemplates, ok); err != nil { + return err + } + } + + return nil +} + +func awsRestjson1_serializeDocumentValidityPeriod(v *types.ValidityPeriod, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Period != nil { + ok := object.Key("Period") + ok.Long(*v.Period) + } + + if len(v.PeriodType) > 0 { + ok := object.Key("PeriodType") + ok.String(string(v.PeriodType)) + } + + return nil +} + +func awsRestjson1_serializeDocumentVpcInformation(v *types.VpcInformation, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.SecurityGroupIds != nil { + ok := object.Key("SecurityGroupIds") + if err := awsRestjson1_serializeDocumentSecurityGroupIdList(v.SecurityGroupIds, ok); err != nil { + return err + } + } + + return nil +} diff --git a/service/pcaconnectorad/types/enums.go b/service/pcaconnectorad/types/enums.go new file mode 100644 index 00000000000..d8a2d490d1d --- /dev/null +++ b/service/pcaconnectorad/types/enums.go @@ -0,0 +1,535 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +type AccessRight string + +// Enum values for AccessRight +const ( + AccessRightAllow AccessRight = "ALLOW" + AccessRightDeny AccessRight = "DENY" +) + +// Values returns all known values for AccessRight. 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 (AccessRight) Values() []AccessRight { + return []AccessRight{ + "ALLOW", + "DENY", + } +} + +type ApplicationPolicyType string + +// Enum values for ApplicationPolicyType +const ( + ApplicationPolicyTypeAllApplicationPolicies ApplicationPolicyType = "ALL_APPLICATION_POLICIES" + ApplicationPolicyTypeAnyPurpose ApplicationPolicyType = "ANY_PURPOSE" + ApplicationPolicyTypeAttestationIdentityKeyCertificate ApplicationPolicyType = "ATTESTATION_IDENTITY_KEY_CERTIFICATE" + ApplicationPolicyTypeCertificateRequestAgent ApplicationPolicyType = "CERTIFICATE_REQUEST_AGENT" + ApplicationPolicyTypeClientAuthentication ApplicationPolicyType = "CLIENT_AUTHENTICATION" + ApplicationPolicyTypeCodeSigning ApplicationPolicyType = "CODE_SIGNING" + ApplicationPolicyTypeCtlUsage ApplicationPolicyType = "CTL_USAGE" + ApplicationPolicyTypeDigitalRights ApplicationPolicyType = "DIGITAL_RIGHTS" + ApplicationPolicyTypeDirectoryServiceEmailReplication ApplicationPolicyType = "DIRECTORY_SERVICE_EMAIL_REPLICATION" + ApplicationPolicyTypeDisallowedList ApplicationPolicyType = "DISALLOWED_LIST" + ApplicationPolicyTypeDnsServerTrust ApplicationPolicyType = "DNS_SERVER_TRUST" + ApplicationPolicyTypeDocumentEncryption ApplicationPolicyType = "DOCUMENT_ENCRYPTION" + ApplicationPolicyTypeDocumentSigning ApplicationPolicyType = "DOCUMENT_SIGNING" + ApplicationPolicyTypeDynamicCodeGenerator ApplicationPolicyType = "DYNAMIC_CODE_GENERATOR" + ApplicationPolicyTypeEarlyLaunchAntimalwareDriver ApplicationPolicyType = "EARLY_LAUNCH_ANTIMALWARE_DRIVER" + ApplicationPolicyTypeEmbeddedWindowsSystemComponentVerification ApplicationPolicyType = "EMBEDDED_WINDOWS_SYSTEM_COMPONENT_VERIFICATION" + ApplicationPolicyTypeEnclave ApplicationPolicyType = "ENCLAVE" + ApplicationPolicyTypeEncryptingFileSystem ApplicationPolicyType = "ENCRYPTING_FILE_SYSTEM" + ApplicationPolicyTypeEndorsementKeyCertificate ApplicationPolicyType = "ENDORSEMENT_KEY_CERTIFICATE" + ApplicationPolicyTypeFileRecovery ApplicationPolicyType = "FILE_RECOVERY" + ApplicationPolicyTypeHalExtension ApplicationPolicyType = "HAL_EXTENSION" + ApplicationPolicyTypeIpSecurityEndSystem ApplicationPolicyType = "IP_SECURITY_END_SYSTEM" + ApplicationPolicyTypeIpSecurityIkeIntermediate ApplicationPolicyType = "IP_SECURITY_IKE_INTERMEDIATE" + ApplicationPolicyTypeIpSecurityTunnelTermination ApplicationPolicyType = "IP_SECURITY_TUNNEL_TERMINATION" + ApplicationPolicyTypeIpSecurityUser ApplicationPolicyType = "IP_SECURITY_USER" + ApplicationPolicyTypeIsolatedUserMode ApplicationPolicyType = "ISOLATED_USER_MODE" + ApplicationPolicyTypeKdcAuthentication ApplicationPolicyType = "KDC_AUTHENTICATION" + ApplicationPolicyTypeKernelModeCodeSigning ApplicationPolicyType = "KERNEL_MODE_CODE_SIGNING" + ApplicationPolicyTypeKeyPackLicenses ApplicationPolicyType = "KEY_PACK_LICENSES" + ApplicationPolicyTypeKeyRecovery ApplicationPolicyType = "KEY_RECOVERY" + ApplicationPolicyTypeKeyRecoveryAgent ApplicationPolicyType = "KEY_RECOVERY_AGENT" + ApplicationPolicyTypeLicenseServerVerification ApplicationPolicyType = "LICENSE_SERVER_VERIFICATION" + ApplicationPolicyTypeLifetimeSigning ApplicationPolicyType = "LIFETIME_SIGNING" + ApplicationPolicyTypeMicrosoftPublisher ApplicationPolicyType = "MICROSOFT_PUBLISHER" + ApplicationPolicyTypeMicrosoftTimeStamping ApplicationPolicyType = "MICROSOFT_TIME_STAMPING" + ApplicationPolicyTypeMicrosoftTrustListSigning ApplicationPolicyType = "MICROSOFT_TRUST_LIST_SIGNING" + ApplicationPolicyTypeOcspSigning ApplicationPolicyType = "OCSP_SIGNING" + ApplicationPolicyTypeOemWindowsSystemComponentVerification ApplicationPolicyType = "OEM_WINDOWS_SYSTEM_COMPONENT_VERIFICATION" + ApplicationPolicyTypePlatformCertificate ApplicationPolicyType = "PLATFORM_CERTIFICATE" + ApplicationPolicyTypePreviewBuildSigning ApplicationPolicyType = "PREVIEW_BUILD_SIGNING" + ApplicationPolicyTypePrivateKeyArchival ApplicationPolicyType = "PRIVATE_KEY_ARCHIVAL" + ApplicationPolicyTypeProtectedProcessLightVerification ApplicationPolicyType = "PROTECTED_PROCESS_LIGHT_VERIFICATION" + ApplicationPolicyTypeProtectedProcessVerification ApplicationPolicyType = "PROTECTED_PROCESS_VERIFICATION" + ApplicationPolicyTypeQualifiedSubordination ApplicationPolicyType = "QUALIFIED_SUBORDINATION" + ApplicationPolicyTypeRevokedListSigner ApplicationPolicyType = "REVOKED_LIST_SIGNER" + ApplicationPolicyTypeRootProgramAutoUpdateCaRevocation ApplicationPolicyType = "ROOT_PROGRAM_AUTO_UPDATE_CA_REVOCATION" + ApplicationPolicyTypeRootProgramAutoUpdateEndRevocation ApplicationPolicyType = "ROOT_PROGRAM_AUTO_UPDATE_END_REVOCATION" + ApplicationPolicyTypeRootProgramNoOscpFailoverToCrl ApplicationPolicyType = "ROOT_PROGRAM_NO_OSCP_FAILOVER_TO_CRL" + ApplicationPolicyTypeRootListSigner ApplicationPolicyType = "ROOT_LIST_SIGNER" + ApplicationPolicyTypeSecureEmail ApplicationPolicyType = "SECURE_EMAIL" + ApplicationPolicyTypeServerAuthentication ApplicationPolicyType = "SERVER_AUTHENTICATION" + ApplicationPolicyTypeSmartCardLogin ApplicationPolicyType = "SMART_CARD_LOGIN" + ApplicationPolicyTypeSpcEncryptedDigestRetryCount ApplicationPolicyType = "SPC_ENCRYPTED_DIGEST_RETRY_COUNT" + ApplicationPolicyTypeSpcRelaxedPeMarkerCheck ApplicationPolicyType = "SPC_RELAXED_PE_MARKER_CHECK" + ApplicationPolicyTypeTimeStamping ApplicationPolicyType = "TIME_STAMPING" + ApplicationPolicyTypeWindowsHardwareDriverAttestedVerification ApplicationPolicyType = "WINDOWS_HARDWARE_DRIVER_ATTESTED_VERIFICATION" + ApplicationPolicyTypeWindowsHardwareDriverExtendedVerification ApplicationPolicyType = "WINDOWS_HARDWARE_DRIVER_EXTENDED_VERIFICATION" + ApplicationPolicyTypeWindowsHardwareDriverVerification ApplicationPolicyType = "WINDOWS_HARDWARE_DRIVER_VERIFICATION" + ApplicationPolicyTypeWindowsHelloRecoveryKeyEncryption ApplicationPolicyType = "WINDOWS_HELLO_RECOVERY_KEY_ENCRYPTION" + ApplicationPolicyTypeWindowsKitsComponent ApplicationPolicyType = "WINDOWS_KITS_COMPONENT" + ApplicationPolicyTypeWindowsRtVerification ApplicationPolicyType = "WINDOWS_RT_VERIFICATION" + ApplicationPolicyTypeWindowsSoftwareExtensionVerification ApplicationPolicyType = "WINDOWS_SOFTWARE_EXTENSION_VERIFICATION" + ApplicationPolicyTypeWindowsStore ApplicationPolicyType = "WINDOWS_STORE" + ApplicationPolicyTypeWindowsSystemComponentVerification ApplicationPolicyType = "WINDOWS_SYSTEM_COMPONENT_VERIFICATION" + ApplicationPolicyTypeWindowsTcbComponent ApplicationPolicyType = "WINDOWS_TCB_COMPONENT" + ApplicationPolicyTypeWindowsThirdPartyApplicationComponent ApplicationPolicyType = "WINDOWS_THIRD_PARTY_APPLICATION_COMPONENT" + ApplicationPolicyTypeWindowsUpdate ApplicationPolicyType = "WINDOWS_UPDATE" +) + +// Values returns all known values for ApplicationPolicyType. 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 (ApplicationPolicyType) Values() []ApplicationPolicyType { + return []ApplicationPolicyType{ + "ALL_APPLICATION_POLICIES", + "ANY_PURPOSE", + "ATTESTATION_IDENTITY_KEY_CERTIFICATE", + "CERTIFICATE_REQUEST_AGENT", + "CLIENT_AUTHENTICATION", + "CODE_SIGNING", + "CTL_USAGE", + "DIGITAL_RIGHTS", + "DIRECTORY_SERVICE_EMAIL_REPLICATION", + "DISALLOWED_LIST", + "DNS_SERVER_TRUST", + "DOCUMENT_ENCRYPTION", + "DOCUMENT_SIGNING", + "DYNAMIC_CODE_GENERATOR", + "EARLY_LAUNCH_ANTIMALWARE_DRIVER", + "EMBEDDED_WINDOWS_SYSTEM_COMPONENT_VERIFICATION", + "ENCLAVE", + "ENCRYPTING_FILE_SYSTEM", + "ENDORSEMENT_KEY_CERTIFICATE", + "FILE_RECOVERY", + "HAL_EXTENSION", + "IP_SECURITY_END_SYSTEM", + "IP_SECURITY_IKE_INTERMEDIATE", + "IP_SECURITY_TUNNEL_TERMINATION", + "IP_SECURITY_USER", + "ISOLATED_USER_MODE", + "KDC_AUTHENTICATION", + "KERNEL_MODE_CODE_SIGNING", + "KEY_PACK_LICENSES", + "KEY_RECOVERY", + "KEY_RECOVERY_AGENT", + "LICENSE_SERVER_VERIFICATION", + "LIFETIME_SIGNING", + "MICROSOFT_PUBLISHER", + "MICROSOFT_TIME_STAMPING", + "MICROSOFT_TRUST_LIST_SIGNING", + "OCSP_SIGNING", + "OEM_WINDOWS_SYSTEM_COMPONENT_VERIFICATION", + "PLATFORM_CERTIFICATE", + "PREVIEW_BUILD_SIGNING", + "PRIVATE_KEY_ARCHIVAL", + "PROTECTED_PROCESS_LIGHT_VERIFICATION", + "PROTECTED_PROCESS_VERIFICATION", + "QUALIFIED_SUBORDINATION", + "REVOKED_LIST_SIGNER", + "ROOT_PROGRAM_AUTO_UPDATE_CA_REVOCATION", + "ROOT_PROGRAM_AUTO_UPDATE_END_REVOCATION", + "ROOT_PROGRAM_NO_OSCP_FAILOVER_TO_CRL", + "ROOT_LIST_SIGNER", + "SECURE_EMAIL", + "SERVER_AUTHENTICATION", + "SMART_CARD_LOGIN", + "SPC_ENCRYPTED_DIGEST_RETRY_COUNT", + "SPC_RELAXED_PE_MARKER_CHECK", + "TIME_STAMPING", + "WINDOWS_HARDWARE_DRIVER_ATTESTED_VERIFICATION", + "WINDOWS_HARDWARE_DRIVER_EXTENDED_VERIFICATION", + "WINDOWS_HARDWARE_DRIVER_VERIFICATION", + "WINDOWS_HELLO_RECOVERY_KEY_ENCRYPTION", + "WINDOWS_KITS_COMPONENT", + "WINDOWS_RT_VERIFICATION", + "WINDOWS_SOFTWARE_EXTENSION_VERIFICATION", + "WINDOWS_STORE", + "WINDOWS_SYSTEM_COMPONENT_VERIFICATION", + "WINDOWS_TCB_COMPONENT", + "WINDOWS_THIRD_PARTY_APPLICATION_COMPONENT", + "WINDOWS_UPDATE", + } +} + +type ClientCompatibilityV2 string + +// Enum values for ClientCompatibilityV2 +const ( + ClientCompatibilityV2WindowsServer2003 ClientCompatibilityV2 = "WINDOWS_SERVER_2003" + ClientCompatibilityV2WindowsServer2008 ClientCompatibilityV2 = "WINDOWS_SERVER_2008" + ClientCompatibilityV2WindowsServer2008R2 ClientCompatibilityV2 = "WINDOWS_SERVER_2008_R2" + ClientCompatibilityV2WindowsServer2012 ClientCompatibilityV2 = "WINDOWS_SERVER_2012" + ClientCompatibilityV2WindowsServer2012R2 ClientCompatibilityV2 = "WINDOWS_SERVER_2012_R2" + ClientCompatibilityV2WindowsServer2016 ClientCompatibilityV2 = "WINDOWS_SERVER_2016" +) + +// Values returns all known values for ClientCompatibilityV2. 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 (ClientCompatibilityV2) Values() []ClientCompatibilityV2 { + return []ClientCompatibilityV2{ + "WINDOWS_SERVER_2003", + "WINDOWS_SERVER_2008", + "WINDOWS_SERVER_2008_R2", + "WINDOWS_SERVER_2012", + "WINDOWS_SERVER_2012_R2", + "WINDOWS_SERVER_2016", + } +} + +type ClientCompatibilityV3 string + +// Enum values for ClientCompatibilityV3 +const ( + ClientCompatibilityV3WindowsServer2008 ClientCompatibilityV3 = "WINDOWS_SERVER_2008" + ClientCompatibilityV3WindowsServer2008R2 ClientCompatibilityV3 = "WINDOWS_SERVER_2008_R2" + ClientCompatibilityV3WindowsServer2012 ClientCompatibilityV3 = "WINDOWS_SERVER_2012" + ClientCompatibilityV3WindowsServer2012R2 ClientCompatibilityV3 = "WINDOWS_SERVER_2012_R2" + ClientCompatibilityV3WindowsServer2016 ClientCompatibilityV3 = "WINDOWS_SERVER_2016" +) + +// Values returns all known values for ClientCompatibilityV3. 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 (ClientCompatibilityV3) Values() []ClientCompatibilityV3 { + return []ClientCompatibilityV3{ + "WINDOWS_SERVER_2008", + "WINDOWS_SERVER_2008_R2", + "WINDOWS_SERVER_2012", + "WINDOWS_SERVER_2012_R2", + "WINDOWS_SERVER_2016", + } +} + +type ClientCompatibilityV4 string + +// Enum values for ClientCompatibilityV4 +const ( + ClientCompatibilityV4WindowsServer2012 ClientCompatibilityV4 = "WINDOWS_SERVER_2012" + ClientCompatibilityV4WindowsServer2012R2 ClientCompatibilityV4 = "WINDOWS_SERVER_2012_R2" + ClientCompatibilityV4WindowsServer2016 ClientCompatibilityV4 = "WINDOWS_SERVER_2016" +) + +// Values returns all known values for ClientCompatibilityV4. 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 (ClientCompatibilityV4) Values() []ClientCompatibilityV4 { + return []ClientCompatibilityV4{ + "WINDOWS_SERVER_2012", + "WINDOWS_SERVER_2012_R2", + "WINDOWS_SERVER_2016", + } +} + +type ConnectorStatus string + +// Enum values for ConnectorStatus +const ( + ConnectorStatusCreating ConnectorStatus = "CREATING" + ConnectorStatusActive ConnectorStatus = "ACTIVE" + ConnectorStatusDeleting ConnectorStatus = "DELETING" + ConnectorStatusFailed ConnectorStatus = "FAILED" +) + +// Values returns all known values for ConnectorStatus. 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 (ConnectorStatus) Values() []ConnectorStatus { + return []ConnectorStatus{ + "CREATING", + "ACTIVE", + "DELETING", + "FAILED", + } +} + +type ConnectorStatusReason string + +// Enum values for ConnectorStatusReason +const ( + ConnectorStatusReasonDirectoryAccessDenied ConnectorStatusReason = "DIRECTORY_ACCESS_DENIED" + ConnectorStatusReasonInternalFailure ConnectorStatusReason = "INTERNAL_FAILURE" + ConnectorStatusReasonPrivatecaAccessDenied ConnectorStatusReason = "PRIVATECA_ACCESS_DENIED" + ConnectorStatusReasonPrivatecaResourceNotFound ConnectorStatusReason = "PRIVATECA_RESOURCE_NOT_FOUND" + ConnectorStatusReasonSecurityGroupNotInVpc ConnectorStatusReason = "SECURITY_GROUP_NOT_IN_VPC" + ConnectorStatusReasonVpcAccessDenied ConnectorStatusReason = "VPC_ACCESS_DENIED" + ConnectorStatusReasonVpcEndpointLimitExceeded ConnectorStatusReason = "VPC_ENDPOINT_LIMIT_EXCEEDED" + ConnectorStatusReasonVpcResourceNotFound ConnectorStatusReason = "VPC_RESOURCE_NOT_FOUND" +) + +// Values returns all known values for ConnectorStatusReason. 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 (ConnectorStatusReason) Values() []ConnectorStatusReason { + return []ConnectorStatusReason{ + "DIRECTORY_ACCESS_DENIED", + "INTERNAL_FAILURE", + "PRIVATECA_ACCESS_DENIED", + "PRIVATECA_RESOURCE_NOT_FOUND", + "SECURITY_GROUP_NOT_IN_VPC", + "VPC_ACCESS_DENIED", + "VPC_ENDPOINT_LIMIT_EXCEEDED", + "VPC_RESOURCE_NOT_FOUND", + } +} + +type DirectoryRegistrationStatus string + +// Enum values for DirectoryRegistrationStatus +const ( + DirectoryRegistrationStatusCreating DirectoryRegistrationStatus = "CREATING" + DirectoryRegistrationStatusActive DirectoryRegistrationStatus = "ACTIVE" + DirectoryRegistrationStatusDeleting DirectoryRegistrationStatus = "DELETING" + DirectoryRegistrationStatusFailed DirectoryRegistrationStatus = "FAILED" +) + +// Values returns all known values for DirectoryRegistrationStatus. 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 (DirectoryRegistrationStatus) Values() []DirectoryRegistrationStatus { + return []DirectoryRegistrationStatus{ + "CREATING", + "ACTIVE", + "DELETING", + "FAILED", + } +} + +type DirectoryRegistrationStatusReason string + +// Enum values for DirectoryRegistrationStatusReason +const ( + DirectoryRegistrationStatusReasonDirectoryAccessDenied DirectoryRegistrationStatusReason = "DIRECTORY_ACCESS_DENIED" + DirectoryRegistrationStatusReasonDirectoryResourceNotFound DirectoryRegistrationStatusReason = "DIRECTORY_RESOURCE_NOT_FOUND" + DirectoryRegistrationStatusReasonDirectoryNotActive DirectoryRegistrationStatusReason = "DIRECTORY_NOT_ACTIVE" + DirectoryRegistrationStatusReasonDirectoryNotReachable DirectoryRegistrationStatusReason = "DIRECTORY_NOT_REACHABLE" + DirectoryRegistrationStatusReasonDirectoryTypeNotSupported DirectoryRegistrationStatusReason = "DIRECTORY_TYPE_NOT_SUPPORTED" + DirectoryRegistrationStatusReasonInternalFailure DirectoryRegistrationStatusReason = "INTERNAL_FAILURE" +) + +// Values returns all known values for DirectoryRegistrationStatusReason. 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 (DirectoryRegistrationStatusReason) Values() []DirectoryRegistrationStatusReason { + return []DirectoryRegistrationStatusReason{ + "DIRECTORY_ACCESS_DENIED", + "DIRECTORY_RESOURCE_NOT_FOUND", + "DIRECTORY_NOT_ACTIVE", + "DIRECTORY_NOT_REACHABLE", + "DIRECTORY_TYPE_NOT_SUPPORTED", + "INTERNAL_FAILURE", + } +} + +type HashAlgorithm string + +// Enum values for HashAlgorithm +const ( + HashAlgorithmSha256 HashAlgorithm = "SHA256" + HashAlgorithmSha384 HashAlgorithm = "SHA384" + HashAlgorithmSha512 HashAlgorithm = "SHA512" +) + +// Values returns all known values for HashAlgorithm. 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 (HashAlgorithm) Values() []HashAlgorithm { + return []HashAlgorithm{ + "SHA256", + "SHA384", + "SHA512", + } +} + +type KeySpec string + +// Enum values for KeySpec +const ( + KeySpecKeyExchange KeySpec = "KEY_EXCHANGE" + KeySpecSignature KeySpec = "SIGNATURE" +) + +// Values returns all known values for KeySpec. 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 (KeySpec) Values() []KeySpec { + return []KeySpec{ + "KEY_EXCHANGE", + "SIGNATURE", + } +} + +type KeyUsagePropertyType string + +// Enum values for KeyUsagePropertyType +const ( + KeyUsagePropertyTypeAll KeyUsagePropertyType = "ALL" +) + +// Values returns all known values for KeyUsagePropertyType. 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 (KeyUsagePropertyType) Values() []KeyUsagePropertyType { + return []KeyUsagePropertyType{ + "ALL", + } +} + +type PrivateKeyAlgorithm string + +// Enum values for PrivateKeyAlgorithm +const ( + PrivateKeyAlgorithmRsa PrivateKeyAlgorithm = "RSA" + PrivateKeyAlgorithmEcdhP256 PrivateKeyAlgorithm = "ECDH_P256" + PrivateKeyAlgorithmEcdhP384 PrivateKeyAlgorithm = "ECDH_P384" + PrivateKeyAlgorithmEcdhP521 PrivateKeyAlgorithm = "ECDH_P521" +) + +// Values returns all known values for PrivateKeyAlgorithm. 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 (PrivateKeyAlgorithm) Values() []PrivateKeyAlgorithm { + return []PrivateKeyAlgorithm{ + "RSA", + "ECDH_P256", + "ECDH_P384", + "ECDH_P521", + } +} + +type ServicePrincipalNameStatus string + +// Enum values for ServicePrincipalNameStatus +const ( + ServicePrincipalNameStatusCreating ServicePrincipalNameStatus = "CREATING" + ServicePrincipalNameStatusActive ServicePrincipalNameStatus = "ACTIVE" + ServicePrincipalNameStatusDeleting ServicePrincipalNameStatus = "DELETING" + ServicePrincipalNameStatusFailed ServicePrincipalNameStatus = "FAILED" +) + +// Values returns all known values for ServicePrincipalNameStatus. 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 (ServicePrincipalNameStatus) Values() []ServicePrincipalNameStatus { + return []ServicePrincipalNameStatus{ + "CREATING", + "ACTIVE", + "DELETING", + "FAILED", + } +} + +type ServicePrincipalNameStatusReason string + +// Enum values for ServicePrincipalNameStatusReason +const ( + ServicePrincipalNameStatusReasonDirectoryAccessDenied ServicePrincipalNameStatusReason = "DIRECTORY_ACCESS_DENIED" + ServicePrincipalNameStatusReasonDirectoryNotReachable ServicePrincipalNameStatusReason = "DIRECTORY_NOT_REACHABLE" + ServicePrincipalNameStatusReasonDirectoryResourceNotFound ServicePrincipalNameStatusReason = "DIRECTORY_RESOURCE_NOT_FOUND" + ServicePrincipalNameStatusReasonSpnExistsOnDifferentAdObject ServicePrincipalNameStatusReason = "SPN_EXISTS_ON_DIFFERENT_AD_OBJECT" + ServicePrincipalNameStatusReasonInternalFailure ServicePrincipalNameStatusReason = "INTERNAL_FAILURE" +) + +// Values returns all known values for ServicePrincipalNameStatusReason. 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 (ServicePrincipalNameStatusReason) Values() []ServicePrincipalNameStatusReason { + return []ServicePrincipalNameStatusReason{ + "DIRECTORY_ACCESS_DENIED", + "DIRECTORY_NOT_REACHABLE", + "DIRECTORY_RESOURCE_NOT_FOUND", + "SPN_EXISTS_ON_DIFFERENT_AD_OBJECT", + "INTERNAL_FAILURE", + } +} + +type TemplateStatus string + +// Enum values for TemplateStatus +const ( + TemplateStatusActive TemplateStatus = "ACTIVE" + TemplateStatusDeleting TemplateStatus = "DELETING" +) + +// Values returns all known values for TemplateStatus. 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 (TemplateStatus) Values() []TemplateStatus { + return []TemplateStatus{ + "ACTIVE", + "DELETING", + } +} + +type ValidationExceptionReason string + +// Enum values for ValidationExceptionReason +const ( + ValidationExceptionReasonFieldValidationFailed ValidationExceptionReason = "FIELD_VALIDATION_FAILED" + ValidationExceptionReasonInvalidPermission ValidationExceptionReason = "INVALID_PERMISSION" + ValidationExceptionReasonInvalidState ValidationExceptionReason = "INVALID_STATE" + ValidationExceptionReasonMismatchedConnector ValidationExceptionReason = "MISMATCHED_CONNECTOR" + ValidationExceptionReasonMismatchedVpc ValidationExceptionReason = "MISMATCHED_VPC" + ValidationExceptionReasonNoClientToken ValidationExceptionReason = "NO_CLIENT_TOKEN" + ValidationExceptionReasonUnknownOperation ValidationExceptionReason = "UNKNOWN_OPERATION" + ValidationExceptionReasonOther ValidationExceptionReason = "OTHER" +) + +// Values returns all known values for ValidationExceptionReason. Note that this +// can be expanded in the future, and so it is only as up to date as the client. +// The ordering of this slice is not guaranteed to be stable across updates. +func (ValidationExceptionReason) Values() []ValidationExceptionReason { + return []ValidationExceptionReason{ + "FIELD_VALIDATION_FAILED", + "INVALID_PERMISSION", + "INVALID_STATE", + "MISMATCHED_CONNECTOR", + "MISMATCHED_VPC", + "NO_CLIENT_TOKEN", + "UNKNOWN_OPERATION", + "OTHER", + } +} + +type ValidityPeriodType string + +// Enum values for ValidityPeriodType +const ( + ValidityPeriodTypeHours ValidityPeriodType = "HOURS" + ValidityPeriodTypeDays ValidityPeriodType = "DAYS" + ValidityPeriodTypeWeeks ValidityPeriodType = "WEEKS" + ValidityPeriodTypeMonths ValidityPeriodType = "MONTHS" + ValidityPeriodTypeYears ValidityPeriodType = "YEARS" +) + +// Values returns all known values for ValidityPeriodType. 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 (ValidityPeriodType) Values() []ValidityPeriodType { + return []ValidityPeriodType{ + "HOURS", + "DAYS", + "WEEKS", + "MONTHS", + "YEARS", + } +} diff --git a/service/pcaconnectorad/types/errors.go b/service/pcaconnectorad/types/errors.go new file mode 100644 index 00000000000..1e6bf17760a --- /dev/null +++ b/service/pcaconnectorad/types/errors.go @@ -0,0 +1,215 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + "fmt" + smithy "github.com/aws/smithy-go" +) + +// You can receive this error if you attempt to create a resource share when you +// don't have the required permissions. This can be caused by insufficient +// permissions in policies attached to your Amazon Web Services Identity and Access +// Management (IAM) principal. It can also happen because of restrictions in place +// from an Amazon Web Services Organizations service control policy (SCP) that +// affects your Amazon Web Services account. +type AccessDeniedException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *AccessDeniedException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *AccessDeniedException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *AccessDeniedException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "AccessDeniedException" + } + return *e.ErrorCodeOverride +} +func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// This request cannot be completed for one of the following reasons because the +// requested resource was being concurrently modified by another request. +type ConflictException struct { + Message *string + + ErrorCodeOverride *string + + ResourceId *string + ResourceType *string + + noSmithyDocumentSerde +} + +func (e *ConflictException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ConflictException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ConflictException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ConflictException" + } + return *e.ErrorCodeOverride +} +func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The request processing has failed because of an unknown error, exception or +// failure with an internal server. +type InternalServerException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *InternalServerException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *InternalServerException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *InternalServerException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "InternalServerException" + } + return *e.ErrorCodeOverride +} +func (e *InternalServerException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } + +// The operation tried to access a nonexistent resource. The resource might not be +// specified correctly, or its status might not be ACTIVE. +type ResourceNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + ResourceId *string + ResourceType *string + + noSmithyDocumentSerde +} + +func (e *ResourceNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ResourceNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ResourceNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ResourceNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// Request would cause a service quota to be exceeded. +type ServiceQuotaExceededException struct { + Message *string + + ErrorCodeOverride *string + + ResourceId *string + ResourceType *string + ServiceCode *string + QuotaCode *string + + noSmithyDocumentSerde +} + +func (e *ServiceQuotaExceededException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ServiceQuotaExceededException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ServiceQuotaExceededException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ServiceQuotaExceededException" + } + return *e.ErrorCodeOverride +} +func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The limit on the number of requests per second was exceeded. +type ThrottlingException struct { + Message *string + + ErrorCodeOverride *string + + ServiceCode *string + QuotaCode *string + + noSmithyDocumentSerde +} + +func (e *ThrottlingException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ThrottlingException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ThrottlingException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ThrottlingException" + } + return *e.ErrorCodeOverride +} +func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// An input validation error occurred. For example, invalid characters in a +// template name, or if a pagination token is invalid. +type ValidationException struct { + Message *string + + ErrorCodeOverride *string + + Reason ValidationExceptionReason + + noSmithyDocumentSerde +} + +func (e *ValidationException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ValidationException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ValidationException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "ValidationException" + } + return *e.ErrorCodeOverride +} +func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } diff --git a/service/pcaconnectorad/types/types.go b/service/pcaconnectorad/types/types.go new file mode 100644 index 00000000000..b939738af5c --- /dev/null +++ b/service/pcaconnectorad/types/types.go @@ -0,0 +1,1270 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types + +import ( + smithydocument "github.com/aws/smithy-go/document" + "time" +) + +// An access control entry allows or denies Active Directory groups based on their +// security identifiers (SIDs) from enrolling and/or autoenrolling with the +// template. +type AccessControlEntry struct { + + // Permissions to allow or deny an Active Directory group to enroll or autoenroll + // certificates issued against a template. + AccessRights *AccessRights + + // The date and time that the Access Control Entry was created. + CreatedAt *time.Time + + // Name of the Active Directory group. This name does not need to match the group + // name in Active Directory. + GroupDisplayName *string + + // Security identifier (SID) of the group object from Active Directory. The SID + // starts with "S-". + GroupSecurityIdentifier *string + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + TemplateArn *string + + // The date and time that the Access Control Entry was updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Summary of group access control entries that allow or deny Active Directory +// groups based on their security identifiers (SIDs) from enrolling and/or +// autofenrolling with the template. +type AccessControlEntrySummary struct { + + // Allow or deny an Active Directory group from enrolling and autoenrolling + // certificates issued against a template. + AccessRights *AccessRights + + // The date and time that the Access Control Entry was created. + CreatedAt *time.Time + + // Name of the Active Directory group. This name does not need to match the group + // name in Active Directory. + GroupDisplayName *string + + // Security identifier (SID) of the group object from Active Directory. The SID + // starts with "S-". + GroupSecurityIdentifier *string + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + TemplateArn *string + + // The date and time that the Access Control Entry was updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Allow or deny permissions for an Active Directory group to enroll or autoenroll +// certificates for a template. +type AccessRights struct { + + // Allow or deny an Active Directory group from autoenrolling certificates issued + // against a template. The Active Directory group must be allowed to enroll to + // allow autoenrollment + AutoEnroll AccessRight + + // Allow or deny an Active Directory group from enrolling certificates issued + // against a template. + Enroll AccessRight + + noSmithyDocumentSerde +} + +// Application policies describe what the certificate can be used for. +type ApplicationPolicies struct { + + // Application policies describe what the certificate can be used for. + // + // This member is required. + Policies []ApplicationPolicy + + // Marks the application policy extension as critical. + Critical *bool + + noSmithyDocumentSerde +} + +// Application policies describe what the certificate can be used for. +// +// The following types satisfy this interface: +// +// ApplicationPolicyMemberPolicyObjectIdentifier +// ApplicationPolicyMemberPolicyType +type ApplicationPolicy interface { + isApplicationPolicy() +} + +// The object identifier (OID) of an application policy. +type ApplicationPolicyMemberPolicyObjectIdentifier struct { + Value string + + noSmithyDocumentSerde +} + +func (*ApplicationPolicyMemberPolicyObjectIdentifier) isApplicationPolicy() {} + +// The type of application policy +type ApplicationPolicyMemberPolicyType struct { + Value ApplicationPolicyType + + noSmithyDocumentSerde +} + +func (*ApplicationPolicyMemberPolicyType) isApplicationPolicy() {} + +// Information describing the end of the validity period of the certificate. This +// parameter sets the “Not After” date for the certificate. Certificate validity is +// the period of time during which a certificate is valid. Validity can be +// expressed as an explicit date and time when the certificate expires, or as a +// span of time after issuance, stated in days, months, or years. For more +// information, see Validity in RFC 5280. This value is unaffected when +// ValidityNotBefore is also specified. For example, if Validity is set to 20 days +// in the future, the certificate will expire 20 days from issuance time regardless +// of the ValidityNotBefore value. +type CertificateValidity struct { + + // Renewal period is the period of time before certificate expiration when a new + // certificate will be requested. + // + // This member is required. + RenewalPeriod *ValidityPeriod + + // Information describing the end of the validity period of the certificate. This + // parameter sets the “Not After” date for the certificate. Certificate validity is + // the period of time during which a certificate is valid. Validity can be + // expressed as an explicit date and time when the certificate expires, or as a + // span of time after issuance, stated in days, months, or years. For more + // information, see Validity in RFC 5280. This value is unaffected when + // ValidityNotBefore is also specified. For example, if Validity is set to 20 days + // in the future, the certificate will expire 20 days from issuance time regardless + // of the ValidityNotBefore value. + // + // This member is required. + ValidityPeriod *ValidityPeriod + + noSmithyDocumentSerde +} + +// Amazon Web Services Private CA Connector for Active Directory is a service that +// links your Active Directory with Amazon Web Services Private CA. The connector +// brokers the exchange of certificates from Amazon Web Services Private CA to +// domain-joined users and machines managed with Active Directory. +type Connector struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + Arn *string + + // The Amazon Resource Name (ARN) of the certificate authority being used. + CertificateAuthorityArn *string + + // Certificate enrollment endpoint for Active Directory domain-joined objects + // reach out to when requesting certificates. + CertificateEnrollmentPolicyServerEndpoint *string + + // The date and time that the connector was created. + CreatedAt *time.Time + + // The identifier of the Active Directory. + DirectoryId *string + + // Status of the connector. Status can be creating, active, deleting, or failed. + Status ConnectorStatus + + // Additional information about the connector status if the status is failed. + StatusReason ConnectorStatusReason + + // The date and time that the connector was updated. + UpdatedAt *time.Time + + // Information of the VPC and security group(s) used with the connector. + VpcInformation *VpcInformation + + noSmithyDocumentSerde +} + +// Summary description of the Amazon Web Services Private CA AD connectors +// belonging to an Amazon Web Services account. +type ConnectorSummary struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + Arn *string + + // The Amazon Resource Name (ARN) of the certificate authority being used. + CertificateAuthorityArn *string + + // Certificate enrollment endpoint for Active Directory domain-joined objects to + // request certificates. + CertificateEnrollmentPolicyServerEndpoint *string + + // The date and time that the connector was created. + CreatedAt *time.Time + + // The identifier of the Active Directory. + DirectoryId *string + + // Status of the connector. Status can be creating, active, deleting, or failed. + Status ConnectorStatus + + // Additional information about the connector status if the status is failed. + StatusReason ConnectorStatusReason + + // The date and time that the connector was updated. + UpdatedAt *time.Time + + // Information of the VPC and security group(s) used with the connector. + VpcInformation *VpcInformation + + noSmithyDocumentSerde +} + +// The directory registration represents the authorization of the connector +// service with a directory. +type DirectoryRegistration struct { + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration. + Arn *string + + // The date and time that the directory registration was created. + CreatedAt *time.Time + + // The identifier of the Active Directory. + DirectoryId *string + + // Status of the directory registration. + Status DirectoryRegistrationStatus + + // Additional information about the directory registration status if the status is + // failed. + StatusReason DirectoryRegistrationStatusReason + + // The date and time that the directory registration was updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// The directory registration represents the authorization of the connector +// service with the Active Directory. +type DirectoryRegistrationSummary struct { + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + Arn *string + + // The date and time that the directory registration was created. + CreatedAt *time.Time + + // The identifier of the Active Directory. + DirectoryId *string + + // Status of the directory registration. + Status DirectoryRegistrationStatus + + // Additional information about the directory registration status if the status is + // failed. + StatusReason DirectoryRegistrationStatusReason + + // The date and time that the directory registration was updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Template configurations for v2 template schema. +type EnrollmentFlagsV2 struct { + + // Allow renewal using the same key. + EnableKeyReuseOnNtTokenKeysetStorageFull *bool + + // Include symmetric algorithms allowed by the subject. + IncludeSymmetricAlgorithms *bool + + // This flag instructs the CA to not include the security extension + // szOID_NTDS_CA_SECURITY_EXT (OID:1.3.6.1.4.1.311.25.2), as specified in [MS-WCCE] + // sections 2.2.2.7.7.4 and 3.2.2.6.2.1.4.5.9, in the issued certificate. This + // addresses a Windows Kerberos elevation-of-privilege vulnerability. + NoSecurityExtension *bool + + // Delete expired or revoked certificates instead of archiving them. + RemoveInvalidCertificateFromPersonalStore *bool + + // Require user interaction when the subject is enrolled and the private key + // associated with the certificate is used. + UserInteractionRequired *bool + + noSmithyDocumentSerde +} + +// Template configurations for v3 template schema. +type EnrollmentFlagsV3 struct { + + // Allow renewal using the same key. + EnableKeyReuseOnNtTokenKeysetStorageFull *bool + + // Include symmetric algorithms allowed by the subject. + IncludeSymmetricAlgorithms *bool + + // This flag instructs the CA to not include the security extension + // szOID_NTDS_CA_SECURITY_EXT (OID:1.3.6.1.4.1.311.25.2), as specified in [MS-WCCE] + // sections 2.2.2.7.7.4 and 3.2.2.6.2.1.4.5.9, in the issued certificate. This + // addresses a Windows Kerberos elevation-of-privilege vulnerability. + NoSecurityExtension *bool + + // Delete expired or revoked certificates instead of archiving them. + RemoveInvalidCertificateFromPersonalStore *bool + + // Require user interaction when the subject is enrolled and the private key + // associated with the certificate is used. + UserInteractionRequired *bool + + noSmithyDocumentSerde +} + +// Template configurations for v4 template schema. +type EnrollmentFlagsV4 struct { + + // Allow renewal using the same key. + EnableKeyReuseOnNtTokenKeysetStorageFull *bool + + // Include symmetric algorithms allowed by the subject. + IncludeSymmetricAlgorithms *bool + + // This flag instructs the CA to not include the security extension + // szOID_NTDS_CA_SECURITY_EXT (OID:1.3.6.1.4.1.311.25.2), as specified in [MS-WCCE] + // sections 2.2.2.7.7.4 and 3.2.2.6.2.1.4.5.9, in the issued certificate. This + // addresses a Windows Kerberos elevation-of-privilege vulnerability. + NoSecurityExtension *bool + + // Delete expired or revoked certificates instead of archiving them. + RemoveInvalidCertificateFromPersonalStore *bool + + // Require user interaction when the subject is enrolled and the private key + // associated with the certificate is used. + UserInteractionRequired *bool + + noSmithyDocumentSerde +} + +// Certificate extensions for v2 template schema +type ExtensionsV2 struct { + + // The key usage extension defines the purpose (e.g., encipherment, signature, + // certificate signing) of the key contained in the certificate. + // + // This member is required. + KeyUsage *KeyUsage + + // Application policies specify what the certificate is used for and its purpose. + ApplicationPolicies *ApplicationPolicies + + noSmithyDocumentSerde +} + +// Certificate extensions for v3 template schema +type ExtensionsV3 struct { + + // The key usage extension defines the purpose (e.g., encipherment, signature, + // certificate signing) of the key contained in the certificate. + // + // This member is required. + KeyUsage *KeyUsage + + // Application policies specify what the certificate is used for and its purpose. + ApplicationPolicies *ApplicationPolicies + + noSmithyDocumentSerde +} + +// Certificate extensions for v4 template schema +type ExtensionsV4 struct { + + // The key usage extension defines the purpose (e.g., encipherment, signature) of + // the key contained in the certificate. + // + // This member is required. + KeyUsage *KeyUsage + + // Application policies specify what the certificate is used for and its purpose. + ApplicationPolicies *ApplicationPolicies + + noSmithyDocumentSerde +} + +// General flags for v2 template schema that defines if the template is for a +// machine or a user and if the template can be issued using autoenrollment. +type GeneralFlagsV2 struct { + + // Allows certificate issuance using autoenrollment. Set to TRUE to allow + // autoenrollment. + AutoEnrollment *bool + + // Defines if the template is for machines or users. Set to TRUE if the template + // is for machines. Set to FALSE if the template is for users. + MachineType *bool + + noSmithyDocumentSerde +} + +// General flags for v3 template schema that defines if the template is for a +// machine or a user and if the template can be issued using autoenrollment. +type GeneralFlagsV3 struct { + + // Allows certificate issuance using autoenrollment. Set to TRUE to allow + // autoenrollment. + AutoEnrollment *bool + + // Defines if the template is for machines or users. Set to TRUE if the template + // is for machines. Set to FALSE if the template is for users + MachineType *bool + + noSmithyDocumentSerde +} + +// General flags for v4 template schema that defines if the template is for a +// machine or a user and if the template can be issued using autoenrollment. +type GeneralFlagsV4 struct { + + // Allows certificate issuance using autoenrollment. Set to TRUE to allow + // autoenrollment. + AutoEnrollment *bool + + // Defines if the template is for machines or users. Set to TRUE if the template + // is for machines. Set to FALSE if the template is for users + MachineType *bool + + noSmithyDocumentSerde +} + +// The key usage extension defines the purpose (e.g., encipherment, signature) of +// the key contained in the certificate. +type KeyUsage struct { + + // The key usage flags represent the purpose (e.g., encipherment, signature) of + // the key contained in the certificate. + // + // This member is required. + UsageFlags *KeyUsageFlags + + // Sets the key usage extension to critical. + Critical *bool + + noSmithyDocumentSerde +} + +// The key usage flags represent the purpose (e.g., encipherment, signature) of +// the key contained in the certificate. +type KeyUsageFlags struct { + + // DataEncipherment is asserted when the subject public key is used for directly + // enciphering raw user data without the use of an intermediate symmetric cipher. + DataEncipherment *bool + + // The digitalSignature is asserted when the subject public key is used for + // verifying digital signatures. + DigitalSignature *bool + + // KeyAgreement is asserted when the subject public key is used for key agreement. + KeyAgreement *bool + + // KeyEncipherment is asserted when the subject public key is used for enciphering + // private or secret keys, i.e., for key transport. + KeyEncipherment *bool + + // NonRepudiation is asserted when the subject public key is used to verify + // digital signatures. + NonRepudiation *bool + + noSmithyDocumentSerde +} + +// The key usage property defines the purpose of the private key contained in the +// certificate. You can specify specific purposes using property flags or all by +// using property type ALL. +// +// The following types satisfy this interface: +// +// KeyUsagePropertyMemberPropertyFlags +// KeyUsagePropertyMemberPropertyType +type KeyUsageProperty interface { + isKeyUsageProperty() +} + +// You can specify key usage for encryption, key agreement, and signature. You can +// use property flags or property type but not both. +type KeyUsagePropertyMemberPropertyFlags struct { + Value KeyUsagePropertyFlags + + noSmithyDocumentSerde +} + +func (*KeyUsagePropertyMemberPropertyFlags) isKeyUsageProperty() {} + +// You can specify all key usages using property type ALL. You can use property +// type or property flags but not both. +type KeyUsagePropertyMemberPropertyType struct { + Value KeyUsagePropertyType + + noSmithyDocumentSerde +} + +func (*KeyUsagePropertyMemberPropertyType) isKeyUsageProperty() {} + +// Specifies key usage. +type KeyUsagePropertyFlags struct { + + // Allows key for encryption and decryption. + Decrypt *bool + + // Allows key exchange without encryption. + KeyAgreement *bool + + // Allow key use for digital signature. + Sign *bool + + noSmithyDocumentSerde +} + +// Defines the attributes of the private key. +type PrivateKeyAttributesV2 struct { + + // Defines the purpose of the private key. Set it to "KEY_EXCHANGE" or "SIGNATURE" + // value. + // + // This member is required. + KeySpec KeySpec + + // Set the minimum key length of the private key. + // + // This member is required. + MinimalKeyLength *int32 + + // Defines the cryptographic providers used to generate the private key. + CryptoProviders []string + + noSmithyDocumentSerde +} + +// Defines the attributes of the private key. +type PrivateKeyAttributesV3 struct { + + // Defines the algorithm used to generate the private key. + // + // This member is required. + Algorithm PrivateKeyAlgorithm + + // Defines the purpose of the private key. Set it to "KEY_EXCHANGE" or "SIGNATURE" + // value. + // + // This member is required. + KeySpec KeySpec + + // The key usage property defines the purpose of the private key contained in the + // certificate. You can specify specific purposes using property flags or all by + // using property type ALL. + // + // This member is required. + KeyUsageProperty KeyUsageProperty + + // Set the minimum key length of the private key. + // + // This member is required. + MinimalKeyLength *int32 + + // Defines the cryptographic providers used to generate the private key. + CryptoProviders []string + + noSmithyDocumentSerde +} + +// Defines the attributes of the private key. +type PrivateKeyAttributesV4 struct { + + // Defines the purpose of the private key. Set it to "KEY_EXCHANGE" or "SIGNATURE" + // value. + // + // This member is required. + KeySpec KeySpec + + // Set the minimum key length of the private key. + // + // This member is required. + MinimalKeyLength *int32 + + // Defines the algorithm used to generate the private key. + Algorithm PrivateKeyAlgorithm + + // Defines the cryptographic providers used to generate the private key. + CryptoProviders []string + + // The key usage property defines the purpose of the private key contained in the + // certificate. You can specify specific purposes using property flags or all by + // using property type ALL. + KeyUsageProperty KeyUsageProperty + + noSmithyDocumentSerde +} + +// Private key flags for v2 templates specify the client compatibility, if the +// private key can be exported, and if user input is required when using a private +// key. +type PrivateKeyFlagsV2 struct { + + // Defines the minimum client compatibility. + // + // This member is required. + ClientVersion ClientCompatibilityV2 + + // Allows the private key to be exported. + ExportableKey *bool + + // Require user input when using the private key for enrollment. + StrongKeyProtectionRequired *bool + + noSmithyDocumentSerde +} + +// Private key flags for v3 templates specify the client compatibility, if the +// private key can be exported, if user input is required when using a private key, +// and if an alternate signature algorithm should be used. +type PrivateKeyFlagsV3 struct { + + // Defines the minimum client compatibility. + // + // This member is required. + ClientVersion ClientCompatibilityV3 + + // Allows the private key to be exported. + ExportableKey *bool + + // Reguires the PKCS #1 v2.1 signature format for certificates. You should verify + // that your CA, objects, and applications can accept this signature format. + RequireAlternateSignatureAlgorithm *bool + + // Requirer user input when using the private key for enrollment. + StrongKeyProtectionRequired *bool + + noSmithyDocumentSerde +} + +// Private key flags for v4 templates specify the client compatibility, if the +// private key can be exported, if user input is required when using a private key, +// if an alternate signature algorithm should be used, and if certificates are +// renewed using the same private key. +type PrivateKeyFlagsV4 struct { + + // Defines the minimum client compatibility. + // + // This member is required. + ClientVersion ClientCompatibilityV4 + + // Allows the private key to be exported. + ExportableKey *bool + + // Requires the PKCS #1 v2.1 signature format for certificates. You should verify + // that your CA, objects, and applications can accept this signature format. + RequireAlternateSignatureAlgorithm *bool + + // Renew certificate using the same private key. + RequireSameKeyRenewal *bool + + // Require user input when using the private key for enrollment. + StrongKeyProtectionRequired *bool + + // Specifies the cryptographic service provider category used to generate private + // keys. Set to TRUE to use Legacy Cryptographic Service Providers and FALSE to use + // Key Storage Providers. + UseLegacyProvider *bool + + noSmithyDocumentSerde +} + +// The service principal name that the connector uses to authenticate with Active +// Directory. +type ServicePrincipalName struct { + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateConnector.html (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + ConnectorArn *string + + // The date and time that the service principal name was created. + CreatedAt *time.Time + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + DirectoryRegistrationArn *string + + // The status of a service principal name. + Status ServicePrincipalNameStatus + + // Additional information for the status of a service principal name if the status + // is failed. + StatusReason ServicePrincipalNameStatusReason + + // The date and time that the service principal name was updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// The service principal name that the connector uses to authenticate with Active +// Directory. +type ServicePrincipalNameSummary struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + ConnectorArn *string + + // The date and time that the service principal name was created. + CreatedAt *time.Time + + // The Amazon Resource Name (ARN) that was returned when you called + // CreateDirectoryRegistration (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateDirectoryRegistration.html) + // . + DirectoryRegistrationArn *string + + // The status of a service principal name. + Status ServicePrincipalNameStatus + + // Additional information for the status of a service principal name if the status + // is failed. + StatusReason ServicePrincipalNameStatusReason + + // Time when the service principal name was updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Information to include in the subject name and alternate subject name of the +// certificate. The subject name can be common name, directory path, DNS as common +// name, or left blank. You can optionally include email to the subject name for +// user templates. If you leave the subject name blank then you must set a subject +// alternate name. The subject alternate name (SAN) can include globally unique +// identifier (GUID), DNS, domain DNS, email, service principal name (SPN), and +// user principal name (UPN). You can leave the SAN blank. If you leave the SAN +// blank, then you must set a subject name. +type SubjectNameFlagsV2 struct { + + // Include the common name in the subject name. + RequireCommonName *bool + + // Include the directory path in the subject name. + RequireDirectoryPath *bool + + // Include the DNS as common name in the subject name. + RequireDnsAsCn *bool + + // Include the subject's email in the subject name. + RequireEmail *bool + + // Include the globally unique identifier (GUID) in the subject alternate name. + SanRequireDirectoryGuid *bool + + // Include the DNS in the subject alternate name. + SanRequireDns *bool + + // Include the domain DNS in the subject alternate name. + SanRequireDomainDns *bool + + // Include the subject's email in the subject alternate name. + SanRequireEmail *bool + + // Include the service principal name (SPN) in the subject alternate name. + SanRequireSpn *bool + + // Include the user principal name (UPN) in the subject alternate name. + SanRequireUpn *bool + + noSmithyDocumentSerde +} + +// Information to include in the subject name and alternate subject name of the +// certificate. The subject name can be common name, directory path, DNS as common +// name, or left blank. You can optionally include email to the subject name for +// user templates. If you leave the subject name blank then you must set a subject +// alternate name. The subject alternate name (SAN) can include globally unique +// identifier (GUID), DNS, domain DNS, email, service principal name (SPN), and +// user principal name (UPN). You can leave the SAN blank. If you leave the SAN +// blank, then you must set a subject name. +type SubjectNameFlagsV3 struct { + + // Include the common name in the subject name. + RequireCommonName *bool + + // Include the directory path in the subject name. + RequireDirectoryPath *bool + + // Include the DNS as common name in the subject name. + RequireDnsAsCn *bool + + // Include the subject's email in the subject name. + RequireEmail *bool + + // Include the globally unique identifier (GUID) in the subject alternate name. + SanRequireDirectoryGuid *bool + + // Include the DNS in the subject alternate name. + SanRequireDns *bool + + // Include the domain DNS in the subject alternate name. + SanRequireDomainDns *bool + + // Include the subject's email in the subject alternate name. + SanRequireEmail *bool + + // Include the service principal name (SPN) in the subject alternate name. + SanRequireSpn *bool + + // Include the user principal name (UPN) in the subject alternate name. + SanRequireUpn *bool + + noSmithyDocumentSerde +} + +// Information to include in the subject name and alternate subject name of the +// certificate. The subject name can be common name, directory path, DNS as common +// name, or left blank. You can optionally include email to the subject name for +// user templates. If you leave the subject name blank then you must set a subject +// alternate name. The subject alternate name (SAN) can include globally unique +// identifier (GUID), DNS, domain DNS, email, service principal name (SPN), and +// user principal name (UPN). You can leave the SAN blank. If you leave the SAN +// blank, then you must set a subject name. +type SubjectNameFlagsV4 struct { + + // Include the common name in the subject name. + RequireCommonName *bool + + // Include the directory path in the subject name. + RequireDirectoryPath *bool + + // Include the DNS as common name in the subject name. + RequireDnsAsCn *bool + + // Include the subject's email in the subject name. + RequireEmail *bool + + // Include the globally unique identifier (GUID) in the subject alternate name. + SanRequireDirectoryGuid *bool + + // Include the DNS in the subject alternate name. + SanRequireDns *bool + + // Include the domain DNS in the subject alternate name. + SanRequireDomainDns *bool + + // Include the subject's email in the subject alternate name. + SanRequireEmail *bool + + // Include the service principal name (SPN) in the subject alternate name. + SanRequireSpn *bool + + // Include the user principal name (UPN) in the subject alternate name. + SanRequireUpn *bool + + noSmithyDocumentSerde +} + +// An Active Directory compatible certificate template. Connectors issue +// certificates against these templates based on the requestor's Active Directory +// group membership. +type Template struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + Arn *string + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + ConnectorArn *string + + // The date and time that the template was created. + CreatedAt *time.Time + + // Template configuration to define the information included in certificates. + // Define certificate validity and renewal periods, certificate request handling + // and enrollment options, key usage extensions, application policies, and + // cryptography settings. + Definition TemplateDefinition + + // Name of the templates. Template names must be unique. + Name *string + + // Object identifier of a template. + ObjectIdentifier *string + + // The template schema version. Template schema versions can be v2, v3, or v4. The + // template configuration options change based on the template schema version. + PolicySchema *int32 + + // The version of the template. Template updates will increment the minor + // revision. Re-enrolling all certificate holders will increment the major + // revision. + Revision *TemplateRevision + + // Status of the template. Status can be creating, active, deleting, or failed. + Status TemplateStatus + + // The date and time that the template was updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// Template configuration to define the information included in certificates. +// Define certificate validity and renewal periods, certificate request handling +// and enrollment options, key usage extensions, application policies, and +// cryptography settings. +// +// The following types satisfy this interface: +// +// TemplateDefinitionMemberTemplateV2 +// TemplateDefinitionMemberTemplateV3 +// TemplateDefinitionMemberTemplateV4 +type TemplateDefinition interface { + isTemplateDefinition() +} + +// Template configuration to define the information included in certificates. +// Define certificate validity and renewal periods, certificate request handling +// and enrollment options, key usage extensions, application policies, and +// cryptography settings. +type TemplateDefinitionMemberTemplateV2 struct { + Value TemplateV2 + + noSmithyDocumentSerde +} + +func (*TemplateDefinitionMemberTemplateV2) isTemplateDefinition() {} + +// Template configuration to define the information included in certificates. +// Define certificate validity and renewal periods, certificate request handling +// and enrollment options, key usage extensions, application policies, and +// cryptography settings. +type TemplateDefinitionMemberTemplateV3 struct { + Value TemplateV3 + + noSmithyDocumentSerde +} + +func (*TemplateDefinitionMemberTemplateV3) isTemplateDefinition() {} + +// Template configuration to define the information included in certificates. +// Define certificate validity and renewal periods, certificate request handling +// and enrollment options, key usage extensions, application policies, and +// cryptography settings. +type TemplateDefinitionMemberTemplateV4 struct { + Value TemplateV4 + + noSmithyDocumentSerde +} + +func (*TemplateDefinitionMemberTemplateV4) isTemplateDefinition() {} + +// The revision version of the template. Template updates will increment the minor +// revision. Re-enrolling all certificate holders will increment the major +// revision. +type TemplateRevision struct { + + // The revision version of the template. Re-enrolling all certificate holders will + // increment the major revision. + // + // This member is required. + MajorRevision *int32 + + // The revision version of the template. Re-enrolling all certificate holders will + // increment the major revision. + // + // This member is required. + MinorRevision *int32 + + noSmithyDocumentSerde +} + +// An Active Directory compatible certificate template. Connectors issue +// certificates against these templates based on the requestor's Active Directory +// group membership. +type TemplateSummary struct { + + // The Amazon Resource Name (ARN) that was returned when you called CreateTemplate (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateTemplate.html) + // . + Arn *string + + // The Amazon Resource Name (ARN) that was returned when you called CreateConnector (https://docs.aws.amazon.com/pca-connector-ad/latest/APIReference/API_CreateConnector.html) + // . + ConnectorArn *string + + // The date and time that the template was created. + CreatedAt *time.Time + + // Template configuration to define the information included in certificates. + // Define certificate validity and renewal periods, certificate request handling + // and enrollment options, key usage extensions, application policies, and + // cryptography settings. + Definition TemplateDefinition + + // Name of the template. The template name must be unique. + Name *string + + // Object identifier of a template. + ObjectIdentifier *string + + // The template schema version. Template schema versions can be v2, v3, or v4. The + // template configuration options change based on the template schema version. + PolicySchema *int32 + + // The revision version of the template. Template updates will increment the minor + // revision. Re-enrolling all certificate holders will increment the major + // revision. + Revision *TemplateRevision + + // Status of the template. Status can be creating, active, deleting, or failed. + Status TemplateStatus + + // The date and time that the template was updated. + UpdatedAt *time.Time + + noSmithyDocumentSerde +} + +// v2 template schema that uses Legacy Cryptographic Providers. +type TemplateV2 struct { + + // Certificate validity describes the validity and renewal periods of a + // certificate. + // + // This member is required. + CertificateValidity *CertificateValidity + + // Enrollment flags describe the enrollment settings for certificates such as + // using the existing private key and deleting expired or revoked certificates. + // + // This member is required. + EnrollmentFlags *EnrollmentFlagsV2 + + // Extensions describe the key usage extensions and application policies for a + // template. + // + // This member is required. + Extensions *ExtensionsV2 + + // General flags describe whether the template is used for computers or users and + // if the template can be used with autoenrollment. + // + // This member is required. + GeneralFlags *GeneralFlagsV2 + + // Private key attributes allow you to specify the minimal key length, key spec, + // and cryptographic providers for the private key of a certificate for v2 + // templates. V2 templates allow you to use Legacy Cryptographic Service Providers. + // + // This member is required. + PrivateKeyAttributes *PrivateKeyAttributesV2 + + // Private key flags for v2 templates specify the client compatibility, if the + // private key can be exported, and if user input is required when using a private + // key. + // + // This member is required. + PrivateKeyFlags *PrivateKeyFlagsV2 + + // Subject name flags describe the subject name and subject alternate name that is + // included in a certificate. + // + // This member is required. + SubjectNameFlags *SubjectNameFlagsV2 + + // List of templates in Active Directory that are superseded by this template. + SupersededTemplates []string + + noSmithyDocumentSerde +} + +// v3 template schema that uses Key Storage Providers. +type TemplateV3 struct { + + // Certificate validity describes the validity and renewal periods of a + // certificate. + // + // This member is required. + CertificateValidity *CertificateValidity + + // Enrollment flags describe the enrollment settings for certificates such as + // using the existing private key and deleting expired or revoked certificates. + // + // This member is required. + EnrollmentFlags *EnrollmentFlagsV3 + + // Extensions describe the key usage extensions and application policies for a + // template. + // + // This member is required. + Extensions *ExtensionsV3 + + // General flags describe whether the template is used for computers or users and + // if the template can be used with autoenrollment. + // + // This member is required. + GeneralFlags *GeneralFlagsV3 + + // Specifies the hash algorithm used to hash the private key. + // + // This member is required. + HashAlgorithm HashAlgorithm + + // Private key attributes allow you to specify the algorithm, minimal key length, + // key spec, key usage, and cryptographic providers for the private key of a + // certificate for v3 templates. V3 templates allow you to use Key Storage + // Providers. + // + // This member is required. + PrivateKeyAttributes *PrivateKeyAttributesV3 + + // Private key flags for v3 templates specify the client compatibility, if the + // private key can be exported, if user input is required when using a private key, + // and if an alternate signature algorithm should be used. + // + // This member is required. + PrivateKeyFlags *PrivateKeyFlagsV3 + + // Subject name flags describe the subject name and subject alternate name that is + // included in a certificate. + // + // This member is required. + SubjectNameFlags *SubjectNameFlagsV3 + + // List of templates in Active Directory that are superseded by this template. + SupersededTemplates []string + + noSmithyDocumentSerde +} + +// v4 template schema that can use either Legacy Cryptographic Providers or Key +// Storage Providers. +type TemplateV4 struct { + + // Certificate validity describes the validity and renewal periods of a + // certificate. + // + // This member is required. + CertificateValidity *CertificateValidity + + // Enrollment flags describe the enrollment settings for certificates using the + // existing private key and deleting expired or revoked certificates. + // + // This member is required. + EnrollmentFlags *EnrollmentFlagsV4 + + // Extensions describe the key usage extensions and application policies for a + // template. + // + // This member is required. + Extensions *ExtensionsV4 + + // General flags describe whether the template is used for computers or users and + // if the template can be used with autoenrollment. + // + // This member is required. + GeneralFlags *GeneralFlagsV4 + + // Private key attributes allow you to specify the minimal key length, key spec, + // key usage, and cryptographic providers for the private key of a certificate for + // v4 templates. V4 templates allow you to use either Key Storage Providers or + // Legacy Cryptographic Service Providers. You specify the cryptography provider + // category in private key flags. + // + // This member is required. + PrivateKeyAttributes *PrivateKeyAttributesV4 + + // Private key flags for v4 templates specify the client compatibility, if the + // private key can be exported, if user input is required when using a private key, + // if an alternate signature algorithm should be used, and if certificates are + // renewed using the same private key. + // + // This member is required. + PrivateKeyFlags *PrivateKeyFlagsV4 + + // Subject name flags describe the subject name and subject alternate name that is + // included in a certificate. + // + // This member is required. + SubjectNameFlags *SubjectNameFlagsV4 + + // Specifies the hash algorithm used to hash the private key. Hash algorithm can + // only be specified when using Key Storage Providers. + HashAlgorithm HashAlgorithm + + // List of templates in Active Directory that are superseded by this template. + SupersededTemplates []string + + noSmithyDocumentSerde +} + +// Information describing the end of the validity period of the certificate. This +// parameter sets the “Not After” date for the certificate. Certificate validity is +// the period of time during which a certificate is valid. Validity can be +// expressed as an explicit date and time when the certificate expires, or as a +// span of time after issuance, stated in hours, days, months, or years. For more +// information, see Validity in RFC 5280. This value is unaffected when +// ValidityNotBefore is also specified. For example, if Validity is set to 20 days +// in the future, the certificate will expire 20 days from issuance time regardless +// of the ValidityNotBefore value. +type ValidityPeriod struct { + + // The numeric value for the validity period. + // + // This member is required. + Period *int64 + + // The unit of time. You can select hours, days, weeks, months, and years. + // + // This member is required. + PeriodType ValidityPeriodType + + noSmithyDocumentSerde +} + +// Information about your VPC and security groups used with the connector. +type VpcInformation struct { + + // The security groups used with the connector. You can use a maximum of 4 + // security groups with a connector. + // + // This member is required. + SecurityGroupIds []string + + 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) isApplicationPolicy() {} +func (*UnknownUnionMember) isKeyUsageProperty() {} +func (*UnknownUnionMember) isTemplateDefinition() {} diff --git a/service/pcaconnectorad/types/types_exported_test.go b/service/pcaconnectorad/types/types_exported_test.go new file mode 100644 index 00000000000..6490cf9e166 --- /dev/null +++ b/service/pcaconnectorad/types/types_exported_test.go @@ -0,0 +1,78 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package types_test + +import ( + "fmt" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" +) + +func ExampleApplicationPolicy_outputUsage() { + var union types.ApplicationPolicy + // type switches can be used to check the union value + switch v := union.(type) { + case *types.ApplicationPolicyMemberPolicyObjectIdentifier: + _ = v.Value // Value is string + + case *types.ApplicationPolicyMemberPolicyType: + _ = v.Value // Value is types.ApplicationPolicyType + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ types.ApplicationPolicyType +var _ *string + +func ExampleKeyUsageProperty_outputUsage() { + var union types.KeyUsageProperty + // type switches can be used to check the union value + switch v := union.(type) { + case *types.KeyUsagePropertyMemberPropertyFlags: + _ = v.Value // Value is types.KeyUsagePropertyFlags + + case *types.KeyUsagePropertyMemberPropertyType: + _ = v.Value // Value is types.KeyUsagePropertyType + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ types.KeyUsagePropertyType +var _ *types.KeyUsagePropertyFlags + +func ExampleTemplateDefinition_outputUsage() { + var union types.TemplateDefinition + // type switches can be used to check the union value + switch v := union.(type) { + case *types.TemplateDefinitionMemberTemplateV2: + _ = v.Value // Value is types.TemplateV2 + + case *types.TemplateDefinitionMemberTemplateV3: + _ = v.Value // Value is types.TemplateV3 + + case *types.TemplateDefinitionMemberTemplateV4: + _ = v.Value // Value is types.TemplateV4 + + case *types.UnknownUnionMember: + fmt.Println("unknown tag:", v.Tag) + + default: + fmt.Println("union is nil or unknown type") + + } +} + +var _ *types.TemplateV4 +var _ *types.TemplateV3 +var _ *types.TemplateV2 diff --git a/service/pcaconnectorad/validators.go b/service/pcaconnectorad/validators.go new file mode 100644 index 00000000000..a54c07e3d26 --- /dev/null +++ b/service/pcaconnectorad/validators.go @@ -0,0 +1,1411 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package pcaconnectorad + +import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go-v2/service/pcaconnectorad/types" + smithy "github.com/aws/smithy-go" + "github.com/aws/smithy-go/middleware" +) + +type validateOpCreateConnector struct { +} + +func (*validateOpCreateConnector) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateConnector) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateConnectorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateConnectorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateDirectoryRegistration struct { +} + +func (*validateOpCreateDirectoryRegistration) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateDirectoryRegistration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateDirectoryRegistrationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateDirectoryRegistrationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateServicePrincipalName struct { +} + +func (*validateOpCreateServicePrincipalName) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateServicePrincipalName) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateServicePrincipalNameInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateServicePrincipalNameInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateTemplateGroupAccessControlEntry struct { +} + +func (*validateOpCreateTemplateGroupAccessControlEntry) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateTemplateGroupAccessControlEntry) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateTemplateGroupAccessControlEntryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateTemplateGroupAccessControlEntryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpCreateTemplate struct { +} + +func (*validateOpCreateTemplate) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpCreateTemplate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*CreateTemplateInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpCreateTemplateInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteConnector struct { +} + +func (*validateOpDeleteConnector) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteConnector) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteConnectorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteConnectorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteDirectoryRegistration struct { +} + +func (*validateOpDeleteDirectoryRegistration) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteDirectoryRegistration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteDirectoryRegistrationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteDirectoryRegistrationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteServicePrincipalName struct { +} + +func (*validateOpDeleteServicePrincipalName) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteServicePrincipalName) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteServicePrincipalNameInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteServicePrincipalNameInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteTemplateGroupAccessControlEntry struct { +} + +func (*validateOpDeleteTemplateGroupAccessControlEntry) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteTemplateGroupAccessControlEntry) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteTemplateGroupAccessControlEntryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteTemplateGroupAccessControlEntryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpDeleteTemplate struct { +} + +func (*validateOpDeleteTemplate) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteTemplate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteTemplateInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteTemplateInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetConnector struct { +} + +func (*validateOpGetConnector) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetConnector) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetConnectorInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetConnectorInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetDirectoryRegistration struct { +} + +func (*validateOpGetDirectoryRegistration) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetDirectoryRegistration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetDirectoryRegistrationInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetDirectoryRegistrationInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetServicePrincipalName struct { +} + +func (*validateOpGetServicePrincipalName) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetServicePrincipalName) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetServicePrincipalNameInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetServicePrincipalNameInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetTemplateGroupAccessControlEntry struct { +} + +func (*validateOpGetTemplateGroupAccessControlEntry) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetTemplateGroupAccessControlEntry) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetTemplateGroupAccessControlEntryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetTemplateGroupAccessControlEntryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpGetTemplate struct { +} + +func (*validateOpGetTemplate) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetTemplate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetTemplateInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetTemplateInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListServicePrincipalNames struct { +} + +func (*validateOpListServicePrincipalNames) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListServicePrincipalNames) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListServicePrincipalNamesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListServicePrincipalNamesInput(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 validateOpListTemplateGroupAccessControlEntries struct { +} + +func (*validateOpListTemplateGroupAccessControlEntries) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListTemplateGroupAccessControlEntries) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListTemplateGroupAccessControlEntriesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListTemplateGroupAccessControlEntriesInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpListTemplates struct { +} + +func (*validateOpListTemplates) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListTemplates) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListTemplatesInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListTemplatesInput(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 validateOpUpdateTemplateGroupAccessControlEntry struct { +} + +func (*validateOpUpdateTemplateGroupAccessControlEntry) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateTemplateGroupAccessControlEntry) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateTemplateGroupAccessControlEntryInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateTemplateGroupAccessControlEntryInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpUpdateTemplate struct { +} + +func (*validateOpUpdateTemplate) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpUpdateTemplate) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*UpdateTemplateInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpUpdateTemplateInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +func addOpCreateConnectorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateConnector{}, middleware.After) +} + +func addOpCreateDirectoryRegistrationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateDirectoryRegistration{}, middleware.After) +} + +func addOpCreateServicePrincipalNameValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateServicePrincipalName{}, middleware.After) +} + +func addOpCreateTemplateGroupAccessControlEntryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateTemplateGroupAccessControlEntry{}, middleware.After) +} + +func addOpCreateTemplateValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpCreateTemplate{}, middleware.After) +} + +func addOpDeleteConnectorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteConnector{}, middleware.After) +} + +func addOpDeleteDirectoryRegistrationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteDirectoryRegistration{}, middleware.After) +} + +func addOpDeleteServicePrincipalNameValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteServicePrincipalName{}, middleware.After) +} + +func addOpDeleteTemplateGroupAccessControlEntryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteTemplateGroupAccessControlEntry{}, middleware.After) +} + +func addOpDeleteTemplateValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteTemplate{}, middleware.After) +} + +func addOpGetConnectorValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetConnector{}, middleware.After) +} + +func addOpGetDirectoryRegistrationValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetDirectoryRegistration{}, middleware.After) +} + +func addOpGetServicePrincipalNameValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetServicePrincipalName{}, middleware.After) +} + +func addOpGetTemplateGroupAccessControlEntryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetTemplateGroupAccessControlEntry{}, middleware.After) +} + +func addOpGetTemplateValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetTemplate{}, middleware.After) +} + +func addOpListServicePrincipalNamesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListServicePrincipalNames{}, middleware.After) +} + +func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) +} + +func addOpListTemplateGroupAccessControlEntriesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListTemplateGroupAccessControlEntries{}, middleware.After) +} + +func addOpListTemplatesValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListTemplates{}, 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 addOpUpdateTemplateGroupAccessControlEntryValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateTemplateGroupAccessControlEntry{}, middleware.After) +} + +func addOpUpdateTemplateValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpUpdateTemplate{}, middleware.After) +} + +func validateApplicationPolicies(v *types.ApplicationPolicies) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ApplicationPolicies"} + if v.Policies == nil { + invalidParams.Add(smithy.NewErrParamRequired("Policies")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateCertificateValidity(v *types.CertificateValidity) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CertificateValidity"} + if v.ValidityPeriod == nil { + invalidParams.Add(smithy.NewErrParamRequired("ValidityPeriod")) + } else if v.ValidityPeriod != nil { + if err := validateValidityPeriod(v.ValidityPeriod); err != nil { + invalidParams.AddNested("ValidityPeriod", err.(smithy.InvalidParamsError)) + } + } + if v.RenewalPeriod == nil { + invalidParams.Add(smithy.NewErrParamRequired("RenewalPeriod")) + } else if v.RenewalPeriod != nil { + if err := validateValidityPeriod(v.RenewalPeriod); err != nil { + invalidParams.AddNested("RenewalPeriod", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateExtensionsV2(v *types.ExtensionsV2) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExtensionsV2"} + if v.KeyUsage == nil { + invalidParams.Add(smithy.NewErrParamRequired("KeyUsage")) + } else if v.KeyUsage != nil { + if err := validateKeyUsage(v.KeyUsage); err != nil { + invalidParams.AddNested("KeyUsage", err.(smithy.InvalidParamsError)) + } + } + if v.ApplicationPolicies != nil { + if err := validateApplicationPolicies(v.ApplicationPolicies); err != nil { + invalidParams.AddNested("ApplicationPolicies", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateExtensionsV3(v *types.ExtensionsV3) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExtensionsV3"} + if v.KeyUsage == nil { + invalidParams.Add(smithy.NewErrParamRequired("KeyUsage")) + } else if v.KeyUsage != nil { + if err := validateKeyUsage(v.KeyUsage); err != nil { + invalidParams.AddNested("KeyUsage", err.(smithy.InvalidParamsError)) + } + } + if v.ApplicationPolicies != nil { + if err := validateApplicationPolicies(v.ApplicationPolicies); err != nil { + invalidParams.AddNested("ApplicationPolicies", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateExtensionsV4(v *types.ExtensionsV4) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ExtensionsV4"} + if v.KeyUsage == nil { + invalidParams.Add(smithy.NewErrParamRequired("KeyUsage")) + } else if v.KeyUsage != nil { + if err := validateKeyUsage(v.KeyUsage); err != nil { + invalidParams.AddNested("KeyUsage", err.(smithy.InvalidParamsError)) + } + } + if v.ApplicationPolicies != nil { + if err := validateApplicationPolicies(v.ApplicationPolicies); err != nil { + invalidParams.AddNested("ApplicationPolicies", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateKeyUsage(v *types.KeyUsage) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "KeyUsage"} + if v.UsageFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("UsageFlags")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrivateKeyAttributesV2(v *types.PrivateKeyAttributesV2) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrivateKeyAttributesV2"} + if v.MinimalKeyLength == nil { + invalidParams.Add(smithy.NewErrParamRequired("MinimalKeyLength")) + } + if len(v.KeySpec) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("KeySpec")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrivateKeyAttributesV3(v *types.PrivateKeyAttributesV3) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrivateKeyAttributesV3"} + if v.MinimalKeyLength == nil { + invalidParams.Add(smithy.NewErrParamRequired("MinimalKeyLength")) + } + if len(v.KeySpec) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("KeySpec")) + } + if v.KeyUsageProperty == nil { + invalidParams.Add(smithy.NewErrParamRequired("KeyUsageProperty")) + } + if len(v.Algorithm) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("Algorithm")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrivateKeyAttributesV4(v *types.PrivateKeyAttributesV4) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrivateKeyAttributesV4"} + if v.MinimalKeyLength == nil { + invalidParams.Add(smithy.NewErrParamRequired("MinimalKeyLength")) + } + if len(v.KeySpec) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("KeySpec")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrivateKeyFlagsV2(v *types.PrivateKeyFlagsV2) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrivateKeyFlagsV2"} + if len(v.ClientVersion) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ClientVersion")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrivateKeyFlagsV3(v *types.PrivateKeyFlagsV3) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrivateKeyFlagsV3"} + if len(v.ClientVersion) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ClientVersion")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validatePrivateKeyFlagsV4(v *types.PrivateKeyFlagsV4) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PrivateKeyFlagsV4"} + if len(v.ClientVersion) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ClientVersion")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTemplateDefinition(v types.TemplateDefinition) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TemplateDefinition"} + switch uv := v.(type) { + case *types.TemplateDefinitionMemberTemplateV2: + if err := validateTemplateV2(&uv.Value); err != nil { + invalidParams.AddNested("[TemplateV2]", err.(smithy.InvalidParamsError)) + } + + case *types.TemplateDefinitionMemberTemplateV3: + if err := validateTemplateV3(&uv.Value); err != nil { + invalidParams.AddNested("[TemplateV3]", err.(smithy.InvalidParamsError)) + } + + case *types.TemplateDefinitionMemberTemplateV4: + if err := validateTemplateV4(&uv.Value); err != nil { + invalidParams.AddNested("[TemplateV4]", err.(smithy.InvalidParamsError)) + } + + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTemplateV2(v *types.TemplateV2) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TemplateV2"} + if v.CertificateValidity == nil { + invalidParams.Add(smithy.NewErrParamRequired("CertificateValidity")) + } else if v.CertificateValidity != nil { + if err := validateCertificateValidity(v.CertificateValidity); err != nil { + invalidParams.AddNested("CertificateValidity", err.(smithy.InvalidParamsError)) + } + } + if v.PrivateKeyAttributes == nil { + invalidParams.Add(smithy.NewErrParamRequired("PrivateKeyAttributes")) + } else if v.PrivateKeyAttributes != nil { + if err := validatePrivateKeyAttributesV2(v.PrivateKeyAttributes); err != nil { + invalidParams.AddNested("PrivateKeyAttributes", err.(smithy.InvalidParamsError)) + } + } + if v.PrivateKeyFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("PrivateKeyFlags")) + } else if v.PrivateKeyFlags != nil { + if err := validatePrivateKeyFlagsV2(v.PrivateKeyFlags); err != nil { + invalidParams.AddNested("PrivateKeyFlags", err.(smithy.InvalidParamsError)) + } + } + if v.EnrollmentFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("EnrollmentFlags")) + } + if v.SubjectNameFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("SubjectNameFlags")) + } + if v.GeneralFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("GeneralFlags")) + } + if v.Extensions == nil { + invalidParams.Add(smithy.NewErrParamRequired("Extensions")) + } else if v.Extensions != nil { + if err := validateExtensionsV2(v.Extensions); err != nil { + invalidParams.AddNested("Extensions", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTemplateV3(v *types.TemplateV3) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TemplateV3"} + if v.CertificateValidity == nil { + invalidParams.Add(smithy.NewErrParamRequired("CertificateValidity")) + } else if v.CertificateValidity != nil { + if err := validateCertificateValidity(v.CertificateValidity); err != nil { + invalidParams.AddNested("CertificateValidity", err.(smithy.InvalidParamsError)) + } + } + if v.PrivateKeyAttributes == nil { + invalidParams.Add(smithy.NewErrParamRequired("PrivateKeyAttributes")) + } else if v.PrivateKeyAttributes != nil { + if err := validatePrivateKeyAttributesV3(v.PrivateKeyAttributes); err != nil { + invalidParams.AddNested("PrivateKeyAttributes", err.(smithy.InvalidParamsError)) + } + } + if v.PrivateKeyFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("PrivateKeyFlags")) + } else if v.PrivateKeyFlags != nil { + if err := validatePrivateKeyFlagsV3(v.PrivateKeyFlags); err != nil { + invalidParams.AddNested("PrivateKeyFlags", err.(smithy.InvalidParamsError)) + } + } + if v.EnrollmentFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("EnrollmentFlags")) + } + if v.SubjectNameFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("SubjectNameFlags")) + } + if v.GeneralFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("GeneralFlags")) + } + if len(v.HashAlgorithm) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("HashAlgorithm")) + } + if v.Extensions == nil { + invalidParams.Add(smithy.NewErrParamRequired("Extensions")) + } else if v.Extensions != nil { + if err := validateExtensionsV3(v.Extensions); err != nil { + invalidParams.AddNested("Extensions", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateTemplateV4(v *types.TemplateV4) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TemplateV4"} + if v.CertificateValidity == nil { + invalidParams.Add(smithy.NewErrParamRequired("CertificateValidity")) + } else if v.CertificateValidity != nil { + if err := validateCertificateValidity(v.CertificateValidity); err != nil { + invalidParams.AddNested("CertificateValidity", err.(smithy.InvalidParamsError)) + } + } + if v.PrivateKeyAttributes == nil { + invalidParams.Add(smithy.NewErrParamRequired("PrivateKeyAttributes")) + } else if v.PrivateKeyAttributes != nil { + if err := validatePrivateKeyAttributesV4(v.PrivateKeyAttributes); err != nil { + invalidParams.AddNested("PrivateKeyAttributes", err.(smithy.InvalidParamsError)) + } + } + if v.PrivateKeyFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("PrivateKeyFlags")) + } else if v.PrivateKeyFlags != nil { + if err := validatePrivateKeyFlagsV4(v.PrivateKeyFlags); err != nil { + invalidParams.AddNested("PrivateKeyFlags", err.(smithy.InvalidParamsError)) + } + } + if v.EnrollmentFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("EnrollmentFlags")) + } + if v.SubjectNameFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("SubjectNameFlags")) + } + if v.GeneralFlags == nil { + invalidParams.Add(smithy.NewErrParamRequired("GeneralFlags")) + } + if v.Extensions == nil { + invalidParams.Add(smithy.NewErrParamRequired("Extensions")) + } else if v.Extensions != nil { + if err := validateExtensionsV4(v.Extensions); err != nil { + invalidParams.AddNested("Extensions", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateValidityPeriod(v *types.ValidityPeriod) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ValidityPeriod"} + if len(v.PeriodType) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("PeriodType")) + } + if v.Period == nil { + invalidParams.Add(smithy.NewErrParamRequired("Period")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateVpcInformation(v *types.VpcInformation) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "VpcInformation"} + if v.SecurityGroupIds == nil { + invalidParams.Add(smithy.NewErrParamRequired("SecurityGroupIds")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateConnectorInput(v *CreateConnectorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateConnectorInput"} + if v.DirectoryId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DirectoryId")) + } + if v.CertificateAuthorityArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("CertificateAuthorityArn")) + } + if v.VpcInformation == nil { + invalidParams.Add(smithy.NewErrParamRequired("VpcInformation")) + } else if v.VpcInformation != nil { + if err := validateVpcInformation(v.VpcInformation); err != nil { + invalidParams.AddNested("VpcInformation", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateDirectoryRegistrationInput(v *CreateDirectoryRegistrationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateDirectoryRegistrationInput"} + if v.DirectoryId == nil { + invalidParams.Add(smithy.NewErrParamRequired("DirectoryId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateServicePrincipalNameInput(v *CreateServicePrincipalNameInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateServicePrincipalNameInput"} + if v.DirectoryRegistrationArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("DirectoryRegistrationArn")) + } + if v.ConnectorArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConnectorArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateTemplateGroupAccessControlEntryInput(v *CreateTemplateGroupAccessControlEntryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateTemplateGroupAccessControlEntryInput"} + if v.TemplateArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateArn")) + } + if v.GroupSecurityIdentifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupSecurityIdentifier")) + } + if v.GroupDisplayName == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupDisplayName")) + } + if v.AccessRights == nil { + invalidParams.Add(smithy.NewErrParamRequired("AccessRights")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpCreateTemplateInput(v *CreateTemplateInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "CreateTemplateInput"} + if v.ConnectorArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConnectorArn")) + } + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.Definition == nil { + invalidParams.Add(smithy.NewErrParamRequired("Definition")) + } else if v.Definition != nil { + if err := validateTemplateDefinition(v.Definition); err != nil { + invalidParams.AddNested("Definition", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteConnectorInput(v *DeleteConnectorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteConnectorInput"} + if v.ConnectorArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConnectorArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteDirectoryRegistrationInput(v *DeleteDirectoryRegistrationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteDirectoryRegistrationInput"} + if v.DirectoryRegistrationArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("DirectoryRegistrationArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteServicePrincipalNameInput(v *DeleteServicePrincipalNameInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteServicePrincipalNameInput"} + if v.DirectoryRegistrationArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("DirectoryRegistrationArn")) + } + if v.ConnectorArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConnectorArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteTemplateGroupAccessControlEntryInput(v *DeleteTemplateGroupAccessControlEntryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteTemplateGroupAccessControlEntryInput"} + if v.TemplateArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateArn")) + } + if v.GroupSecurityIdentifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupSecurityIdentifier")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpDeleteTemplateInput(v *DeleteTemplateInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteTemplateInput"} + if v.TemplateArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetConnectorInput(v *GetConnectorInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetConnectorInput"} + if v.ConnectorArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConnectorArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetDirectoryRegistrationInput(v *GetDirectoryRegistrationInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetDirectoryRegistrationInput"} + if v.DirectoryRegistrationArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("DirectoryRegistrationArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetServicePrincipalNameInput(v *GetServicePrincipalNameInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetServicePrincipalNameInput"} + if v.DirectoryRegistrationArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("DirectoryRegistrationArn")) + } + if v.ConnectorArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConnectorArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetTemplateGroupAccessControlEntryInput(v *GetTemplateGroupAccessControlEntryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetTemplateGroupAccessControlEntryInput"} + if v.TemplateArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateArn")) + } + if v.GroupSecurityIdentifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupSecurityIdentifier")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpGetTemplateInput(v *GetTemplateInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetTemplateInput"} + if v.TemplateArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListServicePrincipalNamesInput(v *ListServicePrincipalNamesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListServicePrincipalNamesInput"} + if v.DirectoryRegistrationArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("DirectoryRegistrationArn")) + } + 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 validateOpListTemplateGroupAccessControlEntriesInput(v *ListTemplateGroupAccessControlEntriesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListTemplateGroupAccessControlEntriesInput"} + if v.TemplateArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpListTemplatesInput(v *ListTemplatesInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListTemplatesInput"} + if v.ConnectorArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ConnectorArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpTagResourceInput(v *TagResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "TagResourceInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if v.Tags == nil { + invalidParams.Add(smithy.NewErrParamRequired("Tags")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUntagResourceInput(v *UntagResourceInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UntagResourceInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if v.TagKeys == nil { + invalidParams.Add(smithy.NewErrParamRequired("TagKeys")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateTemplateGroupAccessControlEntryInput(v *UpdateTemplateGroupAccessControlEntryInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateTemplateGroupAccessControlEntryInput"} + if v.TemplateArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateArn")) + } + if v.GroupSecurityIdentifier == nil { + invalidParams.Add(smithy.NewErrParamRequired("GroupSecurityIdentifier")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpUpdateTemplateInput(v *UpdateTemplateInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "UpdateTemplateInput"} + if v.TemplateArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("TemplateArn")) + } + if v.Definition != nil { + if err := validateTemplateDefinition(v.Definition); err != nil { + invalidParams.AddNested("Definition", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} diff --git a/service/sagemaker/deserializers.go b/service/sagemaker/deserializers.go index 499099ae510..e0f0f788e64 100644 --- a/service/sagemaker/deserializers.go +++ b/service/sagemaker/deserializers.go @@ -37459,6 +37459,11 @@ func awsAwsjson11_deserializeDocumentCanvasAppSettings(v **types.CanvasAppSettin for key, value := range shape { switch key { + case "IdentityProviderOAuthSettings": + if err := awsAwsjson11_deserializeDocumentIdentityProviderOAuthSettings(&sv.IdentityProviderOAuthSettings, value); err != nil { + return err + } + case "ModelRegisterSettings": if err := awsAwsjson11_deserializeDocumentModelRegisterSettings(&sv.ModelRegisterSettings, value); err != nil { return err @@ -49381,6 +49386,98 @@ func awsAwsjson11_deserializeDocumentIamIdentity(v **types.IamIdentity, value in return nil } +func awsAwsjson11_deserializeDocumentIdentityProviderOAuthSetting(v **types.IdentityProviderOAuthSetting, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", 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.IdentityProviderOAuthSetting + if *v == nil { + sv = &types.IdentityProviderOAuthSetting{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DataSourceName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DataSourceName to be of type string, got %T instead", value) + } + sv.DataSourceName = types.DataSourceName(jtv) + } + + case "SecretArn": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SecretArn to be of type string, got %T instead", value) + } + sv.SecretArn = ptr.String(jtv) + } + + case "Status": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FeatureStatus to be of type string, got %T instead", value) + } + sv.Status = types.FeatureStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentIdentityProviderOAuthSettings(v *[]types.IdentityProviderOAuthSetting, 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.IdentityProviderOAuthSetting + if *v == nil { + cv = []types.IdentityProviderOAuthSetting{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.IdentityProviderOAuthSetting + destAddr := &col + if err := awsAwsjson11_deserializeDocumentIdentityProviderOAuthSetting(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsAwsjson11_deserializeDocumentImage(v **types.Image, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/sagemaker/serializers.go b/service/sagemaker/serializers.go index 0a31fb78d9c..5fbd16815ba 100644 --- a/service/sagemaker/serializers.go +++ b/service/sagemaker/serializers.go @@ -17820,6 +17820,13 @@ func awsAwsjson11_serializeDocumentCanvasAppSettings(v *types.CanvasAppSettings, object := value.Object() defer object.Close() + if v.IdentityProviderOAuthSettings != nil { + ok := object.Key("IdentityProviderOAuthSettings") + if err := awsAwsjson11_serializeDocumentIdentityProviderOAuthSettings(v.IdentityProviderOAuthSettings, ok); err != nil { + return err + } + } + if v.ModelRegisterSettings != nil { ok := object.Key("ModelRegisterSettings") if err := awsAwsjson11_serializeDocumentModelRegisterSettings(v.ModelRegisterSettings, ok); err != nil { @@ -20735,6 +20742,41 @@ func awsAwsjson11_serializeDocumentHyperParameterTuningResourceConfig(v *types.H return nil } +func awsAwsjson11_serializeDocumentIdentityProviderOAuthSetting(v *types.IdentityProviderOAuthSetting, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.DataSourceName) > 0 { + ok := object.Key("DataSourceName") + ok.String(string(v.DataSourceName)) + } + + if v.SecretArn != nil { + ok := object.Key("SecretArn") + ok.String(*v.SecretArn) + } + + if len(v.Status) > 0 { + ok := object.Key("Status") + ok.String(string(v.Status)) + } + + return nil +} + +func awsAwsjson11_serializeDocumentIdentityProviderOAuthSettings(v []types.IdentityProviderOAuthSetting, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsAwsjson11_serializeDocumentIdentityProviderOAuthSetting(&v[i], av); err != nil { + return err + } + } + return nil +} + func awsAwsjson11_serializeDocumentImageClassificationJobConfig(v *types.ImageClassificationJobConfig, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/sagemaker/types/enums.go b/service/sagemaker/types/enums.go index 6f8debbc424..22bfc49e46a 100644 --- a/service/sagemaker/types/enums.go +++ b/service/sagemaker/types/enums.go @@ -1406,6 +1406,24 @@ func (DataDistributionType) Values() []DataDistributionType { } } +type DataSourceName string + +// Enum values for DataSourceName +const ( + DataSourceNameSalesforceGenie DataSourceName = "SalesforceGenie" + DataSourceNameSnowflake DataSourceName = "Snowflake" +) + +// Values returns all known values for DataSourceName. 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 (DataSourceName) Values() []DataSourceName { + return []DataSourceName{ + "SalesforceGenie", + "Snowflake", + } +} + type DetailedAlgorithmStatus string // Enum values for DetailedAlgorithmStatus diff --git a/service/sagemaker/types/types.go b/service/sagemaker/types/types.go index 079880a8ba5..36b4d612abc 100644 --- a/service/sagemaker/types/types.go +++ b/service/sagemaker/types/types.go @@ -2020,6 +2020,9 @@ type CandidateProperties struct { // The SageMaker Canvas application settings. type CanvasAppSettings struct { + // The settings for connecting to an external data source with OAuth. + IdentityProviderOAuthSettings []IdentityProviderOAuthSetting + // The model registry settings for the SageMaker Canvas application. ModelRegisterSettings *ModelRegisterSettings @@ -6512,6 +6515,26 @@ type IamIdentity struct { noSmithyDocumentSerde } +// The Amazon SageMaker Canvas app setting where you configure OAuth for +// connecting to an external data source, such as Snowflake. +type IdentityProviderOAuthSetting struct { + + // The name of the data source that you're connecting to. Canvas currently + // supports OAuth for Snowflake and Salesforce Data Cloud. + DataSourceName DataSourceName + + // The ARN of an Amazon Web Services Secrets Manager secret that stores the + // credentials from your identity provider, such as the client ID and secret, + // authorization URL, and token URL. + SecretArn *string + + // Describes whether OAuth for a data source is enabled or disabled in the Canvas + // application. + Status FeatureStatus + + noSmithyDocumentSerde +} + // A SageMaker image. A SageMaker image represents a set of container images that // are derived from a common base container image. Each of these container images // is represented by a SageMaker ImageVersion . @@ -11779,7 +11802,7 @@ type RecommendationJobInputConfig struct { Endpoints []EndpointInfo // Specifies the maximum duration of the job, in seconds. The maximum value is - // 7200. + // 18,000 seconds. JobDurationInSeconds *int32 // The name of the created model.